diff options
author | ethannicholas <ethannicholas@google.com> | 2016-11-09 09:09:26 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-09 09:09:26 -0800 |
commit | 6136310ee8f43247548bcefcaeca6d43023c10aa (patch) | |
tree | 4b901dc0b72035a979e1e3a313d2a7710e850bcf /tests/SkSLErrorTest.cpp | |
parent | 6a01554e9e8687c56e6b6707e0c6a02062a1824e (diff) |
added constant folding & branch elimination to skslc
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2489673002
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"); +} |