vala r877 - in trunk: . tests



Author: juergbi
Date: Mon Jan 21 20:07:03 2008
New Revision: 877
URL: http://svn.gnome.org/viewvc/vala?rev=877&view=rev

Log:
2008-01-21  Juerg Billeter  <j bitron ch>

	* tests/Makefile.am, tests/arrays.exp, tests/arrays.vala: combine array
	  tests in one file


Added:
   trunk/tests/arrays.exp
      - copied, changed from r873, /trunk/tests/test-022.exp
   trunk/tests/arrays.vala
      - copied, changed from r873, /trunk/tests/test-022.vala
Removed:
   trunk/tests/test-022.exp
   trunk/tests/test-022.vala
   trunk/tests/test-032.exp
   trunk/tests/test-032.vala
   trunk/tests/test-037.exp
   trunk/tests/test-037.vala
Modified:
   trunk/ChangeLog
   trunk/tests/Makefile.am

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Mon Jan 21 20:07:03 2008
@@ -31,13 +31,13 @@
 	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 \
@@ -45,11 +45,9 @@
 	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 = \
@@ -72,13 +70,13 @@
 	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 \
@@ -86,10 +84,8 @@
 	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)
 

Copied: trunk/tests/arrays.exp (from r873, /trunk/tests/test-022.exp)
==============================================================================
--- /trunk/tests/test-022.exp	(original)
+++ trunk/tests/arrays.exp	Mon Jan 21 20:07:03 2008
@@ -1,3 +1,5 @@
 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

Copied: trunk/tests/arrays.vala (from r873, /trunk/tests/test-022.vala)
==============================================================================
--- /trunk/tests/test-022.vala	(original)
+++ trunk/tests/arrays.vala	Mon Jan 21 20:07:03 2008
@@ -128,5 +128,64 @@
 		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);
+		}
+	}
+}
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]