MCPcopy Create free account
hub / github.com/go-git/go-git / TestExamples

Function TestExamples

_examples/common_test.go:55–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53)
54
55func TestExamples(t *testing.T) {
56 flag.Parse()
57 if !*examplesTest && os.Getenv("CI") == "" {
58 t.Skip("skipping examples tests, pass --examples to execute it")
59 return
60 }
61
62 defer deleteTempFolders()
63
64 exampleMains, err := filepath.Glob(filepath.Join(basepath, "*", "main.go"))
65 if err != nil {
66 t.Errorf("error finding tests: %s", err)
67 }
68
69 for _, main := range exampleMains {
70 dir := filepath.Dir(main)
71 _, name := filepath.Split(dir)
72
73 if ignored[name] {
74 continue
75 }
76
77 t.Run(name, func(t *testing.T) {
78 testExample(t, name, dir)
79 })
80 }
81}
82
83func tempFolder() string {
84 path, err := os.MkdirTemp("", "")

Callers

nothing calls this directly

Calls 6

deleteTempFoldersFunction · 0.85
testExampleFunction · 0.85
GlobMethod · 0.80
JoinMethod · 0.80
SkipMethod · 0.65
ParseMethod · 0.45

Tested by

no test coverage detected