Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1295)

Unified Diff: tests/SkSLErrorTest.cpp

Issue 2489673002: added constant folding & branch elimination to skslc (Closed)
Patch Set: minor cleanups Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/SkSLErrorTest.cpp
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index 9e89b71473ab5f3c56aa0238240b2781e232e724..fc20fa2e6d03a79e60f16be096f7716bba90ef09 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");
+}

Powered by Google App Engine
This is Rietveld 408576698