fixed a divide-by-zero bug in skslc

BUG=skia:5960

Change-Id: I8ace6efefd14b11c3bc2448a1ab4e3353a29075f
Reviewed-on: https://skia-review.googlesource.com/6539
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/tests/SkSLErrorTest.cpp b/tests/SkSLErrorTest.cpp
index e872977..4dd92f3 100644
--- a/tests/SkSLErrorTest.cpp
+++ b/tests/SkSLErrorTest.cpp
@@ -400,4 +400,19 @@
                  "error: 1: offset of field 'y' must be at least 4\n1 error\n");
 }
 
+DEF_TEST(SkSLDivByZero, r) {
+    test_failure(r,
+                 "int x = 1 / 0;",
+                 "error: 1: division by zero\n1 error\n");
+    test_failure(r,
+                 "float x = 1 / 0;",
+                 "error: 1: division by zero\n1 error\n");
+    test_failure(r,
+                 "float x = 1.0 / 0.0;",
+                 "error: 1: division by zero\n1 error\n");
+    test_failure(r,
+                 "float x = -67.0 / (3.0 - 3);",
+                 "error: 1: division by zero\n1 error\n");
+}
+
 #endif