This repository has been archived on 2015-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
jsh/process_test.go
2014-09-04 02:30:52 -04:00

29 lines
852 B
Go

package jsh
import "testing"
func TestNewProcess(t *testing.T) {
tooManyArgs := []string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}
_, err := NewProcess(tooManyArgs)
if err == nil {
t.Errorf("Passing 12 strings should raise an error")
}
tooFewArgs := []string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
_, err = NewProcess(tooFewArgs)
if err == nil {
t.Errorf("Passing 10 strings should raise an error")
}
justRightArgs := []string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"}
proc, err := NewProcess(justRightArgs)
if err != nil {
t.Errorf("Passing 11 strings should not raise an error")
}
expected := Process{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"}
actual := *proc
if expected != actual {
t.Errorf("Proc was incorrectly generated:\n%s != %s", expected, actual)
}
}