12345678910111213141516171819202122232425262728 |
- package jsh
-
- import "testing"
-
- func TestNewFilesystem(t *testing.T) {
- tooManyArgs := []string{"1", "2", "3", "4"}
- _, err := NewFilesystem(tooManyArgs)
- if err == nil {
- t.Errorf("Passing 4 strings should raise an error")
- }
-
- tooFewArgs := []string{"1", "2", "3", "4", "5", "6"}
- _, err = NewFilesystem(tooFewArgs)
- if err == nil {
- t.Errorf("Passing 6 strings should raise an error")
- }
-
- justRightArgs := []string{"1", "2", "3", "4", "5"}
- proc, err := NewFilesystem(justRightArgs)
- if err != nil {
- t.Errorf("Passing 5 strings should not raise an error")
- }
- expected := Filesystem{"1", 2, 3, 4, "5"}
- actual := *proc
- if expected != actual {
- t.Errorf("Filesystem was incorrectly generated:\n%s != %s", expected, actual)
- }
- }
|