diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2020-05-21 20:36:57 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2020-05-21 20:36:57 -0400 |
| commit | ac32d560614d2fbff910335d40cea3ac8cfae00f (patch) | |
| tree | 675a6f75e017a77ab44ccd07cc84eefe054c6037 /data/datasource_stdin_test.go | |
| parent | da66c3437d3f4bca4423b07a6009f5d060a61839 (diff) | |
refactoring: extract stdin and boltdb readers
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'data/datasource_stdin_test.go')
| -rw-r--r-- | data/datasource_stdin_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/data/datasource_stdin_test.go b/data/datasource_stdin_test.go new file mode 100644 index 00000000..7fc02318 --- /dev/null +++ b/data/datasource_stdin_test.go @@ -0,0 +1,22 @@ +package data + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestReadStdin(t *testing.T) { + defer func() { + stdin = nil + }() + stdin = strings.NewReader("foo") + out, err := readStdin(nil) + assert.NoError(t, err) + assert.Equal(t, []byte("foo"), out) + + stdin = errorReader{} + _, err = readStdin(nil) + assert.Error(t, err) +} |
