-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #250, strings vs expressions boundary cases
- Loading branch information
1 parent
ab40092
commit 3a1d25e
Showing
19 changed files
with
222 additions
and
87 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
test/colorization/inputs/end-bracket-wrong-place.INVALID.jsonc
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
test/colorization/inputs/expr-vs-string.is-expression.jsonc
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,16 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", | ||
// | ||
// Handle escaped characters - this should be an expression with a literal string inside it | ||
// | ||
"$TEST1": "['I said Hi! He''s here']", | ||
"$TEST2": "['I said \"Hi! He''s here!\"']", | ||
// | ||
// Multi-line expressions - the colorization can't peek onto another line to determine whether the | ||
// string ends with "]" (and therefore know it's an expression and not a string), so assume it is an expression | ||
// if a multi-line string starts with "[" | ||
"$TEST10": "[concat('This is a ', 1, '-line ', 'expression ', 4, 'you!')]", //asdf | ||
"$TEST11": "[concat('This is a ', | ||
3, '-line ', | ||
'expression ', 4, ' you!')]" | ||
} |
23 changes: 23 additions & 0 deletions
23
test/colorization/inputs/expr-vs-string.is-string.NOT-EXPR.jsonc
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,23 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", | ||
// | ||
// Not an expression if it starts with [[ | ||
// | ||
"$TEST1": "[[2]]", | ||
"$TEST2": "[[[four]five]", | ||
"$TEST3": "[['I said \"Hi! He''s here!\"]", | ||
// | ||
// Not an expression if it doesn't end with ] | ||
// | ||
"$TEST10": "[pre]post", | ||
"$TEST11": "[[three]four", | ||
// | ||
// Not an expression if it doesn't start immediately with [ or the very last character is not ] (even if it's whitespace) | ||
// | ||
"$TEST20": " [starts with whitespace]", | ||
"$TEST21": "[ends with whitespace] ", | ||
// | ||
// Real examples | ||
// | ||
"$TEST100": "[ChefInSpec]InstalledApplicationLinuxResource1;AttributesYmlContent" | ||
} |
15 changes: 15 additions & 0 deletions
15
test/colorization/inputs/expr-vs-string.multiline.NOT-EXPR.jsonc
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,15 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", | ||
// | ||
// Not an expression if it starts with [[ | ||
// | ||
"$TEST1": "[[2 | ||
]]", | ||
"$TEST2": "[[[four] | ||
five]", | ||
// | ||
// Not an expression if it doesn't start immediately with [ or the very last character is not ] (even if it's whitespace) | ||
// | ||
"$TEST20": " | ||
[starts with whitespace]" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
test/colorization/results/end-bracket-wrong-place.INVALID.jsonc.txt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.