Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Unified Diff: tests/SkSLErrorTest.cpp

Issue 2427693002: more skslc hardening (Closed)
Patch Set: added another test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/sksl/ir/SkSLTypeReference.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkSLErrorTest.cpp
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index d9109483b250014a4f7cbe53d15bcfe72eee8877..47e31e6ee421229826758971b7f4fdc91f5a4ec0 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -139,10 +139,19 @@ DEF_TEST(SkSLSwizzleDuplicateOutput, r) {
"void main() { vec4 test = vec4(1); test.xyyz = vec4(1); }",
"error: 1: cannot write to the same swizzle field more than once\n1 error\n");
}
+
DEF_TEST(SkSLAssignmentTypeMismatch, r) {
test_failure(r,
"void main() { int x = 1.0; }",
"error: 1: expected 'int', but found 'float'\n1 error\n");
+ test_failure(r,
+ "void main() { int x; x = 1.0; }",
+ "error: 1: type mismatch: '=' cannot operate on 'int', 'float'\n1 error\n");
+ test_success(r,
+ "void main() { vec3 x = vec3(0); x *= 1.0; }");
+ test_failure(r,
+ "void main() { ivec3 x = ivec3(0); x *= 1.0; }",
+ "error: 1: type mismatch: '*=' cannot operate on 'ivec3', 'float'\n1 error\n");
}
DEF_TEST(SkSLReturnFromVoid, r) {
« no previous file with comments | « src/sksl/ir/SkSLTypeReference.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698