Changeset 6 in code for trunk/zs_test.go


Ignore:
Timestamp:
Dec 5, 2014, 6:21:42 PM (11 years ago)
Author:
zaitsev.serge
Message:

added tests for eval command runner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zs_test.go

    r5 r6  
    66        "log"
    77        "os"
     8        "os/exec"
    89        "strings"
    910        "testing"
     
    124125}
    125126
     127func TestEvalCommand(t *testing.T) {
     128        s, err := eval([]string{"echo", "hello"}, map[string]string{})
     129        if err != nil {
     130                t.Error(err)
     131        }
     132        if s != "hello\n" {
     133                t.Error(s)
     134        }
     135        _, err = eval([]string{"cat", "bogus/file"}, map[string]string{})
     136        if _, ok := err.(*exec.ExitError); !ok {
     137                t.Error("expected ExitError")
     138        }
     139        _, err = eval([]string{"missing command"}, map[string]string{})
     140        if err != nil {
     141                t.Error("missing command should be ignored")
     142        }
     143}
     144
    126145func TestHelperProcess(*testing.T) {
    127146        if os.Getenv("ZS_HELPER") != "1" {
Note: See TracChangeset for help on using the changeset viewer.