MCPcopy Create free account
hub / github.com/cloudwan/gohan / TestGetTestFiles

Function TestGetTestFiles

extension/framework/framework_test.go:29–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func TestGetTestFiles(t *testing.T) {
30 RegisterTestingT(t)
31
32 rootDir, err := ioutil.TempDir(os.TempDir(), fmt.Sprint(time.Now().UnixNano()))
33 Expect(err).ToNot(HaveOccurred())
34 defer os.RemoveAll(rootDir)
35
36 leftDir, err := ioutil.TempDir(rootDir, fmt.Sprint(time.Now().UnixNano()))
37 Expect(err).ToNot(HaveOccurred())
38
39 rightDir, err := ioutil.TempDir(rootDir, fmt.Sprint(time.Now().UnixNano()))
40 Expect(err).ToNot(HaveOccurred())
41
42 deepDir, err := ioutil.TempDir(leftDir, fmt.Sprint(time.Now().UnixNano()))
43 Expect(err).ToNot(HaveOccurred())
44
45 testFile1, err := util.TempFile(rootDir, "test_", ".js")
46 Expect(err).ToNot(HaveOccurred())
47 defer testFile1.Close()
48
49 testFile2, err := util.TempFile(rightDir, "test_", ".js")
50 Expect(err).ToNot(HaveOccurred())
51 defer testFile2.Close()
52
53 testFile3, err := util.TempFile(deepDir, "test_", ".js")
54 Expect(err).ToNot(HaveOccurred())
55 defer testFile3.Close()
56
57 irrelevantFile, err := util.TempFile(leftDir, "irrelevant", ".js")
58 Expect(err).ToNot(HaveOccurred())
59 defer irrelevantFile.Close()
60
61 args := []string{rootDir}
62 tests := getTestFiles(args, "js")
63
64 Expect(tests).To(ConsistOf(testFile1.Name(), testFile2.Name(), testFile3.Name()))
65}

Callers

nothing calls this directly

Calls 3

getTestFilesFunction · 0.85
CloseMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected