| 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 25 matching lines...) Expand all  Loading... | 
| 36 | 36 | 
| 37 DEF_TEST(SkSLUndefinedFunction, r) { | 37 DEF_TEST(SkSLUndefinedFunction, r) { | 
| 38     test_failure(r, | 38     test_failure(r, | 
| 39                  "void main() { int x = foo(1); }", | 39                  "void main() { int x = foo(1); }", | 
| 40                  "error: 1: unknown identifier 'foo'\n1 error\n"); | 40                  "error: 1: unknown identifier 'foo'\n1 error\n"); | 
| 41 } | 41 } | 
| 42 | 42 | 
| 43 DEF_TEST(SkSLGenericArgumentMismatch, r) { | 43 DEF_TEST(SkSLGenericArgumentMismatch, r) { | 
| 44     test_failure(r, | 44     test_failure(r, | 
| 45                  "void main() { float x = sin(1, 2); }", | 45                  "void main() { float x = sin(1, 2); }", | 
| 46                  "error: 1: no match for sin(int, int)\n1 error\n"); | 46                  "error: 1: call to 'sin' expected 1 argument, but found 2\n1 er
     ror\n"); | 
|  | 47     test_failure(r, | 
|  | 48                  "void main() { float x = sin(true); }", | 
|  | 49                  "error: 1: no match for sin(bool)\n1 error\n"); | 
|  | 50     test_success(r, | 
|  | 51                  "void main() { float x = sin(1); }"); | 
| 47 } | 52 } | 
| 48 | 53 | 
| 49 DEF_TEST(SkSLArgumentCountMismatch, r) { | 54 DEF_TEST(SkSLArgumentCountMismatch, r) { | 
| 50     test_failure(r, | 55     test_failure(r, | 
| 51                  "float foo(float x) { return x * x; }" | 56                  "float foo(float x) { return x * x; }" | 
| 52                  "void main() { float x = foo(1, 2); }", | 57                  "void main() { float x = foo(1, 2); }", | 
| 53                  "error: 1: call to 'foo' expected 1 argument, but found 2\n1 er
     ror\n"); | 58                  "error: 1: call to 'foo' expected 1 argument, but found 2\n1 er
     ror\n"); | 
| 54 } | 59 } | 
| 55 | 60 | 
| 56 DEF_TEST(SkSLArgumentMismatch, r) { | 61 DEF_TEST(SkSLArgumentMismatch, r) { | 
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 334     test_failure(r, | 339     test_failure(r, | 
| 335                  "void foo() { while(true) {} if (true) break; }", | 340                  "void foo() { while(true) {} if (true) break; }", | 
| 336                  "error: 1: break statement must be inside a loop\n1 error\n"); | 341                  "error: 1: break statement must be inside a loop\n1 error\n"); | 
| 337 } | 342 } | 
| 338 | 343 | 
| 339 DEF_TEST(SkSLContinueOutsideLoop, r) { | 344 DEF_TEST(SkSLContinueOutsideLoop, r) { | 
| 340     test_failure(r, | 345     test_failure(r, | 
| 341                  "void foo() { for(;;); continue; }", | 346                  "void foo() { for(;;); continue; }", | 
| 342                  "error: 1: continue statement must be inside a loop\n1 error\n"
     ); | 347                  "error: 1: continue statement must be inside a loop\n1 error\n"
     ); | 
| 343 } | 348 } | 
| OLD | NEW | 
|---|