-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
springerle_test.go
44 lines (41 loc) · 902 Bytes
/
springerle_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package test
import (
"os"
"os/exec"
"testing"
"github.com/carlmjohnson/springerle/txtartmpl"
)
func TestProj(t *testing.T) {
dst := t.TempDir()
const context = `
{
"author": "John Doe",
"proj_full": "Project X",
"proj_short": "project_x",
"repo": "github.com/john_doe/project_x",
"pkg": "app",
"gversion": "1.18",
"description": "tktk"
}
`
err := txtartmpl.CLI([]string{"-context", context, "-dest", dst, "go-cli.txtar"})
if err != nil {
t.Fatalf("err: %v", err)
}
if err := os.Chdir(dst); err != nil {
t.Fatalf("err: %v", err)
}
cmd := exec.Command("./finalize.sh")
output, err := cmd.CombinedOutput()
if err != nil {
t.Fatal(string(output))
}
if err := os.Chdir("./project_x"); err != nil {
t.Fatalf("err: %v", err)
}
cmd = exec.Command("go", "test", "./...")
output, err = cmd.CombinedOutput()
if err != nil {
t.Fatal(string(output))
}
}