import files;
import assert;

// Test redirection

// Loop string through file
(string o) id (string i) {
  o = read(cat(write(i)));
}

app (file out) cat (file inp) {
  "/bin/cat" @stdin=inp @stdout=out;
}

main () {
  foreach s in ["one", "two", "three", "four"] {
    string s2 = id(s);
    assertEqual(s2, s, "'" + s + "'" + " != " + "'" + s2 + "'");
  }
}


import files;
import assert;

// Test redirection

// Loop string through file
(string o) id (string i) {
  o = read(cat(write(i)));
}

app (file out) cat (file inp) {
  "/bin/cat" @stdin=inp @stdout=out;
}

main () {
  foreach s in ["one", "two", "three", "four"] {
    string s2 = id(s);
    assertEqual(s2, s + "\n", "'" + s + "'" + " != " + "'" + s2 + "'");
  }
}


--- 
+++ 
@@ -15,7 +15,7 @@
 main () {
   foreach s in ["one", "two", "three", "four"] {
     string s2 = id(s);
-    assertEqual(s2, s + "\n", "'" + s + "'" + " != " + "'" + s2 + "'");
+    assertEqual(s2, s, "'" + s + "'" + " != " + "'" + s2 + "'");
   }
 }
 
Update test to reflect that write doesn't erroneously append newline

git-svn-id: 47705994653588c662f4ea400dfe88107361c0e2@8636 dc4e9af1-7f46-4ead-bba6-71afc04862de
