forked from hashicorp/hcl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/hclspecsuite: Check for expected diagnostics
When a test file declares one or more expected diagnostics, we check those instead of checking the result value. The severities and source ranges must match. We don't test the error messages themselves because they are not part of the specification and may vary between implementations or, in future, be translated into other languages.
- Loading branch information
1 parent
767fb36
commit a5c0f7f
Showing
5 changed files
with
140 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a = "a value", b = "b value" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
literal { | ||
value = null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This test verifies that comma-separated attributes on the same line are | ||
# reported as an error, rather than being parsed like an object constructor | ||
# expression. | ||
|
||
diagnostics { | ||
error { | ||
# Message like "missing newline after argument" or "each argument must be on its own line" | ||
from { | ||
line = 1 | ||
column = 14 | ||
byte = 13 | ||
} | ||
to { | ||
line = 1 | ||
column = 15 | ||
byte = 14 | ||
} | ||
} | ||
} |