[seed] Fix completely incorrect nested struct/union set test
- From: Tim Horton <hortont src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [seed] Fix completely incorrect nested struct/union set test
- Date: Sat, 2 Jan 2010 23:40:47 +0000 (UTC)
commit 8050bd63efb3d540aeacefefe2bd953e2b57e3cf
Author: Tim Horton <hortont424 gmail com>
Date: Sat Jan 2 18:40:24 2010 -0500
Fix completely incorrect nested struct/union set test
tests/javascript/structs/struct-nested-set.js | 8 ++-
tests/run-tests.py | 68 +++++++++++++------------
2 files changed, 40 insertions(+), 36 deletions(-)
---
diff --git a/tests/javascript/structs/struct-nested-set.js b/tests/javascript/structs/struct-nested-set.js
index f4c9ed5..f8fb138 100755
--- a/tests/javascript/structs/struct-nested-set.js
+++ b/tests/javascript/structs/struct-nested-set.js
@@ -1,7 +1,7 @@
#!/usr/bin/env seed
// Returns: 0
// STDIN:
-// STDOUT:\[object seed_union\]\n2\n300
+// STDOUT:\[object seed_union\]\n1\n300\n400
// STDERR:
Gdk = imports.gi.Gdk;
@@ -9,10 +9,12 @@ Gdk = imports.gi.Gdk;
e = new Gdk.Event();
print(e);
-e.expose.type = Gdk.EventType.EXPOSE;
-print(e.expose.type);
+e.type = Gdk.EventType.EXPOSE;
+print(Gdk.EventType.EXPOSE == e.type);
r = new Gdk.Rectangle();
r.x = 300;
e.rectangle = r;
print(e.rectangle.x);
+e.rectangle.x = 400;
+print(e.rectangle.x);
\ No newline at end of file
diff --git a/tests/run-tests.py b/tests/run-tests.py
index 57930ea..8684083 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -18,45 +18,47 @@ mcwd = os.getcwd()
for root, dirs, files in os.walk(os.path.join(mcwd,"javascript")):
for filename in files:
f = os.path.join(root, filename)
- if f.endswith(".js") and not f.endswith("_.js"):
+ if f.endswith(".js") and not f.endswith("_.js") and not os.path.basename(f).startswith("."):
attempts = 0
while attempts < 10:
- rfile = open(f, "r")
- test_code = rfile.readlines()
- test_retval = int(test_code[1].replace("// Returns:","").rstrip().replace("\\n","\n"));
- test_in = test_code[2].replace("// STDIN:","").rstrip().replace("\\n","\n");
- test_out = "^" + test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n") + "$";
- test_err = "^" + test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n") + "$";
+ try:
+ rfile = open(f, "r")
+ test_code = rfile.readlines()
+ test_retval = int(test_code[1].replace("// Returns:","").rstrip().replace("\\n","\n"));
+ test_in = test_code[2].replace("// STDIN:","").rstrip().replace("\\n","\n");
+ test_out = "^" + test_code[3].replace("// STDOUT:","").rstrip().replace("\\n","\n") + "$";
+ test_err = "^" + test_code[4].replace("// STDERR:","").rstrip().replace("\\n","\n") + "$";
- p = subprocess.Popen(f, shell=True,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, close_fds=True,
- cwd=os.path.join(mcwd,"javascript"))
- (out,err)=(p.stdout, p.stderr)
+ p = subprocess.Popen(f, shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, close_fds=True,
+ cwd=os.path.join(mcwd,"javascript"))
+ (out,err)=(p.stdout, p.stderr)
- (run_out,run_err)=p.communicate(test_in + "\004")
- run_out = run_out.rstrip()
- run_err = run_err.rstrip()
- run_err = re.sub("Xlib: extension \".*\" missing on display \".*\".\n?","",run_err)
+ (run_out,run_err)=p.communicate(test_in + "\004")
+ run_out = run_out.rstrip()
+ run_err = run_err.rstrip()
+ run_err = re.sub("Xlib: extension \".*\" missing on display \".*\".\n?","",run_err)
- out.close()
- err.close()
+ out.close()
+ err.close()
- if not re.match(test_out,run_out):
- failed.append([filename,test_out,run_out,0,run_err])
- sys.stdout.write("x")
- elif not re.match(test_err,run_err):
- failed.append([filename,test_err,run_err,1])
- sys.stdout.write("x")
- elif p.returncode != test_retval:
- failed.append([filename,test_retval,p.returncode,2]);
- sys.stdout.write("x")
- else:
- passed.append([filename])
- sys.stdout.write(".")
- sys.stdout.flush()
- break
- attempts += 1
+ if not re.match(test_out,run_out):
+ failed.append([filename,test_out,run_out,0,run_err])
+ sys.stdout.write("x")
+ elif not re.match(test_err,run_err):
+ failed.append([filename,test_err,run_err,1])
+ sys.stdout.write("x")
+ elif p.returncode != test_retval:
+ failed.append([filename,test_retval,p.returncode,2]);
+ sys.stdout.write("x")
+ else:
+ passed.append([filename])
+ sys.stdout.write(".")
+ sys.stdout.flush()
+ break
+ except:
+ attempts += 1
if attempts == 10:
print "WARNING: Strange error in " + f + "\n\n"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]