Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 test_failure(r, | 132 test_failure(r, |
| 133 "void main() { vec4 test = vec2(1).xxxxx; }", | 133 "void main() { vec4 test = vec2(1).xxxxx; }", |
| 134 "error: 1: too many components in swizzle mask 'xxxxx'\n1 error \n"); | 134 "error: 1: too many components in swizzle mask 'xxxxx'\n1 error \n"); |
| 135 } | 135 } |
| 136 | 136 |
| 137 DEF_TEST(SkSLSwizzleDuplicateOutput, r) { | 137 DEF_TEST(SkSLSwizzleDuplicateOutput, r) { |
| 138 test_failure(r, | 138 test_failure(r, |
| 139 "void main() { vec4 test = vec4(1); test.xyyz = vec4(1); }", | 139 "void main() { vec4 test = vec4(1); test.xyyz = vec4(1); }", |
| 140 "error: 1: cannot write to the same swizzle field more than onc e\n1 error\n"); | 140 "error: 1: cannot write to the same swizzle field more than onc e\n1 error\n"); |
| 141 } | 141 } |
| 142 | |
| 142 DEF_TEST(SkSLAssignmentTypeMismatch, r) { | 143 DEF_TEST(SkSLAssignmentTypeMismatch, r) { |
| 143 test_failure(r, | 144 test_failure(r, |
| 144 "void main() { int x = 1.0; }", | 145 "void main() { int x = 1.0; }", |
| 145 "error: 1: expected 'int', but found 'float'\n1 error\n"); | 146 "error: 1: expected 'int', but found 'float'\n1 error\n"); |
| 147 test_failure(r, | |
| 148 "void main() { int x; x = 1.0; }", | |
| 149 "error: 1: type mismatch: '=' cannot operate on 'int', 'float'\ n1 error\n"); | |
| 150 test_failure(r, | |
| 151 "void main() { ivec3 x = ivec3(0); x *= 1.0; }", | |
|
dogben
2016/10/17 17:27:57
Would this be OK if it were vec instead of ivec? M
| |
| 152 "error: 1: type mismatch: '*=' cannot operate on 'ivec3', 'floa t'\n1 error\n"); | |
| 146 } | 153 } |
| 147 | 154 |
| 148 DEF_TEST(SkSLReturnFromVoid, r) { | 155 DEF_TEST(SkSLReturnFromVoid, r) { |
| 149 test_failure(r, | 156 test_failure(r, |
| 150 "void main() { return true; }", | 157 "void main() { return true; }", |
| 151 "error: 1: may not return a value from a void function\n1 error \n"); | 158 "error: 1: may not return a value from a void function\n1 error \n"); |
| 152 } | 159 } |
| 153 | 160 |
| 154 DEF_TEST(SkSLReturnMissingValue, r) { | 161 DEF_TEST(SkSLReturnMissingValue, r) { |
| 155 test_failure(r, | 162 test_failure(r, |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 test_failure(r, | 332 test_failure(r, |
| 326 "void foo() { while(true) {} if (true) break; }", | 333 "void foo() { while(true) {} if (true) break; }", |
| 327 "error: 1: break statement must be inside a loop\n1 error\n"); | 334 "error: 1: break statement must be inside a loop\n1 error\n"); |
| 328 } | 335 } |
| 329 | 336 |
| 330 DEF_TEST(SkSLContinueOutsideLoop, r) { | 337 DEF_TEST(SkSLContinueOutsideLoop, r) { |
| 331 test_failure(r, | 338 test_failure(r, |
| 332 "void foo() { for(;;); continue; }", | 339 "void foo() { for(;;); continue; }", |
| 333 "error: 1: continue statement must be inside a loop\n1 error\n" ); | 340 "error: 1: continue statement must be inside a loop\n1 error\n" ); |
| 334 } | 341 } |
| OLD | NEW |