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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 test_failure(r, | 256 test_failure(r, |
257 "const int x; void main() { x = 0; }", | 257 "const int x; void main() { x = 0; }", |
258 "error: 1: cannot modify immutable variable 'x'\n1 error\n"); | 258 "error: 1: cannot modify immutable variable 'x'\n1 error\n"); |
259 } | 259 } |
260 | 260 |
261 DEF_TEST(SkSLBadIndex, r) { | 261 DEF_TEST(SkSLBadIndex, r) { |
262 test_failure(r, | 262 test_failure(r, |
263 "void main() { int x = 2[0]; }", | 263 "void main() { int x = 2[0]; }", |
264 "error: 1: expected array, but found 'int'\n1 error\n"); | 264 "error: 1: expected array, but found 'int'\n1 error\n"); |
265 test_failure(r, | 265 test_failure(r, |
266 "void main() { vec2 x = vec2(0); int y = x[0]; }", | 266 "void main() { vec2 x = vec2(0); int y = x[0][0]; }", |
267 "error: 1: expected array, but found 'vec2'\n1 error\n"); | 267 "error: 1: expected array, but found 'float'\n1 error\n"); |
268 } | 268 } |
269 | 269 |
270 DEF_TEST(SkSLTernaryMismatch, r) { | 270 DEF_TEST(SkSLTernaryMismatch, r) { |
271 test_failure(r, | 271 test_failure(r, |
272 "void main() { int x = 5 > 2 ? true : 1.0; }", | 272 "void main() { int x = 5 > 2 ? true : 1.0; }", |
273 "error: 1: ternary operator result mismatch: 'bool', 'float'\n1
error\n"); | 273 "error: 1: ternary operator result mismatch: 'bool', 'float'\n1
error\n"); |
274 } | 274 } |
275 | 275 |
276 DEF_TEST(SkSLInterfaceBlockStorageModifiers, r) { | 276 DEF_TEST(SkSLInterfaceBlockStorageModifiers, r) { |
277 test_failure(r, | 277 test_failure(r, |
278 "uniform foo { out int x; };", | 278 "uniform foo { out int x; };", |
279 "error: 1: interface block fields may not have storage qualifie
rs\n1 error\n"); | 279 "error: 1: interface block fields may not have storage qualifie
rs\n1 error\n"); |
280 } | 280 } |
OLD | NEW |