-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fold compound expressions with literal arguments into literals
- Loading branch information
Anand Thakker
committed
Sep 15, 2017
1 parent
50243f7
commit 0567a8f
Showing
5 changed files
with
98 additions
and
6 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
28 changes: 28 additions & 0 deletions
28
test/integration/expression-tests/constant-folding/evaluation-error/test.json
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,28 @@ | ||
{ | ||
"expectExpressionType": {"kind": "Color"}, | ||
"expression": [ | ||
"curve", | ||
["step"], | ||
["get", "x"], | ||
"black", | ||
0, | ||
"invalid", | ||
10, | ||
"blue" | ||
], | ||
"inputs": [ | ||
[{}, {"properties": {"x": -1}}], | ||
[{}, {"properties": {"x": 0}}], | ||
[{}, {"properties": {"x": 5}}], | ||
[{}, {"properties": {"x": 10}}], | ||
[{}, {"properties": {"x": 11}}] | ||
], | ||
"expected": { | ||
"compiled": { | ||
"result": "error", | ||
"errors": [ | ||
{"key": "[5]", "error": "Could not parse color from value 'invalid'"} | ||
] | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/integration/expression-tests/constant-folding/to-color/test.json
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 @@ | ||
{ | ||
"expectExpressionType": null, | ||
"expression": ["to-color", "red"], | ||
"inputs": [[{}, {}]], | ||
"expected": { | ||
"compiled": { | ||
"result": "success", | ||
"isFeatureConstant": true, | ||
"isZoomConstant": true, | ||
"type": "Color" | ||
}, | ||
"outputs": [ | ||
[1, 0, 0, 1] | ||
] | ||
} | ||
} |