MCPcopy
hub / github.com/larksuite/cli / TestResolveInputFlags_EmptyFile

Function TestResolveInputFlags_EmptyFile

shortcuts/common/runner_input_test.go:80–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

78}
79
80func TestResolveInputFlags_EmptyFile(t *testing.T) {
81 dir := t.TempDir()
82 cmdutil.TestChdir(t, dir)
83
84 if err := os.WriteFile("empty.md", nil, 0644); err != nil {
85 t.Fatal(err)
86 }
87
88 rctx := newTestRuntimeWithStdin(map[string]string{"markdown": "@empty.md"}, "")
89 flags := []Flag{{Name: "markdown", Input: []string{File, Stdin}}}
90
91 if err := resolveInputFlags(rctx, flags); err != nil {
92 t.Fatalf("unexpected error: %v", err)
93 }
94 if got := rctx.Str("markdown"); got != "" {
95 t.Errorf("expected empty string, got %q", got)
96 }
97}
98
99func TestResolveInputFlags_EmptyInput(t *testing.T) {
100 rctx := newTestRuntimeWithStdin(map[string]string{"markdown": ""}, "")

Callers

nothing calls this directly

Calls 5

TestChdirFunction · 0.92
newTestRuntimeWithStdinFunction · 0.85
resolveInputFlagsFunction · 0.85
WriteFileMethod · 0.65
StrMethod · 0.65

Tested by

no test coverage detected