Skip to content

Commit 972c71c

Browse files
committed
remove useless test case
1 parent 08eff5e commit 972c71c

File tree

2 files changed

+0
-97
lines changed

2 files changed

+0
-97
lines changed

test/integration_test.go

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@ import (
77
"os"
88
"os/exec"
99
"path/filepath"
10-
"reflect"
1110
"strings"
1211
"testing"
1312
"time"
1413
)
1514

16-
var (
17-
update = flag.Bool("update", false, "update .golden files")
18-
)
19-
2015
var binaryName = "clibgen"
2116
var binaryPath = ""
2217

@@ -42,12 +37,6 @@ func TestMain(m *testing.M) {
4237
os.Exit(m.Run())
4338
}
4439

45-
func runBinary(args []string) ([]byte, error) {
46-
cmd := exec.Command(binaryPath, args...)
47-
cmd.Env = append(os.Environ(), "GOCOVERDIR=.coverdata")
48-
return cmd.CombinedOutput()
49-
}
50-
5140
func runBinaryWithFileInput(args []string, bytesToWrite []byte) ([]byte, error) {
5241
fmt.Println("Running binary with file input", bytesToWrite)
5342
fmt.Printf("Executing command: %s", binaryPath)
@@ -99,38 +88,6 @@ func runBinaryWithFileInput(args []string, bytesToWrite []byte) ([]byte, error)
9988
return out, err
10089
}
10190

102-
func TestStaticCliArgs(t *testing.T) {
103-
tests := []struct {
104-
name string
105-
args []string
106-
fixture string
107-
}{
108-
{"help args", []string{"--help"}, "help.golden"},
109-
}
110-
111-
for _, tt := range tests {
112-
t.Run(tt.name, func(t *testing.T) {
113-
output, err := runBinary(tt.args)
114-
115-
if err != nil {
116-
t.Fatal(err)
117-
}
118-
119-
if *update {
120-
writeFixture(t, tt.fixture, output)
121-
}
122-
123-
actual := string(output)
124-
125-
expected := loadFixture(t, tt.fixture)
126-
127-
if !reflect.DeepEqual(actual, expected) {
128-
t.Fatalf("actual = %s, expected = %s", actual, expected)
129-
}
130-
})
131-
}
132-
}
133-
13491
func TestSearch(t *testing.T) {
13592
tests := []struct {
13693
name string
@@ -158,40 +115,3 @@ func TestSearch(t *testing.T) {
158115
})
159116
}
160117
}
161-
162-
func removeLastLine(str string, num int) string {
163-
lines := strings.Split(str, "\n")
164-
165-
if len(lines) > 0 {
166-
lines = lines[:len(lines)-num]
167-
}
168-
169-
return strings.Join(lines, "\n")
170-
}
171-
172-
func writeFixture(t *testing.T, goldenFile string, actual []byte) {
173-
t.Helper()
174-
goldenPath := "testdata/" + goldenFile
175-
176-
f, err := os.OpenFile(goldenPath, os.O_RDWR, 0644)
177-
defer f.Close()
178-
179-
_, err = f.WriteString(string(actual))
180-
181-
if err != nil {
182-
t.Fatalf("Error writing to file %s: %s", goldenPath, err)
183-
}
184-
}
185-
186-
func loadFixture(t *testing.T, goldenFile string) string {
187-
goldenPath := "testdata/" + goldenFile
188-
189-
f, err := os.OpenFile(goldenPath, os.O_RDWR, 0644)
190-
191-
content, err := ioutil.ReadAll(f)
192-
if err != nil {
193-
t.Fatalf("Error opening file %s: %s", goldenPath, err)
194-
}
195-
196-
return string(content)
197-
}

testdata/help.golden

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)