From: Juerg Billeter Date: Thu, 29 Nov 2007 15:14:16 +0000 (+0000) Subject: refactor tests to have more descriptive names X-Git-Tag: VALA_0_1_6~129 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31b516e0a1946c13c59ee107cbce8c9f64e6a8de;p=platform%2Fupstream%2Fvala.git refactor tests to have more descriptive names 2007-11-29 Juerg Billeter * tests/: refactor tests to have more descriptive names svn path=/trunk/; revision=738 --- diff --git a/ChangeLog b/ChangeLog index ae886d8..9f9748b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-11-29 Jürg Billeter + * tests/: refactor tests to have more descriptive names + +2007-11-29 Jürg Billeter + * configure.ac, tests/Makefile.am, tests/testenchant.vala: remove enchant bindings test, we focus on compiler tests diff --git a/tests/Makefile.am b/tests/Makefile.am index a586fc1..0f5ddaf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,43 +16,35 @@ TESTS_ENVIRONMENT = $(srcdir)/testrunner.sh 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 \ @@ -64,43 +56,35 @@ EXTRA_DIST = \ $(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 \ diff --git a/tests/test-008.exp b/tests/classes-fields.exp similarity index 100% rename from tests/test-008.exp rename to tests/classes-fields.exp diff --git a/tests/test-008.vala b/tests/classes-fields.vala similarity index 100% rename from tests/test-008.vala rename to tests/classes-fields.vala diff --git a/tests/classes-methods.exp b/tests/classes-methods.exp new file mode 100644 index 0000000..8619eb6 --- /dev/null +++ b/tests/classes-methods.exp @@ -0,0 +1,3 @@ +Inheritance Test: 1 2 3 +Static Inheritance Test: 1 2 3 +Virtual Method Test: 1 2 3 diff --git a/tests/classes-methods.vala b/tests/classes-methods.vala new file mode 100644 index 0000000..b4c123f --- /dev/null +++ b/tests/classes-methods.vala @@ -0,0 +1,44 @@ +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; + } +} diff --git a/tests/property-sample.exp b/tests/classes-properties.exp similarity index 82% rename from tests/property-sample.exp rename to tests/classes-properties.exp index 5478c66..0f43340 100644 --- a/tests/property-sample.exp +++ b/tests/classes-properties.exp @@ -3,3 +3,4 @@ automatic: TheNewAutomatic name: TheNewName read_only: InitialReadOnly automatic: TheNewAutomatic +Property Test: 1 2 3 4 5 6 diff --git a/tests/property-sample.vala b/tests/classes-properties.vala similarity index 54% rename from tests/property-sample.vala rename to tests/classes-properties.vala index 5579995..4dff4ff 100644 --- a/tests/property-sample.vala +++ b/tests/classes-properties.vala @@ -1,6 +1,3 @@ -/* Properties Sample Code - * Keep in sync with - */ using GLib; public class Sample : Object { @@ -54,11 +51,55 @@ 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"); + } +} + diff --git a/tests/test-018.exp b/tests/classes-signals.exp similarity index 53% rename from tests/test-018.exp rename to tests/classes-signals.exp index 37c2032..c42d7ec 100644 --- a/tests/test-018.exp +++ b/tests/classes-signals.exp @@ -1 +1,2 @@ Signal Test: 1 2 3 4 5 6 7 8 9 10 +User Signal Test: 1 2 3 4 5 6 diff --git a/tests/test-018.vala b/tests/classes-signals.vala similarity index 61% rename from tests/test-018.vala rename to tests/classes-signals.vala index 1bd38dc..555339f 100644 --- a/tests/test-018.vala +++ b/tests/classes-signals.vala @@ -55,6 +55,40 @@ class Maman.Bar : Object { 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"); + } +} + diff --git a/tests/test-014.exp b/tests/delegates.exp similarity index 100% rename from tests/test-014.exp rename to tests/delegates.exp diff --git a/tests/test-014.vala b/tests/delegates.vala similarity index 100% rename from tests/test-014.vala rename to tests/delegates.vala diff --git a/tests/test-028.exp b/tests/enums.exp similarity index 100% rename from tests/test-028.exp rename to tests/enums.exp diff --git a/tests/test-028.vala b/tests/enums.vala similarity index 100% rename from tests/test-028.vala rename to tests/enums.vala diff --git a/tests/test-033.exp b/tests/exceptions.exp similarity index 100% rename from tests/test-033.exp rename to tests/exceptions.exp diff --git a/tests/test-033.vala b/tests/exceptions.vala similarity index 100% rename from tests/test-033.vala rename to tests/exceptions.vala diff --git a/tests/test-010.exp b/tests/expressions-assignments.exp similarity index 100% rename from tests/test-010.exp rename to tests/expressions-assignments.exp diff --git a/tests/test-010.vala b/tests/expressions-assignments.vala similarity index 100% rename from tests/test-010.vala rename to tests/expressions-assignments.vala diff --git a/tests/test-016.exp b/tests/expressions-conditional.exp similarity index 100% rename from tests/test-016.exp rename to tests/expressions-conditional.exp diff --git a/tests/test-016.vala b/tests/expressions-conditional.vala similarity index 100% rename from tests/test-016.vala rename to tests/expressions-conditional.vala diff --git a/tests/test-011.exp b/tests/expressions-relational.exp similarity index 100% rename from tests/test-011.exp rename to tests/expressions-relational.exp diff --git a/tests/test-011.vala b/tests/expressions-relational.vala similarity index 100% rename from tests/test-011.vala rename to tests/expressions-relational.vala diff --git a/tests/test-017.exp b/tests/interfaces.exp similarity index 100% rename from tests/test-017.exp rename to tests/interfaces.exp diff --git a/tests/test-017.vala b/tests/interfaces.vala similarity index 100% rename from tests/test-017.vala rename to tests/interfaces.vala diff --git a/tests/test-002.exp b/tests/namespaces.exp similarity index 61% rename from tests/test-002.exp rename to tests/namespaces.exp index 9cd509a..5fd7a44 100644 --- a/tests/test-002.exp +++ b/tests/namespaces.exp @@ -1 +1,2 @@ +Namespace Test Class in Namespace Test diff --git a/tests/namespaces.vala b/tests/namespaces.vala new file mode 100644 index 0000000..3dcbdae --- /dev/null +++ b/tests/namespaces.vala @@ -0,0 +1,18 @@ +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"); + } + } +} + diff --git a/tests/test-013.exp b/tests/statements-jump.exp similarity index 100% rename from tests/test-013.exp rename to tests/statements-jump.exp diff --git a/tests/test-013.vala b/tests/statements-jump.vala similarity index 100% rename from tests/test-013.vala rename to tests/statements-jump.vala diff --git a/tests/test-020.exp b/tests/statements-selection.exp similarity index 57% rename from tests/test-020.exp rename to tests/statements-selection.exp index 040ff1d..0cd5103 100644 --- a/tests/test-020.exp +++ b/tests/statements-selection.exp @@ -1 +1,2 @@ +For Test: 1 2 3 4 5 6 7 Switch statement: 1 2 3 4 5 6 7 diff --git a/tests/test-020.vala b/tests/statements-selection.vala similarity index 83% rename from tests/test-020.vala rename to tests/statements-selection.vala index d69c365..59a0ba5 100644 --- a/tests/test-020.vala +++ b/tests/statements-selection.vala @@ -1,5 +1,27 @@ 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"); @@ -43,17 +65,7 @@ class Maman.Foo : Object { 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; } + diff --git a/tests/test-001.exp b/tests/test-001.exp deleted file mode 100644 index 5d4f34f..0000000 --- a/tests/test-001.exp +++ /dev/null @@ -1 +0,0 @@ -Namespace Test diff --git a/tests/test-001.vala b/tests/test-001.vala deleted file mode 100644 index c5e73a0..0000000 --- a/tests/test-001.vala +++ /dev/null @@ -1,8 +0,0 @@ -using GLib; - -namespace Maman { - static int main (string[] args) { - stdout.printf ("Namespace Test\n"); - return 0; - } -} diff --git a/tests/test-002.vala b/tests/test-002.vala deleted file mode 100644 index bb93511..0000000 --- a/tests/test-002.vala +++ /dev/null @@ -1,11 +0,0 @@ -using GLib; - -namespace Maman { - class Bar : Object { - static int main (string[] args) { - stdout.printf ("Class in Namespace Test\n"); - return 0; - } - } -} - diff --git a/tests/test-003.exp b/tests/test-003.exp deleted file mode 100644 index 8fefc2a..0000000 --- a/tests/test-003.exp +++ /dev/null @@ -1 +0,0 @@ -Subtype Test diff --git a/tests/test-003.vala b/tests/test-003.vala deleted file mode 100644 index 3003273..0000000 --- a/tests/test-003.vala +++ /dev/null @@ -1,11 +0,0 @@ -using GLib; - -class Maman.Bar : Object { -} - -class Maman.SubBar : Bar { - static int main (string[] args) { - stdout.printf ("Subtype Test\n"); - return 0; - } -} diff --git a/tests/test-004.exp b/tests/test-004.exp deleted file mode 100644 index af5eb0c..0000000 --- a/tests/test-004.exp +++ /dev/null @@ -1 +0,0 @@ -Inheritance Test: 1 2 3 diff --git a/tests/test-004.vala b/tests/test-004.vala deleted file mode 100644 index 0545ca2..0000000 --- a/tests/test-004.vala +++ /dev/null @@ -1,20 +0,0 @@ -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; - } -} diff --git a/tests/test-005.exp b/tests/test-005.exp deleted file mode 100644 index c4fe5be..0000000 --- a/tests/test-005.exp +++ /dev/null @@ -1 +0,0 @@ -Static Inheritance Test: 1 2 3 diff --git a/tests/test-005.vala b/tests/test-005.vala deleted file mode 100644 index 7b6a178..0000000 --- a/tests/test-005.vala +++ /dev/null @@ -1,19 +0,0 @@ -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; - } -} diff --git a/tests/test-006.exp b/tests/test-006.exp deleted file mode 100644 index def00ac..0000000 --- a/tests/test-006.exp +++ /dev/null @@ -1 +0,0 @@ -For Test: 1 2 3 4 5 6 7 diff --git a/tests/test-006.vala b/tests/test-006.vala deleted file mode 100644 index af210c9..0000000 --- a/tests/test-006.vala +++ /dev/null @@ -1,16 +0,0 @@ -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; - } -} diff --git a/tests/test-007.exp b/tests/test-007.exp deleted file mode 100644 index 1411281..0000000 --- a/tests/test-007.exp +++ /dev/null @@ -1 +0,0 @@ -Virtual Method Test: 1 2 3 diff --git a/tests/test-007.vala b/tests/test-007.vala deleted file mode 100644 index 3322abc..0000000 --- a/tests/test-007.vala +++ /dev/null @@ -1,24 +0,0 @@ -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; - } -} diff --git a/tests/test-009.exp b/tests/test-009.exp deleted file mode 100644 index ebcd72d..0000000 --- a/tests/test-009.exp +++ /dev/null @@ -1 +0,0 @@ -Property Test: 1 2 3 4 5 6 diff --git a/tests/test-009.vala b/tests/test-009.vala deleted file mode 100644 index 74c515c..0000000 --- a/tests/test-009.vala +++ /dev/null @@ -1,43 +0,0 @@ -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; - } -} diff --git a/tests/test-012.exp b/tests/test-012.exp deleted file mode 100644 index d5979ea..0000000 --- a/tests/test-012.exp +++ /dev/null @@ -1 +0,0 @@ -Block Test: 1 2 3 diff --git a/tests/test-012.vala b/tests/test-012.vala deleted file mode 100644 index 99e76f2..0000000 --- a/tests/test-012.vala +++ /dev/null @@ -1,15 +0,0 @@ -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; - } -} diff --git a/tests/test-024.exp b/tests/test-024.exp deleted file mode 100644 index e505c4b..0000000 --- a/tests/test-024.exp +++ /dev/null @@ -1 +0,0 @@ -User Signal Test: 1 2 3 4 5 6 diff --git a/tests/test-024.vala b/tests/test-024.vala deleted file mode 100644 index 288b242..0000000 --- a/tests/test-024.vala +++ /dev/null @@ -1,38 +0,0 @@ -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; - } -}