[wip] error-action: added missing case for empty string

This commit is contained in:
Tigor Hutasuhut 2024-06-25 16:53:41 +07:00
parent b21b352923
commit f0feb88d5a
2 changed files with 11 additions and 1 deletions

View file

@ -30,7 +30,7 @@ func (ea *ErrorAction) UnmarshalYAML(value *yaml.Node) error {
switch lowered { switch lowered {
case "continue": case "continue":
*ea = ErrorActionContinue *ea = ErrorActionContinue
case "stop-job": case "", "stop-job":
*ea = ErrorActionStopJob *ea = ErrorActionStopJob
case "stop-action": case "stop-action":
*ea = ErrorActionStopAction *ea = ErrorActionStopAction

View file

@ -38,6 +38,16 @@ func TestErrorAction_UnmarshalYAML(t *testing.T) {
input: []byte(`E: `), input: []byte(`E: `),
want: ErrorActionStopJob, want: ErrorActionStopJob,
}, },
{
name: "whitespace only is stop-job",
input: []byte(`E: " "`),
want: ErrorActionStopJob,
},
{
name: "empty is stop-job",
input: []byte(`E: ""`),
want: ErrorActionStopJob,
},
{ {
name: "unset is stop-job 2", name: "unset is stop-job 2",
input: []byte(`foo: bar`), input: []byte(`foo: bar`),