Skip to content

Commit

Permalink
add new cmd/test to old runtime to test SC
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed Jun 23, 2020
1 parent 9ac5c54 commit bff8fb8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions script/runtime/cmd_hello.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package runtime

func (ts *Script) CmdHello(neg int, args []string) {
if neg != 0 {
ts.Fatalf("unsupported: !? stdin")
}
out := "hello world"
if len(args) >= 1 {
out = "hello " + args[0]
}
ts.stdout = out
}
1 change: 1 addition & 0 deletions script/runtime/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ var scriptCmds = map[string]func(*Script, int, []string){

// other
"unquote": (*Script).CmdUnquote,
"hello": (*Script).CmdHello,
}

9 changes: 9 additions & 0 deletions script/runtime/tests/hello.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,14 @@ exec cat hello.text
stdout 'hello world\n'
! stderr .

hello
stdout 'hello world'
! stderr .

hello apple
stdout 'hello apple'
! stderr .


-- hello.text --
hello world

0 comments on commit bff8fb8

Please sign in to comment.