Changeset 24 in code for trunk/zs_test.go
- Timestamp:
- Aug 30, 2015, 12:20:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zs_test.go
r20 r24 7 7 "log" 8 8 "os" 9 "os/exec"10 9 "strings" 11 10 "testing" 12 "text/template"13 11 ) 14 12 … … 79 77 func TestRender(t *testing.T) { 80 78 vars := map[string]string{"foo": "bar"} 81 funcs := template.FuncMap{79 funcs := Funcs{ 82 80 "greet": func(s ...string) string { 83 81 if len(s) == 0 { … … 139 137 } 140 138 141 func TestEvalCommand(t *testing.T) {142 s, err := eval([]string{"echo", "hello"}, map[string]string{})143 if err != nil {144 t.Error(err)145 }146 if s != "hello\n" {147 t.Error(s)148 }149 _, err = eval([]string{"cat", "bogus/file"}, map[string]string{})150 if _, ok := err.(*exec.ExitError); !ok {151 t.Error("expected ExitError")152 }153 _, err = eval([]string{"missing command"}, map[string]string{})154 if err != nil {155 t.Error("missing command should be ignored")156 }157 }158 159 139 func TestHelperProcess(*testing.T) { 160 140 if os.Getenv("ZS_HELPER") != "1" {
Note:
See TracChangeset
for help on using the changeset viewer.