Skip to content

Commit c215911

Browse files
committed
Revert "added Check func test"
This reverts commit 5b6e2f9.
1 parent 92cf9d0 commit c215911

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

main_test.go

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"github.com/oschwald/maxminddb-golang"
77
"github.com/stretchr/testify/assert"
88
"github.com/stretchr/testify/require"
9-
"bytes"
10-
"errors"
119
"fmt"
1210
"os"
1311
"testing"
@@ -19,49 +17,6 @@ const (
1917
TestDataset = "./testdata/dataset.json"
2018
)
2119

22-
func captureOutput(f func()) string {
23-
// Create a pipe to capture the output
24-
r, w, _ := os.Pipe()
25-
// Save the original stdout
26-
stdout := os.Stdout
27-
// Set stdout to the write end of the pipe
28-
os.Stdout = w
29-
30-
// Run the function (which will print to stdout)
31-
f()
32-
33-
// Close the writer end and restore stdout
34-
w.Close()
35-
os.Stdout = stdout
36-
37-
// Read the captured output from the read end of the pipe
38-
var buf bytes.Buffer
39-
buf.ReadFrom(r)
40-
41-
return buf.String()
42-
}
43-
44-
func TestCheck(t *testing.T) {
45-
output := captureOutput(func() {
46-
Check(func() error {
47-
return nil
48-
})
49-
})
50-
51-
// Check that there was no output (since no error should be printed)
52-
assert.Empty(t, output)
53-
54-
output = captureOutput(func() {
55-
Check(func() error {
56-
return errors.New("test error")
57-
})
58-
})
59-
60-
// Check that the error message was printed
61-
expectedOutput := "Received error: test error\n"
62-
assert.Equal(t, expectedOutput, output)
63-
}
64-
6520
func TestToMMDBType(t *testing.T) {
6621
tests := []struct {
6722
key string

0 commit comments

Comments
 (0)