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.

filesystem_test.go 736B

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