Update test scripts for SwiftShell 2.0.

Finally.
This commit is contained in:
Kare Morstol
2015-10-16 03:52:47 +02:00
parent b447059e3e
commit 70319b54db
3 changed files with 13 additions and 13 deletions
@@ -2,4 +2,4 @@
import SwiftShell
run("cat onetwothree.txt") |> run("./print_linenumbers.swift") |>> standardoutput
try! run("cat","onetwothree.txt").runAndPrint("./print_linenumbers.swift")
+11 -11
View File
@@ -2,31 +2,31 @@
import SwiftShell
let filepath = tempdirectory / "newfile.txt"
let filepath = main.tempdirectory + "/newfile.txt"
// File doesn't exist. Create it.
let file1 = open(forWriting: filepath )
let file1 = try! open(forWriting: filepath)
file1.writeln("line 1")
file1.closeStream()
file1.close()
// File does exist. Append it.
let file2 = open(forWriting: filepath)
let file2 = try! open(forWriting: filepath)
file2.writeln("line 2")
file2.closeStream()
file2.close()
// Test file.
let file3 = open(filepath)
let file3 = try! open(filepath)
if file3.read() != "line 1\nline 2\n" {
printErrorAndExit( "newfile.txt should contain 'line 1\\n line 2\\n'." )
exit(errormessage: "newfile.txt should contain 'line 1\\n line 2\\n'." )
}
// File exists. Overwrite it.
let file4 = open(forWriting: filepath, overwrite: true)
let file4 = try! open(forWriting: filepath, overwrite: true)
file4.write("file now contains only this")
file4.closeStream()
file4.close()
// Test file.
let file5 = open(filepath)
let file5 = try! open(filepath)
if file5.read() != "file now contains only this" {
printErrorAndExit( "newfile.txt should contain 'file now contains only this'." )
exit(errormessage: "newfile.txt should contain 'file now contains only this'." )
}
+1 -1
View File
@@ -2,4 +2,4 @@
import SwiftShell
run("echo this is streamed") |> run("wc -w") |>> standardoutput
try! run("echo","this is streamed").runAndPrint("wc", "-w")