summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2022-10-02 13:17:04 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2022-10-02 13:22:24 +0200
commit1560e367afc7d95ded40f1c67e559ac60c4c49cc (patch)
tree4ef8cf83cd148ce5c046ae404f1ee23d407d08d7 /tests
parent9c8a449155c7bd36670ced5fbc98834592a3a65f (diff)
downloadvala-1560e367afc7d95ded40f1c67e559ac60c4c49cc.tar.gz
codegen: Add glib.h include for TRUE/FALSE literal
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1364
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/basic-types/boolean-literal.c-expected23
-rw-r--r--tests/basic-types/boolean-literal.vala5
-rw-r--r--tests/parser/with-embedded.c-expected2
4 files changed, 30 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dd6f39684..6a2acf56c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -49,6 +49,7 @@ TESTS = \
basic-types/floats.vala \
basic-types/floats-boxed-cast.vala \
basic-types/boolean.vala \
+ basic-types/boolean-literal.vala \
basic-types/custom-types.vala \
basic-types/default-gtype.vala \
basic-types/strings.vala \
diff --git a/tests/basic-types/boolean-literal.c-expected b/tests/basic-types/boolean-literal.c-expected
new file mode 100644
index 000000000..89441a6c1
--- /dev/null
+++ b/tests/basic-types/boolean-literal.c-expected
@@ -0,0 +1,23 @@
+/* basic_types_boolean_literal.c generated by valac, the Vala compiler
+ * generated from basic_types_boolean_literal.vala, do not modify */
+
+#include <glib.h>
+
+static void _vala_main (void);
+
+static void
+_vala_main (void)
+{
+ if (TRUE) {
+ return;
+ }
+}
+
+int
+main (int argc,
+ char ** argv)
+{
+ _vala_main ();
+ return 0;
+}
+
diff --git a/tests/basic-types/boolean-literal.vala b/tests/basic-types/boolean-literal.vala
new file mode 100644
index 000000000..be7d379e7
--- /dev/null
+++ b/tests/basic-types/boolean-literal.vala
@@ -0,0 +1,5 @@
+void main () {
+ if (true) {
+ return;
+ }
+}
diff --git a/tests/parser/with-embedded.c-expected b/tests/parser/with-embedded.c-expected
index d825c379f..29935c99e 100644
--- a/tests/parser/with-embedded.c-expected
+++ b/tests/parser/with-embedded.c-expected
@@ -1,9 +1,9 @@
/* parser_with_embedded.c generated by valac, the Vala compiler
* generated from parser_with_embedded.vala, do not modify */
+#include <glib.h>
#include <stdlib.h>
#include <string.h>
-#include <glib.h>
#define _g_free0(var) (var = (g_free (var), NULL))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);