[vala/0.8] tests: Add a test for enum methods and constants
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.8] tests: Add a test for enum methods and constants
- Date: Wed, 21 Apr 2010 13:13:19 +0000 (UTC)
commit d28ea2466c789891d5ef36ff311fcea4ffb1e007
Author: Sebastian Dröge <sebastian droege collabora co uk>
Date: Thu Apr 8 10:28:46 2010 +0200
tests: Add a test for enum methods and constants
tests/enums/enums.vala | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/tests/enums/enums.vala b/tests/enums/enums.vala
index 2ee0b63..c9f913f 100644
--- a/tests/enums/enums.vala
+++ b/tests/enums/enums.vala
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]