(t *testing.T)
| 53 | ) |
| 54 | |
| 55 | func 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 | |
| 83 | func tempFolder() string { |
| 84 | path, err := os.MkdirTemp("", "") |
nothing calls this directly
no test coverage detected