[MLton-commit] r7148

Matthew Fluet fluet at mlton.org
Mon Jun 15 15:27:53 PDT 2009


Regression tests for checking how arguments are passed though MLton.Process.{create,spawn}.
----------------------------------------------------------------------

A   mlton/trunk/regression/args-create.ok
A   mlton/trunk/regression/args-create.sml
A   mlton/trunk/regression/args-spawn.ok
A   mlton/trunk/regression/args-spawn.sml
D   mlton/trunk/regression/spawn.ok
D   mlton/trunk/regression/spawn.sml

----------------------------------------------------------------------

Copied: mlton/trunk/regression/args-create.ok (from rev 7147, mlton/trunk/regression/spawn.ok)

Copied: mlton/trunk/regression/args-create.sml (from rev 7147, mlton/trunk/regression/spawn.sml)
===================================================================
--- mlton/trunk/regression/spawn.sml	2009-06-15 21:45:16 UTC (rev 7147)
+++ mlton/trunk/regression/args-create.sml	2009-06-15 22:27:52 UTC (rev 7148)
@@ -0,0 +1,44 @@
+val tests = [
+  "\"hello\\\"",
+  "c:\\foo.bah",
+  "",
+  "hi\\",
+  "hi\"",
+  "evil\narg",
+  "evil\targ",
+  "evil arg",
+  "evil\rarg",
+  "evil\farg",
+  "\"bar\\",
+  "\\bah",
+  "bah \\bar",
+  "bah\\bar",
+  "bah\\\\",
+  "ba h\\\\",
+  "holy\"smoke",
+  "holy \"smoke" ]
+
+val cmd = CommandLine.name ()
+val args = CommandLine.arguments ()
+
+fun loop ([], []) = print "OK!\n"
+  | loop (x::r, y::s) = 
+      (if x <> y then print ("FAIL: "^x^":"^y^"\n") else (); loop (r, s))
+  | loop (_, _) = print "Wrong argument count\n"
+
+open MLton.Process
+val () =
+  if List.length args = 0
+  then let
+          val pid =
+             create {args = (*cmd::*)tests,
+                     env = NONE,
+                     path = cmd,
+                     stderr = Param.self,
+                     stdin = Param.self,
+                     stdout = Param.self}
+          val status = reap pid
+       in
+          ()
+       end
+  else loop (tests, args)

Copied: mlton/trunk/regression/args-spawn.ok (from rev 7147, mlton/trunk/regression/spawn.ok)

Copied: mlton/trunk/regression/args-spawn.sml (from rev 7147, mlton/trunk/regression/spawn.sml)
===================================================================
--- mlton/trunk/regression/spawn.sml	2009-06-15 21:45:16 UTC (rev 7147)
+++ mlton/trunk/regression/args-spawn.sml	2009-06-15 22:27:52 UTC (rev 7148)
@@ -0,0 +1,39 @@
+val tests = [
+  "\"hello\\\"",
+  "c:\\foo.bah",
+  "",
+  "hi\\",
+  "hi\"",
+  "evil\narg",
+  "evil\targ",
+  "evil arg",
+  "evil\rarg",
+  "evil\farg",
+  "\"bar\\",
+  "\\bah",
+  "bah \\bar",
+  "bah\\bar",
+  "bah\\\\",
+  "ba h\\\\",
+  "holy\"smoke",
+  "holy \"smoke" ]
+
+val cmd = CommandLine.name ()
+val args = CommandLine.arguments ()
+
+fun loop ([], []) = print "OK!\n"
+  | loop (x::r, y::s) = 
+      (if x <> y then print ("FAIL: "^x^":"^y^"\n") else (); loop (r, s))
+  | loop (_, _) = print "Wrong argument count\n"
+
+open Posix.Process
+open MLton.Process
+val () =
+  if List.length args = 0
+  then let
+          val pid = spawn {path = cmd, args = cmd::tests}
+          val status = waitpid (W_CHILD pid, [])
+       in
+          ()
+       end
+  else loop (tests, args)

Deleted: mlton/trunk/regression/spawn.ok
===================================================================
--- mlton/trunk/regression/spawn.ok	2009-06-15 21:45:16 UTC (rev 7147)
+++ mlton/trunk/regression/spawn.ok	2009-06-15 22:27:52 UTC (rev 7148)
@@ -1 +0,0 @@
-OK!

Deleted: mlton/trunk/regression/spawn.sml
===================================================================
--- mlton/trunk/regression/spawn.sml	2009-06-15 21:45:16 UTC (rev 7147)
+++ mlton/trunk/regression/spawn.sml	2009-06-15 22:27:52 UTC (rev 7148)
@@ -1,34 +0,0 @@
-val tests = [
-  "\"hello\\\"",
-  "c:\\foo.bah",
-  "",
-  "hi\\",
-  "hi\"",
-  "evil\narg",
-  "evil\targ",
-  "evil arg",
-  "evil\rarg",
-  "evil\farg",
-  "\"bar\\",
-  "\\bah",
-  "bah \\bar",
-  "bah\\bar",
-  "bah\\\\",
-  "ba h\\\\",
-  "holy\"smoke",
-  "holy \"smoke" ]
-
-val args = CommandLine.arguments ()
-
-fun loop ([], []) = print "OK!\n"
-  | loop (x::r, y::s) = 
-      (if x <> y then print ("FAIL: "^x^":"^y^"\n") else (); loop (r, s))
-  | loop (_, _) = print "Wrong argument count\n"
-
-open Posix.Process
-open MLton.Process
-val () =
-  if List.length args = 0
-  then ignore (waitpid (W_CHILD (spawn { path = "spawn", args = "spawn"::tests }), []))
-  else loop (tests, args)
- 




More information about the MLton-commit mailing list