| 38 | } |
| 39 | |
| 40 | func TestInvalidValueError(t *testing.T) { |
| 41 | expectedCause := errors.New("error") |
| 42 | err := &InvalidValueError{ |
| 43 | flag: &Flag{}, |
| 44 | value: "foo", |
| 45 | cause: expectedCause, |
| 46 | } |
| 47 | |
| 48 | if err.GetFlag() == nil { |
| 49 | t.Error("Expected GetSpecifiedName to return its flag field, but got nil") |
| 50 | } |
| 51 | if err.GetValue() != "foo" { |
| 52 | t.Errorf("Expected GetValue to return %q, got %q", "foo", err.GetValue()) |
| 53 | } |
| 54 | if err.Unwrap() != expectedCause { |
| 55 | t.Errorf("Expected Unwrwap to return %q, got %q", expectedCause, err.Unwrap()) |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | func TestInvalidSyntaxError(t *testing.T) { |
| 60 | err := &InvalidSyntaxError{ |