properly implement tco and add step7:quote
[jackhill/mal.git] / runtest.py
index 8953a10..5fe1165 100755 (executable)
@@ -29,12 +29,7 @@ def log(data, end='\n'):
     sys.stdout.flush()
 
 # TODO: do we need to support '\n' too
-import platform
-if platform.system().find("CYGWIN_NT") >= 0:
-    # TODO: this is weird, is this really right on Cygwin?
-    sep = "\n\r\n"
-else:
-    sep = "\r\n"
+sep = "\r\n"
 rundir = None
 
 parser = argparse.ArgumentParser(
@@ -54,7 +49,7 @@ parser.add_argument('--log-file', type=str,
 parser.add_argument('--debug-file', type=str,
         help="Write all test interaction the named file")
 parser.add_argument('--hard', action='store_true',
-        help="Turn soft tests following a ';>>> soft=True' into hard failures")
+        help="Turn soft tests (soft, deferrable, optional) into hard failures")
 
 # Control whether deferrable and optional tests are executed
 parser.add_argument('--deferrable', dest='deferrable', action='store_true',
@@ -204,8 +199,7 @@ class TestReader:
                     return True
                 continue
             elif line[0:1] == ";":         # unexpected comment
-                log("Test data error at line %d:\n%s" % (self.line_num, line))
-                return None
+                raise Exception("Test data error at line %d:\n%s" % (self.line_num, line))
             self.form = line   # the line is a form to send
 
             # Now find the output and return value
@@ -252,7 +246,7 @@ def assert_prompt(runner, prompts, timeout):
         if header:
             log("Started with:\n%s" % header)
     else:
-        log("Did not one of following prompt(s): %s" % repr(prompts))
+        log("Did not receive one of following prompt(s): %s" % repr(prompts))
         log("    Got      : %s" % repr(r.buf))
         sys.exit(1)
 
@@ -269,8 +263,8 @@ except:
 # Send the pre-eval code if any
 if args.pre_eval:
     sys.stdout.write("RUNNING pre-eval: %s" % args.pre_eval)
-    p.write(args.pre_eval)
-    assert_prompt(args.test_timeout)
+    r.writeline(args.pre_eval)
+    assert_prompt(r, ['[^\s()<>]+> '], args.test_timeout)
 
 test_cnt = 0
 pass_cnt = 0