Exemplo n.º 1
0
func Test_filePaths_allFilePaths(t *testing.T) {
	fps := allFilePaths()

	paths := []string{}
	for path := range fps.find() {
		paths = append(paths, path)
	}

	f := "filepaths_test.go"
	if !strings.Includes(paths, f) {
		t.Fatal(f, "should be included.")
	}

	if !strings.Includes(paths, "testdir"+sep+"file1") {
		t.Fatal("testdir" + sep + "file1")
	}

	if !strings.Includes(paths, "testdir"+sep+"childdir"+sep+"file3") {
		t.Fatal("testdir" + sep + "childdir" + sep + "file3")
	}
}
Exemplo n.º 2
0
func Test_matchedFilePaths(t *testing.T) {
	fps := matchedFilePaths("testdir")

	paths := []string{}
	for path := range fps.find() {
		paths = append(paths, path)
	}

	f := "filepaths_test.go"
	if strings.Includes(paths, f) {
		t.Fatal(f, "should not be included.")
	}

	f = "testdir" + sep + "file1"
	if !strings.Includes(paths, f) {
		t.Fatal(f, "should be included.")
	}

	f = "testdir" + sep + "childdir" + sep + "file3"
	if !strings.Includes(paths, f) {
		t.Fatal(f, "should be included.")
	}
}