[wip] error-action: added invalid test case
This commit is contained in:
parent
f0feb88d5a
commit
0ad2e1a1e1
|
@ -12,6 +12,7 @@ func TestErrorAction_UnmarshalYAML(t *testing.T) {
|
|||
name string
|
||||
input []byte
|
||||
want ErrorAction
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "continue",
|
||||
|
@ -63,6 +64,11 @@ func TestErrorAction_UnmarshalYAML(t *testing.T) {
|
|||
input: []byte(`E: stop-run`),
|
||||
want: ErrorActionStopRun,
|
||||
},
|
||||
{
|
||||
name: "error on invalid value",
|
||||
input: []byte(`E: invalid`),
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
type placeholder struct {
|
||||
E ErrorAction `yaml:"E"`
|
||||
|
@ -71,6 +77,10 @@ func TestErrorAction_UnmarshalYAML(t *testing.T) {
|
|||
t.Run(tt.name, func(t *testing.T) {
|
||||
var placeholder placeholder
|
||||
err := yaml.Unmarshal(tt.input, &placeholder)
|
||||
if tt.wantErr {
|
||||
assert.Error(t, err)
|
||||
return
|
||||
}
|
||||
if !assert.NoError(t, err) {
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue