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