No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

process_test.go 852B

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