]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "scanner" tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 Nov 2019 17:23:58 +0000 (18:23 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 Nov 2019 17:23:58 +0000 (18:23 +0100)
17 files changed:
tests/Makefile.am
tests/parser/preprocessor.vala
tests/scanner/comment-not-closed.test [new file with mode: 0644]
tests/scanner/preprocessor-invalid.test [new file with mode: 0644]
tests/scanner/preprocessor-missing-paren.test [new file with mode: 0644]
tests/scanner/preprocessor-unexpected.test [new file with mode: 0644]
tests/scanner/regex-escape-invalid.test [new file with mode: 0644]
tests/scanner/regex-escape-u-digit-length.test [new file with mode: 0644]
tests/scanner/regex-escape-x-digit-length.test [new file with mode: 0644]
tests/scanner/regex-escape-x.vala [new file with mode: 0644]
tests/scanner/regex-multiple-i.test [new file with mode: 0644]
tests/scanner/regex-multiple-m.test [new file with mode: 0644]
tests/scanner/regex-multiple-s.test [new file with mode: 0644]
tests/scanner/regex-multiple-x.test [new file with mode: 0644]
tests/scanner/string-escape-u-digit-length.test [new file with mode: 0644]
tests/scanner/string-escape-x-digit-length.test [new file with mode: 0644]
tests/scanner/string-escape-x.vala [new file with mode: 0644]

index 37612b87f9df54059e92c1bf6bdf02a287080c4a..bb873f603e4406e72a1e984a9dc9b979f52a1242 100644 (file)
@@ -564,6 +564,21 @@ TESTS = \
        annotations/deprecated.vala \
        annotations/description.vala \
        annotations/noaccessormethod.test \
+       scanner/comment-not-closed.test \
+       scanner/preprocessor-invalid.test \
+       scanner/preprocessor-missing-paren.test \
+       scanner/preprocessor-unexpected.test \
+       scanner/regex-escape-invalid.test \
+       scanner/regex-escape-u-digit-length.test \
+       scanner/regex-escape-x-digit-length.test \
+       scanner/regex-escape-x.vala \
+       scanner/regex-multiple-i.test \
+       scanner/regex-multiple-m.test \
+       scanner/regex-multiple-s.test \
+       scanner/regex-multiple-x.test \
+       scanner/string-escape-u-digit-length.test \
+       scanner/string-escape-x-digit-length.test \
+       scanner/string-escape-x.vala \
        parser/assignment.vala \
        parser/attribute-duplicate.test \
        parser/attribute-wrong-number.test \
index de71b2a1c4fad7d5769321f29ecf7753cc985c6a..0a15751d018091b3a73289485eca8aa43cc38e14 100644 (file)
@@ -3,6 +3,14 @@ void main () {
        assert_not_reached ();
 #elif VALA_NEVER_SET_BAR
        assert_not_reached ();
+#elif VALA_NEVER_SET_FOO && VALA_NEVER_SET_BAR
+       assert_not_reached ();
+#elif VALA_NEVER_SET_FOO || VALA_NEVER_SET_BAR
+       assert_not_reached ();
+#elif (VALA_NEVER_SET_FOO == VALA_NEVER_SET_BAR) && VALA_NEVER_SET_FOO
+       assert_not_reached ();
+#elif (VALA_NEVER_SET_FOO != VALA_NEVER_SET_BAR) && VALA_NEVER_SET_FOO
+       assert_not_reached ();
 #else
        assert (true);
 #endif
diff --git a/tests/scanner/comment-not-closed.test b/tests/scanner/comment-not-closed.test
new file mode 100644 (file)
index 0000000..c8dd28c
--- /dev/null
@@ -0,0 +1,3 @@
+Invalid Code
+
+/*
diff --git a/tests/scanner/preprocessor-invalid.test b/tests/scanner/preprocessor-invalid.test
new file mode 100644 (file)
index 0000000..108c8fa
--- /dev/null
@@ -0,0 +1,3 @@
+Invalid Code
+
+#foo 
diff --git a/tests/scanner/preprocessor-missing-paren.test b/tests/scanner/preprocessor-missing-paren.test
new file mode 100644 (file)
index 0000000..2580083
--- /dev/null
@@ -0,0 +1,6 @@
+Invalid Code
+
+#if (VALA_0_46 && VALA_0_48
+void main () {
+}
+#endif
diff --git a/tests/scanner/preprocessor-unexpected.test b/tests/scanner/preprocessor-unexpected.test
new file mode 100644 (file)
index 0000000..57990eb
--- /dev/null
@@ -0,0 +1,8 @@
+Invalid Code
+
+#elif VALA_0_48
+void main () {
+#endif
+}
+#else
+}
diff --git a/tests/scanner/regex-escape-invalid.test b/tests/scanner/regex-escape-invalid.test
new file mode 100644 (file)
index 0000000..9d3350d
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /\y/s;
+}
diff --git a/tests/scanner/regex-escape-u-digit-length.test b/tests/scanner/regex-escape-u-digit-length.test
new file mode 100644 (file)
index 0000000..6688acb
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /\u032/s;
+}
diff --git a/tests/scanner/regex-escape-x-digit-length.test b/tests/scanner/regex-escape-x-digit-length.test
new file mode 100644 (file)
index 0000000..4c88c55
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /\x/s;
+}
diff --git a/tests/scanner/regex-escape-x.vala b/tests/scanner/regex-escape-x.vala
new file mode 100644 (file)
index 0000000..b3ad7c9
--- /dev/null
@@ -0,0 +1,3 @@
+void main () {
+       Regex foo = /\x1010/s;
+}
diff --git a/tests/scanner/regex-multiple-i.test b/tests/scanner/regex-multiple-i.test
new file mode 100644 (file)
index 0000000..2b5f0bf
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /foo(.*)/ii;
+}
diff --git a/tests/scanner/regex-multiple-m.test b/tests/scanner/regex-multiple-m.test
new file mode 100644 (file)
index 0000000..313c92c
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /foo(.*)/mm;
+}
diff --git a/tests/scanner/regex-multiple-s.test b/tests/scanner/regex-multiple-s.test
new file mode 100644 (file)
index 0000000..14a5448
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /foo(.*)/ss;
+}
diff --git a/tests/scanner/regex-multiple-x.test b/tests/scanner/regex-multiple-x.test
new file mode 100644 (file)
index 0000000..c25de7b
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       Regex foo = /foo(.*)/xx;
+}
diff --git a/tests/scanner/string-escape-u-digit-length.test b/tests/scanner/string-escape-u-digit-length.test
new file mode 100644 (file)
index 0000000..471c9f4
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       string foo = "\u032";
+}
diff --git a/tests/scanner/string-escape-x-digit-length.test b/tests/scanner/string-escape-x-digit-length.test
new file mode 100644 (file)
index 0000000..f213449
--- /dev/null
@@ -0,0 +1,5 @@
+Invalid Code
+
+void main () {
+       string foo = "\x";
+}
diff --git a/tests/scanner/string-escape-x.vala b/tests/scanner/string-escape-x.vala
new file mode 100644 (file)
index 0000000..d2250b6
--- /dev/null
@@ -0,0 +1,3 @@
+void main () {
+       string foo = "\x1010";
+}