MCPcopy
hub / github.com/opentofu/opentofu / TestOutput_emptyOutputs

Function TestOutput_emptyOutputs

internal/command/output_test.go:97–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

95}
96
97func TestOutput_emptyOutputs(t *testing.T) {
98 originalState := states.NewState()
99 statePath := testStateFile(t, originalState)
100
101 p := testProvider()
102 view, done := testView(t)
103 c := &OutputCommand{
104 Meta: Meta{
105 WorkingDir: workdir.NewDir("."),
106 testingOverrides: metaOverridesForProvider(p),
107 View: view,
108 },
109 }
110
111 args := []string{
112 "-no-color",
113 "-state", statePath,
114 }
115 code := c.Run(args)
116 output := done(t)
117 if code != 0 {
118 t.Fatalf("bad: \n%s", output.Stderr())
119 }
120 // Warning diagnostics should go to stdout
121 if got, want := output.Stdout(), "Warning: No outputs found"; !strings.Contains(got, want) {
122 t.Fatalf("bad output: expected to contain %q, got:\n%s", want, got)
123 }
124}
125
126func TestOutput_badVar(t *testing.T) {
127 originalState := states.BuildState(func(s *states.SyncState) {

Callers

nothing calls this directly

Calls 10

RunMethod · 0.95
NewStateFunction · 0.92
NewDirFunction · 0.92
metaOverridesForProviderFunction · 0.85
StderrMethod · 0.80
StdoutMethod · 0.80
testStateFileFunction · 0.70
testProviderFunction · 0.70
testViewFunction · 0.70
ContainsMethod · 0.45

Tested by

no test coverage detected