OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkSLCompiler.h" | 8 #include "SkSLCompiler.h" |
9 | 9 |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 test_failure(r, | 345 test_failure(r, |
346 "void foo() { while(true) {} if (true) break; }", | 346 "void foo() { while(true) {} if (true) break; }", |
347 "error: 1: break statement must be inside a loop\n1 error\n"); | 347 "error: 1: break statement must be inside a loop\n1 error\n"); |
348 } | 348 } |
349 | 349 |
350 DEF_TEST(SkSLContinueOutsideLoop, r) { | 350 DEF_TEST(SkSLContinueOutsideLoop, r) { |
351 test_failure(r, | 351 test_failure(r, |
352 "void foo() { for(;;); continue; }", | 352 "void foo() { for(;;); continue; }", |
353 "error: 1: continue statement must be inside a loop\n1 error\n"
); | 353 "error: 1: continue statement must be inside a loop\n1 error\n"
); |
354 } | 354 } |
355 | |
356 DEF_TEST(SkSLStaticIfError, r) { | |
357 // ensure eliminated branch of static if / ternary is still checked for erro
rs | |
358 test_failure(r, | |
359 "void foo() { if (true); else x = 5; }", | |
360 "error: 1: unknown identifier 'x'\n1 error\n"); | |
361 test_failure(r, | |
362 "void foo() { if (false) x = 5; }", | |
363 "error: 1: unknown identifier 'x'\n1 error\n"); | |
364 test_failure(r, | |
365 "void foo() { true ? 5 : x; }", | |
366 "error: 1: unknown identifier 'x'\n1 error\n"); | |
367 test_failure(r, | |
368 "void foo() { false ? x : 5; }", | |
369 "error: 1: unknown identifier 'x'\n1 error\n"); | |
370 } | |
OLD | NEW |