2008-01-21 Jürg Billeter <j@bitron.ch>
+ * tests/Makefile.am, tests/arrays.exp, tests/arrays.vala: combine array
+ tests in one file
+
+2008-01-21 Jürg Billeter <j@bitron.ch>
+
* vala/valasemanticanalyzer.vala: set base_method also in VAPI classes
for virtual and abstract methods, fixes `base´ access
interfaces.vala \
interfaces-properties.vala \
enums.vala \
+ arrays.vala \
delegates.vala \
exceptions.vala \
\
test-015.vala \
test-019.vala \
test-021.vala \
- test-022.vala \
test-023.vala \
test-025.vala \
test-026.vala \
test-029.vala \
test-030.vala \
test-031.vala \
- test-032.vala \
test-034.vala \
test-035.vala \
test-036.vala \
- test-037.vala \
$(NULL)
EXTRA_DIST = \
interfaces.exp \
interfaces-properties.exp \
enums.exp \
+ arrays.exp \
delegates.exp \
exceptions.exp \
\
test-015.exp \
test-019.exp \
test-021.exp \
- test-022.exp \
test-023.exp \
test-025.exp \
test-026.exp \
test-029.exp \
test-030.exp \
test-031.exp \
- test-032.exp \
test-034.exp \
test-035.exp \
test-036.exp \
- test-037.exp \
$(NULL)
One dimensional array creation and assignment: 1 2 3 4 5 6 7 8 9 10 11
String array creation and assignment: 1 2 3 4 5 6 7 8 9 10 11
Object array creation and assignment: 1 2 3 4 5 6 7 8 9 10 11
+Array Test: 1 2 3 4 5
+testing switch on strings: 1 2 3 4 5 6 7
test_integer_array ();
test_string_array ();
test_object_array ();
+
+ stdout.printf ("Array Test: 1");
+
+ var bar = new Bar ();
+ bar.run ();
+
+ stdout.printf (" 5\n");
+
+ var tokens = new string[] { "Hello", "World", "this", "is", "Vala", "GNOME", null };
+ var t4 = " 5";
+
+ stdout.printf ("testing switch on strings:");
+
+ foreach (weak string t in tokens) {
+ switch (t) {
+ case "Hello":
+ stdout.printf (" 1");
+ break;
+
+ case "World":
+ stdout.printf (" 2");
+ break;
+
+ case "this":
+ stdout.printf (" 3");
+ break;
+
+ case ("is"):
+ stdout.printf (" 4");
+ break;
+
+ case tokens[4]:
+ stdout.printf (t4);
+ tokens[4] = "GNOME";
+ t4 = " 6";
+ break;
+
+ default:
+ stdout.printf (" 7");
+ break;
+ }
+ }
+
+ tokens[4] = null;
+
+ stdout.printf ("\n");
}
}
+
+class Maman.Bar : Object {
+ public int[] foo_numbers () {
+ return new int[3] { 2, 3, 4 };
+ }
+
+ public void run () {
+ foreach (int i in foo_numbers ()) {
+ stdout.printf (" %d", i);
+ }
+ }
+}
+
+++ /dev/null
-Array Test: 1 2 3 4 5
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- public int[] foo_numbers () {
- return new int[3] { 2, 3, 4 };
- }
-
- public void run () {
- foreach (int i in foo_numbers ()) {
- stdout.printf (" %d", i);
- }
- }
-
- static int main (string[] args) {
- stdout.printf ("Array Test: 1");
-
- var bar = new Bar ();
- bar.run ();
-
- stdout.printf (" 5\n");
-
- return 0;
- }
-}
+++ /dev/null
-testing switch on strings: 1 2 3 4 5 6 7
+++ /dev/null
-using GLib;
-
-class Maman.Bar : Object {
- static void main () {
- // FIXME: figure out why "new string[]" is needed (again?)
- var tokens = new string[] { "Hello", "World", "this", "is", "Vala", "GNOME", null };
- var t4 = " 5";
-
- stdout.printf ("testing switch on strings:");
-
- foreach(weak string t in tokens) {
- switch (t) {
- case "Hello":
- stdout.printf (" 1");
- break;
-
- case "World":
- stdout.printf (" 2");
- break;
-
- case "this":
- stdout.printf (" 3");
- break;
-
- case ("is"):
- stdout.printf (" 4");
- break;
-
- case tokens[4]:
- stdout.printf (t4);
- tokens[4] = "GNOME";
- t4 = " 6";
- break;
-
- default:
- stdout.printf (" 7");
- break;
- }
- }
-
- tokens[4] = null; // FIXME: element access on array takes ownership
-
- stdout.printf ("\n");
- }
-}
-