[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 {
case "continue":
*ea = ErrorActionContinue
case "stop-job":
case "", "stop-job":
*ea = ErrorActionStopJob
case "stop-action":
*ea = ErrorActionStopAction

View file

@ -38,6 +38,16 @@ func TestErrorAction_UnmarshalYAML(t *testing.T) {
input: []byte(`E: `),
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",
input: []byte(`foo: bar`),