seed r159 - trunk/tests



Author: racarr
Date: Fri Nov  7 07:34:11 2008
New Revision: 159
URL: http://svn.gnome.org/viewvc/seed?rev=159&view=rev

Log:
Add test of JSON.stringify and JSON.parse.


Added:
   trunk/tests/json.js   (contents, props changed)
   trunk/tests/printf.js   (contents, props changed)
Modified:
   trunk/tests/Makefile.am

Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am	(original)
+++ trunk/tests/Makefile.am	Fri Nov  7 07:34:11 2008
@@ -2,9 +2,11 @@
 	argv.js \
     compare.js \
     gtype.js \
+    json.js \ 
     enum.js \
     gobject-scope.js \
     include.js \
+    printf.js \
     json-constructor.js \
     list-test.js \
     namespace-exception-test.js \

Added: trunk/tests/json.js
==============================================================================
--- (empty file)
+++ trunk/tests/json.js	Fri Nov  7 07:34:11 2008
@@ -0,0 +1,14 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:
+// STDERR:
+a = {test: 3,
+     hello: "Goodbye",
+     more: {a: "1", b: 2, c:"d"}};
+json = JSON.stringify(a);
+object = JSON.parse(json);
+json2 = JSON.stringify(object);
+if (json != json2)
+    Seed.print("Failure");
+       
\ No newline at end of file

Added: trunk/tests/printf.js
==============================================================================
--- (empty file)
+++ trunk/tests/printf.js	Fri Nov  7 07:34:11 2008
@@ -0,0 +1,11 @@
+#!/usr/local/bin/seed
+// Returns: 0
+// STDIN:
+// STDOUT:string\nstring\ninteger 4\nfloat 0\.333333\nmore 0\.333333333\nless 0\.33
+// STDERR:
+Seed.printf("string");
+Seed.printf("%s", "string");
+Seed.printf("%s %d", "integer", 2+2);
+Seed.printf("%s %f", "float", 1/3);
+Seed.printf("%s %.9f", "more", 1/3);
+Seed.printf("%s %.2f", "less", 1/3);
\ No newline at end of file



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