]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Fix test delegates/bug659778.vala
authorAlistair Thomas <astavale@yahoo.co.uk>
Tue, 22 Aug 2017 19:50:58 +0000 (20:50 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 27 Aug 2017 08:31:46 +0000 (10:31 +0200)
GObject type names must be atleast three characters long
(https://developer.gnome.org/gobject/stable/gtype-conventions.html).
The test for delegates/bug659778.vala uses an enum name of TE, which is
too short and when compiled produces the runtime errors:

GLib-GObject-WARNING **: type name 'TE' is too short
GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

and the test program does not terminate.

This has been hidden by the current test framework, testrunner.sh,
because that script adds a namespace around each test.

https://bugzilla.gnome.org/show_bug.cgi?id=786652

tests/delegates/bug659778.vala

index e73e3c1e498ee27fea5439f925b28b3e8e91ea59..79fa86eff43dfcd694c28942c9d9a0cf3d21c3d9 100644 (file)
@@ -2,10 +2,10 @@ delegate G DoSomething<G>(G g);
 
 void do_something<G> (DoSomething<G> f) {}
 
-enum TE {
+enum TestEnum {
        T;
        public void f() {
-               do_something<TE> ((x) => {
+               do_something<TestEnum> ((x) => {
                        switch (this) {
                        case T:
                                return T;
@@ -15,7 +15,7 @@ enum TE {
         });
        }
        public void g(int i) {
-               do_something<TE> ((x) => {
+               do_something<TestEnum> ((x) => {
                        switch (this) {
                        case T:
                                i++;
@@ -29,11 +29,11 @@ enum TE {
 
 class Test {
        public void f() {
-               do_something<TE> (g);
+               do_something<TestEnum> (g);
                do_something<int> (h);
        }
        [CCode (instance_pos = -1)]
-       private TE g(TE i) {
+       private TestEnum g(TestEnum i) {
                return i;
        }
        [CCode (instance_pos = -1)]
@@ -43,7 +43,7 @@ class Test {
 }
 
 int main() {
-       TE t = TE.T;
+       TestEnum t = TestEnum.T;
        t.f ();
        t.g (0);
        Test t2 = new Test ();