[vala/staging] tests: Add "scanner" tests to increase coverage
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] tests: Add "scanner" tests to increase coverage
- Date: Sun, 24 Nov 2019 17:24:07 +0000 (UTC)
commit ba76c57a44a718de82b2aac9274916ee3a95907d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Nov 24 18:23:58 2019 +0100
tests: Add "scanner" tests to increase coverage
tests/Makefile.am | 15 +++++++++++++++
tests/parser/preprocessor.vala | 8 ++++++++
tests/scanner/comment-not-closed.test | 3 +++
tests/scanner/preprocessor-invalid.test | 3 +++
tests/scanner/preprocessor-missing-paren.test | 6 ++++++
tests/scanner/preprocessor-unexpected.test | 8 ++++++++
tests/scanner/regex-escape-invalid.test | 5 +++++
tests/scanner/regex-escape-u-digit-length.test | 5 +++++
tests/scanner/regex-escape-x-digit-length.test | 5 +++++
tests/scanner/regex-escape-x.vala | 3 +++
tests/scanner/regex-multiple-i.test | 5 +++++
tests/scanner/regex-multiple-m.test | 5 +++++
tests/scanner/regex-multiple-s.test | 5 +++++
tests/scanner/regex-multiple-x.test | 5 +++++
tests/scanner/string-escape-u-digit-length.test | 5 +++++
tests/scanner/string-escape-x-digit-length.test | 5 +++++
tests/scanner/string-escape-x.vala | 3 +++
17 files changed, 94 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 37612b87f..bb873f603 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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 \
diff --git a/tests/parser/preprocessor.vala b/tests/parser/preprocessor.vala
index de71b2a1c..0a15751d0 100644
--- a/tests/parser/preprocessor.vala
+++ b/tests/parser/preprocessor.vala
@@ -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
index 000000000..c8dd28cd8
--- /dev/null
+++ b/tests/scanner/comment-not-closed.test
@@ -0,0 +1,3 @@
+Invalid Code
+
+/*
diff --git a/tests/scanner/preprocessor-invalid.test b/tests/scanner/preprocessor-invalid.test
new file mode 100644
index 000000000..108c8faa1
--- /dev/null
+++ b/tests/scanner/preprocessor-invalid.test
@@ -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
index 000000000..258008398
--- /dev/null
+++ b/tests/scanner/preprocessor-missing-paren.test
@@ -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
index 000000000..57990eb63
--- /dev/null
+++ b/tests/scanner/preprocessor-unexpected.test
@@ -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
index 000000000..9d3350dad
--- /dev/null
+++ b/tests/scanner/regex-escape-invalid.test
@@ -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
index 000000000..6688acb00
--- /dev/null
+++ b/tests/scanner/regex-escape-u-digit-length.test
@@ -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
index 000000000..4c88c55ca
--- /dev/null
+++ b/tests/scanner/regex-escape-x-digit-length.test
@@ -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
index 000000000..b3ad7c991
--- /dev/null
+++ b/tests/scanner/regex-escape-x.vala
@@ -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
index 000000000..2b5f0bf0d
--- /dev/null
+++ b/tests/scanner/regex-multiple-i.test
@@ -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
index 000000000..313c92c3e
--- /dev/null
+++ b/tests/scanner/regex-multiple-m.test
@@ -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
index 000000000..14a544834
--- /dev/null
+++ b/tests/scanner/regex-multiple-s.test
@@ -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
index 000000000..c25de7b4a
--- /dev/null
+++ b/tests/scanner/regex-multiple-x.test
@@ -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
index 000000000..471c9f4ec
--- /dev/null
+++ b/tests/scanner/string-escape-u-digit-length.test
@@ -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
index 000000000..f2134491b
--- /dev/null
+++ b/tests/scanner/string-escape-x-digit-length.test
@@ -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
index 000000000..d2250b6eb
--- /dev/null
+++ b/tests/scanner/string-escape-x.vala
@@ -0,0 +1,3 @@
+void main () {
+ string foo = "\x1010";
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]