]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add more "statement" tests for genie to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sat, 6 Nov 2021 14:35:12 +0000 (15:35 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 6 Nov 2021 14:35:12 +0000 (15:35 +0100)
23 files changed:
tests/Makefile.am
tests/genie/case.c-expected [new file with mode: 0644]
tests/genie/case.gs [new file with mode: 0644]
tests/genie/do-while.c-expected [new file with mode: 0644]
tests/genie/do-while.gs [new file with mode: 0644]
tests/genie/for-downto.c-expected [new file with mode: 0644]
tests/genie/for-downto.gs [new file with mode: 0644]
tests/genie/for-in.c-expected [new file with mode: 0644]
tests/genie/for-in.gs [new file with mode: 0644]
tests/genie/for-to.c-expected [new file with mode: 0644]
tests/genie/for-to.gs [new file with mode: 0644]
tests/genie/initializer-list.c-expected [new file with mode: 0644]
tests/genie/initializer-list.gs [new file with mode: 0644]
tests/genie/print.c-expected [new file with mode: 0644]
tests/genie/print.gs [new file with mode: 0644]
tests/genie/sizeof.c-expected [new file with mode: 0644]
tests/genie/sizeof.gs [new file with mode: 0644]
tests/genie/try-except-finally.c-expected [new file with mode: 0644]
tests/genie/try-except-finally.gs [new file with mode: 0644]
tests/genie/typeof.c-expected [new file with mode: 0644]
tests/genie/typeof.gs [new file with mode: 0644]
tests/genie/while.c-expected [new file with mode: 0644]
tests/genie/while.gs [new file with mode: 0644]

index 6ba60552957220ad0d25a2b0f398122067d73464..3f4971e7a224c2c75b6b001459c35f71d67ae8cf 100644 (file)
@@ -1233,6 +1233,7 @@ TESTS = \
        version/since-local-variable.test \
        version/since-method.test \
        version/since-parameter.test \
+       genie/case.gs \
        genie/class.gs \
        genie/class-field.gs \
        genie/class-init.gs \
@@ -1246,9 +1247,13 @@ TESTS = \
        genie/control-flow-if.gs \
        genie/control-flow-if-identity.gs \
        genie/control-flow-if-less-than.gs \
+       genie/do-while.gs \
        genie/enum.gs \
        genie/enum-with-keyword-values.gs \
        genie/exception.gs \
+       genie/for-downto.gs \
+       genie/for-in.gs \
+       genie/for-to.gs \
        genie/function.gs \
        genie/function-returns-closure.gs \
        genie/function-with-argument.gs \
@@ -1256,6 +1261,7 @@ TESTS = \
        genie/indentation-with-spaces.gs \
        genie/init.gs \
        genie/init-int.gs \
+       genie/initializer-list.gs \
        genie/interface.gs \
        genie/literal-boolean-assignment.gs \
        genie/literal-boolean.gs \
@@ -1302,8 +1308,13 @@ TESTS = \
        genie/preparser.gs \
        genie/preparser-not.gs \
        genie/preparser-or-expression.gs \
+       genie/print.gs \
+       genie/sizeof.gs \
        genie/struct.gs \
        genie/struct-after-class.gs \
+       genie/try-except-finally.gs \
+       genie/typeof.gs \
+       genie/while.gs \
        glib/conditional-glib-api.vala \
        $(LINUX_TESTS) \
        $(NULL)
diff --git a/tests/genie/case.c-expected b/tests/genie/case.c-expected
new file mode 100644 (file)
index 0000000..5bca8f5
--- /dev/null
@@ -0,0 +1,41 @@
+/* genie_case.c generated by valac, the Vala compiler
+ * generated from genie_case.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       a = 13;
+       switch (a) {
+               case 13:
+               {
+                       break;
+               }
+               case 23:
+               case 42:
+               {
+                       break;
+               }
+               default:
+               {
+                       break;
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/case.gs b/tests/genie/case.gs
new file mode 100644 (file)
index 0000000..4055876
--- /dev/null
@@ -0,0 +1,6 @@
+init
+       a:int = 13
+       case a
+               when 13
+               when 23, 42
+               default
diff --git a/tests/genie/do-while.c-expected b/tests/genie/do-while.c-expected
new file mode 100644 (file)
index 0000000..d5f3c5f
--- /dev/null
@@ -0,0 +1,40 @@
+/* genie_do_while.c generated by valac, the Vala compiler
+ * generated from genie_do_while.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       while (TRUE) {
+               break;
+       }
+       {
+               gboolean _tmp0_ = FALSE;
+               _tmp0_ = TRUE;
+               while (TRUE) {
+                       if (!_tmp0_) {
+                               if (!FALSE) {
+                                       break;
+                               }
+                       }
+                       _tmp0_ = FALSE;
+                       continue;
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/do-while.gs b/tests/genie/do-while.gs
new file mode 100644 (file)
index 0000000..6ffb227
--- /dev/null
@@ -0,0 +1,8 @@
+init
+       do
+               break
+       while true
+
+       do
+               continue
+       while false
diff --git a/tests/genie/for-downto.c-expected b/tests/genie/for-downto.c-expected
new file mode 100644 (file)
index 0000000..e286dba
--- /dev/null
@@ -0,0 +1,49 @@
+/* genie_for_downto.c generated by valac, the Vala compiler
+ * generated from genie_for_downto.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       {
+               gint i = 0;
+               i = 42;
+               {
+                       gboolean _tmp0_ = FALSE;
+                       _tmp0_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp0_) {
+                                       gint _tmp1_;
+                                       _tmp1_ = i;
+                                       i = _tmp1_ - 1;
+                               }
+                               _tmp0_ = FALSE;
+                               if (!(i >= 23)) {
+                                       break;
+                               }
+                               _vala_assert (i >= 23, "i >= 23");
+                       }
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/for-downto.gs b/tests/genie/for-downto.gs
new file mode 100644 (file)
index 0000000..1a71637
--- /dev/null
@@ -0,0 +1,3 @@
+init
+       for i:int = 42 downto 23
+               assert( i >= 23)
diff --git a/tests/genie/for-in.c-expected b/tests/genie/for-in.c-expected
new file mode 100644 (file)
index 0000000..461ae18
--- /dev/null
@@ -0,0 +1,93 @@
+/* genie_for_in.c generated by valac, the Vala compiler
+ * generated from genie_for_in.gs, do not modify */
+
+#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);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* a[3] = {0};
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_[3] = {0};
+       _tmp0_ = g_strdup ("a");
+       _tmp1_ = g_strdup ("b");
+       _tmp2_ = g_strdup ("c");
+       _tmp3_[0] = _tmp0_;
+       _tmp3_[1] = _tmp1_;
+       _tmp3_[2] = _tmp2_;
+       memcpy (a, _tmp3_, 3 * sizeof (gchar*));
+       {
+               gchar** s_collection = NULL;
+               gint s_collection_length1 = 0;
+               gint _s_collection_size_ = 0;
+               gint s_it = 0;
+               s_collection = a;
+               s_collection_length1 = 3;
+               for (s_it = 0; s_it < s_collection_length1; s_it = s_it + 1) {
+                       gchar* _tmp4_;
+                       gchar* s = NULL;
+                       _tmp4_ = g_strdup (s_collection[s_it]);
+                       s = _tmp4_;
+                       {
+                               const gchar* _tmp5_;
+                               _tmp5_ = s;
+                               _vala_assert (g_strcmp0 (_tmp5_, "d") != 0, "s != \"d\"");
+                               _g_free0 (s);
+                       }
+               }
+       }
+       _vala_array_destroy (a, 3, (GDestroyNotify) g_free);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/genie/for-in.gs b/tests/genie/for-in.gs
new file mode 100644 (file)
index 0000000..890e1b1
--- /dev/null
@@ -0,0 +1,4 @@
+init
+       a:string[] = { "a", "b", "c" }
+       for s:string in a
+               assert( s != "d" )
diff --git a/tests/genie/for-to.c-expected b/tests/genie/for-to.c-expected
new file mode 100644 (file)
index 0000000..5b3cf80
--- /dev/null
@@ -0,0 +1,49 @@
+/* genie_for_to.c generated by valac, the Vala compiler
+ * generated from genie_for_to.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       {
+               gint i = 0;
+               i = 0;
+               {
+                       gboolean _tmp0_ = FALSE;
+                       _tmp0_ = TRUE;
+                       while (TRUE) {
+                               if (!_tmp0_) {
+                                       gint _tmp1_;
+                                       _tmp1_ = i;
+                                       i = _tmp1_ + 1;
+                               }
+                               _tmp0_ = FALSE;
+                               if (!(i <= 23)) {
+                                       break;
+                               }
+                               _vala_assert (i < 42, "i < 42");
+                       }
+               }
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/for-to.gs b/tests/genie/for-to.gs
new file mode 100644 (file)
index 0000000..771bc30
--- /dev/null
@@ -0,0 +1,3 @@
+init
+       for i:int = 0 to 23
+               assert( i < 42)
diff --git a/tests/genie/initializer-list.c-expected b/tests/genie/initializer-list.c-expected
new file mode 100644 (file)
index 0000000..9bc4e7b
--- /dev/null
@@ -0,0 +1,82 @@
+/* genie_initializer_list.c generated by valac, the Vala compiler
+ * generated from genie_initializer_list.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+static void _vala_array_destroy (gpointer array,
+                          gssize array_length,
+                          GDestroyNotify destroy_func);
+static void _vala_array_free (gpointer array,
+                       gssize array_length,
+                       GDestroyNotify destroy_func);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gchar* s[3] = {0};
+       gchar* _tmp0_;
+       gchar* _tmp1_;
+       gchar* _tmp2_;
+       gchar* _tmp3_[3] = {0};
+       const gchar* _tmp4_;
+       const gchar* _tmp5_;
+       const gchar* _tmp6_;
+       _tmp0_ = g_strdup ("a");
+       _tmp1_ = g_strdup ("b");
+       _tmp2_ = g_strdup ("c");
+       _tmp3_[0] = _tmp0_;
+       _tmp3_[1] = _tmp1_;
+       _tmp3_[2] = _tmp2_;
+       memcpy (s, _tmp3_, 3 * sizeof (gchar*));
+       _vala_assert (3 == 3, "s.length == 3");
+       _tmp4_ = s[0];
+       _vala_assert (g_strcmp0 (_tmp4_, "a") == 0, "s[0] == \"a\"");
+       _tmp5_ = s[1];
+       _vala_assert (g_strcmp0 (_tmp5_, "b") == 0, "s[1] == \"b\"");
+       _tmp6_ = s[2];
+       _vala_assert (g_strcmp0 (_tmp6_, "c") == 0, "s[2] == \"c\"");
+       _vala_array_destroy (s, 3, (GDestroyNotify) g_free);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
+static void
+_vala_array_destroy (gpointer array,
+                     gssize array_length,
+                     GDestroyNotify destroy_func)
+{
+       if ((array != NULL) && (destroy_func != NULL)) {
+               gssize i;
+               for (i = 0; i < array_length; i = i + 1) {
+                       if (((gpointer*) array)[i] != NULL) {
+                               destroy_func (((gpointer*) array)[i]);
+                       }
+               }
+       }
+}
+
+static void
+_vala_array_free (gpointer array,
+                  gssize array_length,
+                  GDestroyNotify destroy_func)
+{
+       _vala_array_destroy (array, array_length, destroy_func);
+       g_free (array);
+}
+
diff --git a/tests/genie/initializer-list.gs b/tests/genie/initializer-list.gs
new file mode 100644 (file)
index 0000000..baa0245
--- /dev/null
@@ -0,0 +1,7 @@
+init
+       s:string[] = { "a", "b", "c" }
+
+       assert( s.length == 3 )
+       assert( s[0] == "a" )
+       assert( s[1] == "b" )
+       assert( s[2] == "c" )
diff --git a/tests/genie/print.c-expected b/tests/genie/print.c-expected
new file mode 100644 (file)
index 0000000..d74c80c
--- /dev/null
@@ -0,0 +1,25 @@
+/* genie_print.c generated by valac, the Vala compiler
+ * generated from genie_print.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       g_print ("%s = %i + %.4f\n", "a", 42, 3.1415);
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/print.gs b/tests/genie/print.gs
new file mode 100644 (file)
index 0000000..8c82e3e
--- /dev/null
@@ -0,0 +1,2 @@
+init
+       print( "%s = %i + %.4f", "a", 42, 3.1415 )
diff --git a/tests/genie/sizeof.c-expected b/tests/genie/sizeof.c-expected
new file mode 100644 (file)
index 0000000..18c1dea
--- /dev/null
@@ -0,0 +1,32 @@
+/* genie_sizeof.c generated by valac, the Vala compiler
+ * generated from genie_sizeof.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gulong a = 0UL;
+       a = sizeof (guint32);
+       _vala_assert (a == ((gulong) 4), "a == 4");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/sizeof.gs b/tests/genie/sizeof.gs
new file mode 100644 (file)
index 0000000..db7d659
--- /dev/null
@@ -0,0 +1,3 @@
+init
+       a:ulong = sizeof( uint32 )
+       assert( a == 4 )
diff --git a/tests/genie/try-except-finally.c-expected b/tests/genie/try-except-finally.c-expected
new file mode 100644 (file)
index 0000000..4c94548
--- /dev/null
@@ -0,0 +1,85 @@
+/* genie_try_except_finally.c generated by valac, the Vala compiler
+ * generated from genie_try_except_finally.gs, do not modify */
+
+#include <gio/gio.h>
+#include <glib.h>
+#include <stdlib.h>
+#include <string.h>
+
+#if !defined(VALA_EXTERN)
+#if defined(_MSC_VER)
+#define VALA_EXTERN __declspec(dllexport) extern
+#elif __GNUC__ >= 4
+#define VALA_EXTERN __attribute__((visibility("default"))) extern
+#else
+#define VALA_EXTERN extern
+#endif
+#endif
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+VALA_EXTERN void test (GError** error);
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+void
+test (GError** error)
+{
+       GError* _tmp0_;
+       GError* _inner_error0_ = NULL;
+       _tmp0_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, "failed");
+       _inner_error0_ = _tmp0_;
+       g_propagate_error (error, _inner_error0_);
+       return;
+}
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       gint a = 0;
+       GError* _inner_error0_ = NULL;
+       a = 0;
+       {
+               gint _tmp0_;
+               _tmp0_ = a;
+               a = _tmp0_ + 1;
+               test (&_inner_error0_);
+               if (G_UNLIKELY (_inner_error0_ != NULL)) {
+                       goto __catch0_g_error;
+               }
+       }
+       goto __finally0;
+       __catch0_g_error:
+       {
+               gint _tmp1_;
+               g_clear_error (&_inner_error0_);
+               _tmp1_ = a;
+               a = _tmp1_ + 1;
+       }
+       __finally0:
+       {
+               GError* _inner_error1_ = NULL;
+               gint _tmp2_;
+               _tmp2_ = a;
+               a = _tmp2_ + 1;
+       }
+       if (G_UNLIKELY (_inner_error0_ != NULL)) {
+               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
+               g_clear_error (&_inner_error0_);
+               return;
+       }
+       _vala_assert (a == 3, "a == 3");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/try-except-finally.gs b/tests/genie/try-except-finally.gs
new file mode 100644 (file)
index 0000000..038995c
--- /dev/null
@@ -0,0 +1,13 @@
+def test() raises IOError, Error
+       raise new IOError.FAILED( "failed" )
+
+init
+       a:int = 0
+       try
+               a++
+               test()
+       except e:Error
+               a++
+       finally
+               a++
+       assert( a == 3 )
diff --git a/tests/genie/typeof.c-expected b/tests/genie/typeof.c-expected
new file mode 100644 (file)
index 0000000..0428b63
--- /dev/null
@@ -0,0 +1,33 @@
+/* genie_typeof.c generated by valac, the Vala compiler
+ * generated from genie_typeof.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+#include <glib-object.h>
+
+#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
+#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
+#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       GType a = 0UL;
+       a = G_TYPE_INT;
+       _vala_assert (a == G_TYPE_INT, "a == Type.INT");
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/typeof.gs b/tests/genie/typeof.gs
new file mode 100644 (file)
index 0000000..0069d1b
--- /dev/null
@@ -0,0 +1,3 @@
+init
+       a:Type = typeof( int )
+       assert( a == Type.INT )
diff --git a/tests/genie/while.c-expected b/tests/genie/while.c-expected
new file mode 100644 (file)
index 0000000..42a2f17
--- /dev/null
@@ -0,0 +1,30 @@
+/* genie_while.c generated by valac, the Vala compiler
+ * generated from genie_while.gs, do not modify */
+
+#include <stdlib.h>
+#include <string.h>
+#include <glib.h>
+
+static void _vala_main (gchar** args,
+                 gint args_length1);
+
+static void
+_vala_main (gchar** args,
+            gint args_length1)
+{
+       while (TRUE) {
+               break;
+       }
+       while (TRUE) {
+               break;
+       }
+}
+
+int
+main (int argc,
+      char ** argv)
+{
+       _vala_main (argv, argc);
+       return 0;
+}
+
diff --git a/tests/genie/while.gs b/tests/genie/while.gs
new file mode 100644 (file)
index 0000000..aed8469
--- /dev/null
@@ -0,0 +1,6 @@
+init
+       while true do
+               break
+
+       while false
+               assert_not_reached()