(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func TestOutput_badVar(t *testing.T) { |
| 127 | originalState := states.BuildState(func(s *states.SyncState) { |
| 128 | s.SetOutputValue( |
| 129 | addrs.OutputValue{Name: "foo"}.Absolute(addrs.RootModuleInstance), |
| 130 | cty.StringVal("bar"), |
| 131 | false, |
| 132 | "", |
| 133 | ) |
| 134 | }) |
| 135 | statePath := testStateFile(t, originalState) |
| 136 | |
| 137 | view, done := testView(t) |
| 138 | c := &OutputCommand{ |
| 139 | Meta: Meta{ |
| 140 | WorkingDir: workdir.NewDir("."), |
| 141 | testingOverrides: metaOverridesForProvider(testProvider()), |
| 142 | View: view, |
| 143 | }, |
| 144 | } |
| 145 | |
| 146 | args := []string{ |
| 147 | "-state", statePath, |
| 148 | "bar", |
| 149 | } |
| 150 | code := c.Run(args) |
| 151 | output := done(t) |
| 152 | if code != 1 { |
| 153 | t.Fatalf("bad: \n%s", output.Stderr()) |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | func TestOutput_blank(t *testing.T) { |
| 158 | originalState := states.BuildState(func(s *states.SyncState) { |
nothing calls this directly
no test coverage detected