]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add a test for enum methods and constants
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 8 Apr 2010 08:28:46 +0000 (10:28 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 21 Apr 2010 12:04:17 +0000 (14:04 +0200)
tests/enums/enums.vala

index 2ee0b6368a5870204bec6636cb09fbc7efe6d92f..c9f913f0746689097ba0d33a0f1115c35bc7ac9d 100644 (file)
@@ -6,6 +6,17 @@ enum Maman.Foo {
        VAL5 = 5
 }
 
+enum Maman.Fooish {
+       VAL1,
+       VAL2;
+
+       public int something () {
+               return (int) this;
+       }
+
+       public const int FOO = 2;
+}
+
 class Maman.Bar : Object {
        public void run () {
                stdout.printf (" %d", Foo.VAL2);
@@ -21,6 +32,12 @@ class Maman.Bar : Object {
                Foo foo = 0;
        }
 
+       static void test_enum_methods_constants () {
+               Fooish x = Fooish.VAL1;
+               stdout.printf ("%d", x.something ());
+               stdout.printf ("%d", Fooish.FOO);
+       }
+
        public static int main () {
                stdout.printf ("Enum Test: 1");
                
@@ -30,6 +47,7 @@ class Maman.Bar : Object {
                stdout.printf (" 6\n");
 
                test_enums_0_conversion ();
+               test_enum_methods_constants ();
 
                return 0;
        }