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" |
11 | 11 |
12 #if SK_SUPPORT_GPU | 12 #if SKIA_SUPPORT_GPU |
13 | 13 |
14 static void test_failure(skiatest::Reporter* r, const char* src, const char* err
or) { | 14 static void test_failure(skiatest::Reporter* r, const char* src, const char* err
or) { |
15 SkSL::Compiler compiler; | 15 SkSL::Compiler compiler; |
16 std::stringstream out; | 16 std::stringstream out; |
17 bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, src, out); | 17 bool result = compiler.toSPIRV(SkSL::Program::kFragment_Kind, src, out); |
18 if (compiler.errorText() != error) { | 18 if (compiler.errorText() != error) { |
19 SkDebugf("SKSL ERROR:\n source: %s\n expected: %s received: %s"
, src, error, | 19 SkDebugf("SKSL ERROR:\n source: %s\n expected: %s received: %s"
, src, error, |
20 compiler.errorText().c_str()); | 20 compiler.errorText().c_str()); |
21 } | 21 } |
22 REPORTER_ASSERT(r, !result); | 22 REPORTER_ASSERT(r, !result); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 "error: 1: unknown identifier 'x'\n1 error\n"); | 365 "error: 1: unknown identifier 'x'\n1 error\n"); |
366 test_failure(r, | 366 test_failure(r, |
367 "void foo() { true ? 5 : x; }", | 367 "void foo() { true ? 5 : x; }", |
368 "error: 1: unknown identifier 'x'\n1 error\n"); | 368 "error: 1: unknown identifier 'x'\n1 error\n"); |
369 test_failure(r, | 369 test_failure(r, |
370 "void foo() { false ? x : 5; }", | 370 "void foo() { false ? x : 5; }", |
371 "error: 1: unknown identifier 'x'\n1 error\n"); | 371 "error: 1: unknown identifier 'x'\n1 error\n"); |
372 } | 372 } |
373 | 373 |
374 #endif | 374 #endif |
OLD | NEW |