2007-11-29 Jürg Billeter <j@bitron.ch>
+ * tests/: refactor tests to have more descriptive names
+
+2007-11-29 Jürg Billeter <j@bitron.ch>
+
* configure.ac, tests/Makefile.am, tests/testenchant.vala: remove
enchant bindings test, we focus on compiler tests
TESTS = \
hello.vala \
+ expressions-relational.vala \
+ expressions-conditional.vala \
+ expressions-assignments.vala \
+ statements-selection.vala \
+ statements-jump.vala \
+ namespaces.vala \
classes.vala \
+ classes-fields.vala \
+ classes-methods.vala \
+ classes-properties.vala \
+ classes-signals.vala \
structs.vala \
- property-sample.vala \
+ interfaces.vala \
+ enums.vala \
+ delegates.vala \
+ exceptions.vala \
\
- test-001.vala \
- test-002.vala \
- test-003.vala \
- test-004.vala \
- test-005.vala \
- test-006.vala \
- test-007.vala \
- test-008.vala \
- test-009.vala \
- test-010.vala \
- test-011.vala \
- test-012.vala \
- test-013.vala \
- test-014.vala \
test-015.vala \
- test-016.vala \
- test-017.vala \
- test-018.vala \
test-019.vala \
- test-020.vala \
test-021.vala \
test-022.vala \
test-023.vala \
- test-024.vala \
test-025.vala \
test-026.vala \
test-027.vala \
- test-028.vala \
test-029.vala \
test-030.vala \
test-031.vala \
test-032.vala \
- test-033.vala \
test-034.vala \
test-035.vala \
test-036.vala \
$(TESTS) \
\
hello.exp \
+ expressions-relational.exp \
+ expressions-conditional.vala \
+ expressions-assignments.exp \
+ statements-selection.exp \
+ statements-jump.exp \
+ namespaces.exp \
classes.exp \
+ classes-fields.exp \
+ classes-methods.exp \
+ classes-properties.exp \
+ classes-signals.exp \
structs.exp \
- property-sample.exp \
+ interfaces.exp \
+ enums.exp \
+ delegates.exp \
+ exceptions.exp \
\
- test-001.exp \
- test-002.exp \
- test-003.exp \
- test-004.exp \
- test-005.exp \
- test-006.exp \
- test-007.exp \
- test-008.exp \
- test-009.exp \
- test-010.exp \
- test-011.exp \
- test-012.exp \
- test-013.exp \
- test-014.exp \
test-015.exp \
- test-016.exp \
- test-017.exp \
- test-018.exp \
test-019.exp \
- test-020.exp \
test-021.exp \
test-022.exp \
test-023.exp \
- test-024.exp \
test-025.exp \
test-026.exp \
test-027.exp \
- test-028.exp \
test-029.exp \
test-030.exp \
test-031.exp \
test-032.exp \
- test-033.exp \
test-034.exp \
test-035.exp \
test-036.exp \
--- /dev/null
+Inheritance Test: 1 2 3
+Static Inheritance Test: 1 2 3
+Virtual Method Test: 1 2 3
--- /dev/null
+using GLib;
+
+class Maman.Bar : Object {
+ public void do_action () {
+ stdout.printf (" 2");
+ }
+
+ public static void do_static_action () {
+ stdout.printf (" 2");
+ }
+
+ public virtual void do_virtual_action () {
+ stdout.printf (" BAD");
+ }
+}
+
+class Maman.SubBar : Bar {
+ public override void do_virtual_action () {
+ stdout.printf (" 2");
+ }
+
+ static int main (string[] args) {
+ stdout.printf ("Inheritance Test: 1");
+
+ var bar = new SubBar ();
+ bar.do_action ();
+
+ stdout.printf (" 3\n");
+
+ stdout.printf ("Static Inheritance Test: 1");
+
+ do_static_action ();
+
+ stdout.printf (" 3\n");
+
+ stdout.printf ("Virtual Method Test: 1");
+
+ bar.do_virtual_action ();
+
+ stdout.printf (" 3\n");
+
+ return 0;
+ }
+}
name: TheNewName
read_only: InitialReadOnly
automatic: TheNewAutomatic
+Property Test: 1 2 3 4 5 6
-/* Properties Sample Code
- * Keep in sync with <http://live.gnome.org/Vala/PropertiesSample>
- */
using GLib;
public class Sample : Object {
stdout.printf("automatic: %s\n", automatic);
}
- static int main (string[] args) {
- var test = new Sample("InitialName");
+ static int main (string[] args) {
+ var test = new Sample("InitialName");
- test.run();
+ test.run();
- return 0;
- }
+ Maman.Bar.run ();
+
+ return 0;
+ }
+}
+
+
+class Maman.Foo : Object {
+ private int _public_base_property = 2;
+ public int public_base_property {
+ get {
+ return _public_base_property;
+ }
+ set {
+ _public_base_property = value;
+ }
+ }
}
+
+class Maman.Bar : Foo {
+ private int _public_property = 3;
+ public int public_property {
+ get {
+ return _public_property;
+ }
+ set {
+ _public_property = value;
+ }
+ }
+
+ void do_action () {
+ stdout.printf (" %d %d", public_base_property, public_property);
+ public_base_property = 4;
+ public_property = 5;
+ stdout.printf (" %d %d", public_base_property, public_property);
+ }
+
+ public static void run () {
+ stdout.printf ("Property Test: 1");
+
+ var bar = new Bar ();
+ bar.do_action ();
+
+ stdout.printf (" 6\n");
+ }
+}
+
Signal Test: 1 2 3 4 5 6 7 8 9 10
+User Signal Test: 1 2 3 4 5 6
stdout.printf (" 10\n");
+ stdout.printf ("User Signal Test: 1");
+
+ var user_bar = new UserBar ();
+ user_bar.run ();
+
+ stdout.printf (" 6\n");
+
return 0;
}
}
+
+class Maman.UserFoo : Object {
+ public signal void activated (int i1, int i2);
+
+ public void do_action () {
+ activated (6, -2);
+ }
+}
+
+class Maman.UserBar : Object {
+ public void run () {
+ stdout.printf (" 2");
+
+ var foo = new UserFoo ();
+
+ foo.activated += (foo, i1, i2) => {
+ stdout.printf (" %d", i1 + i2);
+ };
+
+ stdout.printf (" 3");
+
+ foo.do_action ();
+
+ stdout.printf (" 5");
+ }
+}
+
+Namespace Test
Class in Namespace Test
--- /dev/null
+using GLib;
+
+namespace Maman {
+ static int main (string[] args) {
+ stdout.printf ("Namespace Test\n");
+
+ Bar.run ();
+
+ return 0;
+ }
+
+ class Bar : Object {
+ public static void run () {
+ stdout.printf ("Class in Namespace Test\n");
+ }
+ }
+}
+
+For Test: 1 2 3 4 5 6 7
Switch statement: 1 2 3 4 5 6 7
using GLib;
+class Maman.Bar : Object {
+ static int main (string[] args) {
+ stdout.printf ("For Test: 1");
+
+ int i;
+ for (i = 2; i < 7; i++) {
+ stdout.printf (" %d", i);
+ }
+
+ stdout.printf (" 7\n");
+
+ stdout.printf ("Switch statement: 1");
+
+ var foo = new Foo ();
+ foo.run ();
+
+ stdout.printf (" 7\n");
+
+ return 0;
+ }
+}
+
class Maman.Foo : Object {
public void run () {
stdout.printf (" 2");
public int inc () {
return counter++;
}
-
- static int main (string[] args) {
- stdout.printf ("Switch statement: 1");
-
- var foo = new Foo ();
- foo.run ();
-
- stdout.printf (" 7\n");
-
- return 0;
- }
private int counter = 0;
}
+
+++ /dev/null
-Namespace Test
+++ /dev/null
-using GLib;
-
-namespace Maman {
- static int main (string[] args) {
- stdout.printf ("Namespace Test\n");
- return 0;
- }
-}
+++ /dev/null
-using GLib;
-
-namespace Maman {
- class Bar : Object {
- static int main (string[] args) {
- stdout.printf ("Class in Namespace Test\n");
- return 0;
- }
- }
-}
-
+++ /dev/null
-Subtype Test
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
-}
-
-class Maman.SubBar : Bar {
- static int main (string[] args) {
- stdout.printf ("Subtype Test\n");
- return 0;
- }
-}
+++ /dev/null
-Inheritance Test: 1 2 3
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- public void do_action () {
- stdout.printf (" 2");
- }
-}
-
-class Maman.SubBar : Bar {
- static int main (string[] args) {
- stdout.printf ("Inheritance Test: 1");
-
- var bar = new SubBar ();
- bar.do_action ();
-
- stdout.printf (" 3\n");
-
- return 0;
- }
-}
+++ /dev/null
-Static Inheritance Test: 1 2 3
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- public static void do_action () {
- stdout.printf (" 2");
- }
-}
-
-class Maman.SubBar : Bar {
- static int main (string[] args) {
- stdout.printf ("Static Inheritance Test: 1");
-
- do_action ();
-
- stdout.printf (" 3\n");
-
- return 0;
- }
-}
+++ /dev/null
-For Test: 1 2 3 4 5 6 7
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- static int main (string[] args) {
- stdout.printf ("For Test: 1");
-
- int i;
- for (i = 2; i < 7; i++) {
- stdout.printf (" %d", i);
- }
-
- stdout.printf (" 7\n");
-
- return 0;
- }
-}
+++ /dev/null
-Virtual Method Test: 1 2 3
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- public virtual void do_action () {
- stdout.printf (" BAD");
- }
-}
-
-class Maman.SubBar : Bar {
- public override void do_action () {
- stdout.printf (" 2");
- }
-
- static int main (string[] args) {
- stdout.printf ("Virtual Method Test: 1");
-
- Bar bar = new SubBar ();
- bar.do_action ();
-
- stdout.printf (" 3\n");
-
- return 0;
- }
-}
+++ /dev/null
-Property Test: 1 2 3 4 5 6
+++ /dev/null
-using GLib;
-
-class Maman.Foo : Object {
- private int _public_base_property = 2;
- public int public_base_property {
- get {
- return _public_base_property;
- }
- set {
- _public_base_property = value;
- }
- }
-}
-
-class Maman.Bar : Foo {
- private int _public_property = 3;
- public int public_property {
- get {
- return _public_property;
- }
- set {
- _public_property = value;
- }
- }
-
- void do_action () {
- stdout.printf (" %d %d", public_base_property, public_property);
- public_base_property = 4;
- public_property = 5;
- stdout.printf (" %d %d", public_base_property, public_property);
- }
-
- static int main (string[] args) {
- stdout.printf ("Property Test: 1");
-
- var bar = new Bar ();
- bar.do_action ();
-
- stdout.printf (" 6\n");
-
- return 0;
- }
-}
+++ /dev/null
-Block Test: 1 2 3
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- static int main (string[] args) {
- stdout.printf ("Block Test: 1");
-
- {
- stdout.printf (" 2");
- }
-
- stdout.printf (" 3\n");
-
- return 0;
- }
-}
+++ /dev/null
-User Signal Test: 1 2 3 4 5 6
+++ /dev/null
-using GLib;
-
-class Maman.Foo : Object {
- public signal void activated (int i1, int i2);
-
- public void do_action () {
- activated (6, -2);
- }
-}
-
-class Maman.Bar : Object {
- public void run () {
- stdout.printf (" 2");
-
- var foo = new Foo ();
-
- foo.activated += (foo, i1, i2) => {
- stdout.printf (" %d", i1 + i2);
- };
-
- stdout.printf (" 3");
-
- foo.do_action ();
-
- stdout.printf (" 5");
- }
-
- static int main (string[] args) {
- stdout.printf ("User Signal Test: 1");
-
- var bar = new Bar ();
- bar.run ();
-
- stdout.printf (" 6\n");
-
- return 0;
- }
-}