diff options
author | ethannicholas <ethannicholas@google.com> | 2016-11-09 13:26:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-09 13:26:45 -0800 |
commit | 08a9211a8492a84e1f4a6899759f8f37ed5aec3e (patch) | |
tree | 8fe430d685b62467d0a59aa374ef7b98d6a3db4a /tests/SkSLErrorTest.cpp | |
parent | f2b024db6777a904d986c68a21ba0bc41f956f6e (diff) |
added constant folding & branch elimination to skslc
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2489673002
Committed: https://skia.googlesource.com/skia/+/6136310ee8f43247548bcefcaeca6d43023c10aa
Review-Url: https://codereview.chromium.org/2489673002
Diffstat (limited to 'tests/SkSLErrorTest.cpp')
-rw-r--r-- | tests/SkSLErrorTest.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp index 9e89b71473..fc20fa2e6d 100644 --- a/tests/SkSLErrorTest.cpp +++ b/tests/SkSLErrorTest.cpp @@ -352,3 +352,19 @@ DEF_TEST(SkSLContinueOutsideLoop, r) { "void foo() { for(;;); continue; }", "error: 1: continue statement must be inside a loop\n1 error\n"); } + +DEF_TEST(SkSLStaticIfError, r) { + // ensure eliminated branch of static if / ternary is still checked for errors + test_failure(r, + "void foo() { if (true); else x = 5; }", + "error: 1: unknown identifier 'x'\n1 error\n"); + test_failure(r, + "void foo() { if (false) x = 5; }", + "error: 1: unknown identifier 'x'\n1 error\n"); + test_failure(r, + "void foo() { true ? 5 : x; }", + "error: 1: unknown identifier 'x'\n1 error\n"); + test_failure(r, + "void foo() { false ? x : 5; }", + "error: 1: unknown identifier 'x'\n1 error\n"); +} |