Update test scripts.
The rest are waiting for reading and writing files to be implemented.
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
|
||||
import SwiftShell
|
||||
|
||||
let file = open("file which does not exist")
|
||||
try! runAndPrint("/bin/cat", "file which does not exist")
|
||||
print("this is not printed, the script has exited")
|
||||
|
||||
@@ -2,13 +2,10 @@
|
||||
|
||||
import SwiftShell
|
||||
|
||||
/*
|
||||
var i = 1
|
||||
for line in standardinput.lines() {
|
||||
print("line \(i++): ")
|
||||
println(line)
|
||||
}
|
||||
*/
|
||||
let result = main.stdin.read().characters.split("\n")
|
||||
.enumerate().map { (linenr,line) in "line " + String(linenr+1) + ": " + String(line) }
|
||||
|
||||
var i = 1
|
||||
standardinput.lines() |> map {line in "line \(i++): \(line)\n"} |>> standardoutput
|
||||
// Swift demands we split this up.
|
||||
main.stdout.write(result.joinWithSeparator("\n"))
|
||||
|
||||
// TODO: use .writeTo(&main.stdout)
|
||||
|
||||
@@ -19,8 +19,8 @@ export DYLD_FRAMEWORK_PATH=$PROJECT_ROOT/build/Release/
|
||||
|
||||
# Be aware the “assert” command does not check standard error output or exit code.
|
||||
|
||||
assert "./print_arguments.swift 1 2" "[./print_arguments.swift, 1, 2]"
|
||||
assert_raises "./exitswhenopeningnon-existentfile.swift" 1
|
||||
assert "./print_name_and_args.swift 1 2" "print_name_and_args.swift \"1\" \"2\""
|
||||
assert_raises "./exitswhenopeningnon-existentfile.swift" 132
|
||||
assert "cat onetwothree.txt | ./print_linenumbers.swift" "line 1: one\nline 2: two\nline 3: three"
|
||||
assert "./stream_out.swift" " 3"
|
||||
assert "./callswiftscriptfromswift.swift" "line 1: one\nline 2: two\nline 3: three"
|
||||
|
||||
Reference in New Issue
Block a user