コード例 #1
0
ファイル: ilepaths_test.go プロジェクト: kazuyamamoto/gorep
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")
	}
}
コード例 #2
0
ファイル: ilepaths_test.go プロジェクト: kazuyamamoto/gorep
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.")
	}
}