func TestStephen(t *testing.T) { run(sandboxDir) go boxtools.SimulateFilesystemChanges(sandboxDir, 10, 5, 0) for { time.Sleep(1000) } }
func TestStartWatcher(t *testing.T) { _, err := startWatcher("/billybob") if err == nil { t.Log("startWatcher must fail on invalid directory") t.FailNow() } ch, err := startWatcher(sandboxDir) if err != nil { t.Log("startWatcher didn't work on a valid directory") t.FailNow() } if reflect.ValueOf(ch).Kind() != reflect.Chan { t.Log("Return value from startWatcher must be a channel") t.FailNow() } go boxtools.SimulateFilesystemChanges(sandboxDir, 10, 5, 0) for i := 0; i < 18; i++ { fmt.Println(<-ch) fmt.Println(i) } ignores := make(map[string]bool) ignores[".Gobox"] = true abspath, err := filepath.Abs(sandboxDir) if err != nil { t.Log("Could not clean up properly") t.FailNow() } err = boxtools.CleanTestFolder(abspath, ignores, true) if err != nil { t.Log(err.Error()) t.FailNow() } return }