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

Function TestResolveInputFlags_File

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

Source from the content-addressed store, hash-verified

58}
59
60func TestResolveInputFlags_File(t *testing.T) {
61 dir := t.TempDir()
62 cmdutil.TestChdir(t, dir)
63
64 content := "## Hello\n\nThis is **markdown** from a file.\n"
65 if err := os.WriteFile("test.md", []byte(content), 0644); err != nil {
66 t.Fatal(err)
67 }
68
69 rctx := newTestRuntimeWithStdin(map[string]string{"markdown": "@test.md"}, "")
70 flags := []Flag{{Name: "markdown", Input: []string{File, Stdin}}}
71
72 if err := resolveInputFlags(rctx, flags); err != nil {
73 t.Fatalf("unexpected error: %v", err)
74 }
75 if got := rctx.Str("markdown"); got != content {
76 t.Errorf("expected %q, got %q", content, got)
77 }
78}
79
80func TestResolveInputFlags_EmptyFile(t *testing.T) {
81 dir := t.TempDir()

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