MCPcopy
hub / github.com/danielmiessler/Fabric / TestReadStdin

Function TestReadStdin

internal/cli/flags_test.go:27–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestReadStdin(t *testing.T) {
28 input := "test input"
29 stdin := io.NopCloser(strings.NewReader(input))
30 // No need to cast stdin to *os.File, pass it as io.ReadCloser directly
31 content, err := ReadStdin(stdin)
32 if err != nil {
33 t.Fatalf("unexpected error: %v", err)
34 }
35 if content != input {
36 t.Fatalf("expected %q, got %q", input, content)
37 }
38}
39
40// ReadStdin function assuming it's part of `cli` package
41func ReadStdin(reader io.ReadCloser) (string, error) {

Callers

nothing calls this directly

Calls 1

ReadStdinFunction · 0.85

Tested by

no test coverage detected