]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Additional test-cases taken from transform-branch
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 25 Sep 2016 19:29:30 +0000 (21:29 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 25 Sep 2016 19:29:30 +0000 (21:29 +0200)
tests/Makefile.am
tests/asynchronous/yield.vala [new file with mode: 0644]
tests/control-flow/bug628336.vala [new file with mode: 0644]
tests/dbus/dicts.test
tests/methods/symbolresolution.vala
tests/objects/properties.vala
tests/structs/structs.vala

index e5c23018ed5ef6668e62599941882c937697bdbf..d4f0fc3c72d6acc5024b93116b5cfa4611979749 100644 (file)
@@ -80,6 +80,7 @@ TESTS = \
        control-flow/nested-conditional.vala \
        control-flow/switch.vala \
        control-flow/sideeffects.vala \
+       control-flow/bug628336.vala \
        control-flow/bug639482.vala \
        control-flow/bug652549.vala \
        control-flow/bug661985.vala \
@@ -203,6 +204,7 @@ TESTS = \
        asynchronous/bug661961.vala \
        asynchronous/bug742621.vala \
        asynchronous/closures.vala \
+       asynchronous/yield.vala \
        dbus/basic-types.test \
        dbus/arrays.test \
        dbus/structs.test \
diff --git a/tests/asynchronous/yield.vala b/tests/asynchronous/yield.vala
new file mode 100644 (file)
index 0000000..4c4d53b
--- /dev/null
@@ -0,0 +1,10 @@
+async void foo ()
+{
+    while (true) {
+        yield;
+    }
+}
+
+void main () {
+}
+
diff --git a/tests/control-flow/bug628336.vala b/tests/control-flow/bug628336.vala
new file mode 100644 (file)
index 0000000..86ac154
--- /dev/null
@@ -0,0 +1,8 @@
+void main () {
+       var foo = new string[]{"bar", "bar"};
+       foreach (string bar in foo) {
+               assert (bar == "bar");
+               SourceFunc f = () => bar == "bar";
+               assert (f ());
+       }
+}
index c67c515ffd56c1159638e895f4bbb62d7daeb14a..1e7037ed7ef0eb29184500fc7ebe0fd1873cbea5 100644 (file)
@@ -32,6 +32,19 @@ class Test : Object {
        }
 }
 
+namespace TestInterface {
+       [DBus (name = "org.vala.Test.Bar")]
+       public interface Bar : GLib.Object {
+               public abstract HashTable<string, Variant> foo () throws IOError;
+       }
+
+       public class Foo : GLib.DBusProxy, Bar {
+               public HashTable<string, Variant> foo () throws IOError {
+                       return new HashTable<string, Variant> (str_hash, str_equal);
+               }
+       }
+}
+
 MainLoop main_loop;
 
 void client_exit (Pid pid, int status) {
index 90fe97c301e5235cca58b6f46be84799c795b4ac..ba3beec2ee4563cb8d05b7fe9e8697e2371d4a51 100644 (file)
@@ -9,6 +9,14 @@ public class Class {
                Foo func = () => { foo (); };
                func ();
        }
+
+
+       void active_scope () {
+               foreach (var bar in new string[] {}) {
+               }
+
+               var bar = "bar";
+       }
 }
 
 void main () {
index b0518256e11a49be55bd065897ca68fd65a1b5bf..2e2b2ee059cd5b1983c6927c1346ff913ff9db63 100644 (file)
@@ -92,6 +92,14 @@ abstract class Maman.Foo : Object {
        public abstract int abstract_base_property { get; set; }
 }
 
+enum FooEnum {
+       FOO
+}
+
+abstract class Maman.EnumDefault {
+       public abstract FooEnum bar { get; default = FooEnum.FOO; }
+}
+
 class Maman.Bar : Foo {
        public int public_property { get; set; default = 3; }
        public override int abstract_base_property { get; set; }
index e991121cd7392e7c29c04f9e37d0717a52e28096..ae4e6f7341791ed1eebc03f1262c98f2f80dea92 100644 (file)
@@ -25,6 +25,16 @@ struct StructWithNamedCreationMethod {
        public int field;
 }
 
+
+delegate void Func ();
+
+struct StructWithFunc {
+       int foo;
+
+       public StructWithFunc (Func f) {
+       }
+}
+
 void test_in_parameter (SimpleStruct st) {
        stdout.printf ("test_in_parameter: st.field = %d\n", st.field);
 }
@@ -44,6 +54,12 @@ void test_out_parameter (out SimpleStruct st) {
        st.field = 3;
 }
 
+void test_struct_with_func () {
+       var foes = new StructWithFunc[] {
+               StructWithFunc (() => {})
+       };
+}
+
 void main () {
        stdout.printf ("Structs Test:\n");