Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / mvdan.cc / gofumpt@v0.0.0-20200802201014-ab5a8192947d / main_test.go
1 // Copyright (c) 2019, Daniel Martí <mvdan@mvdan.cc>
2 // See LICENSE for licensing information
3
4 package main
5
6 import (
7         "os"
8         "path/filepath"
9         "testing"
10
11         "github.com/rogpeppe/go-internal/gotooltest"
12         "github.com/rogpeppe/go-internal/testscript"
13 )
14
15 func TestMain(m *testing.M) {
16         os.Exit(testscript.RunMain(m, map[string]func() int{
17                 "gofumpt": func() int {
18                         gofumptMain()
19                         return exitCode
20                 },
21         }))
22 }
23
24 func TestScripts(t *testing.T) {
25         t.Parallel()
26         p := testscript.Params{
27                 Dir: filepath.Join("testdata", "scripts"),
28                 Condition: func(cond string) (bool, error) {
29                         switch cond {
30                         case "gofumpt":
31                                 return true, nil
32                         }
33                         return false, nil
34                 },
35         }
36         if err := gotooltest.Setup(&p); err != nil {
37                 t.Fatal(err)
38         }
39         testscript.Run(t, p)
40 }