(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestNegativeString(t *testing.T) { |
| 56 | tests := map[string]struct { |
| 57 | input string |
| 58 | output AllNegative |
| 59 | }{ |
| 60 | "unknown": { |
| 61 | input: `Unknown`, |
| 62 | output: AllNegativeUnknown, |
| 63 | }, |
| 64 | "good": { |
| 65 | input: `Good`, |
| 66 | output: AllNegativeGood, |
| 67 | }, |
| 68 | "bad": { |
| 69 | input: `Bad`, |
| 70 | output: AllNegativeBad, |
| 71 | }, |
| 72 | "ugly": { |
| 73 | input: `Ugly`, |
| 74 | output: AllNegativeUgly, |
| 75 | }, |
| 76 | } |
| 77 | |
| 78 | for name, tc := range tests { |
| 79 | t.Run(name, func(t *testing.T) { |
| 80 | output, err := ParseAllNegative(tc.input) |
| 81 | assert.NoError(t, err) |
| 82 | assert.Equal(t, tc.output, output) |
| 83 | |
| 84 | assert.Equal(t, tc.input, output.String()) |
| 85 | }) |
| 86 | } |
| 87 | |
| 88 | t.Run("failures", func(t *testing.T) { |
| 89 | assert.Equal(t, "AllNegative(99)", AllNegative(99).String()) |
| 90 | allN, err := ParseAllNegative("") |
| 91 | assert.Error(t, err) |
| 92 | |
| 93 | assert.Equal(t, AllNegative(0), allN) |
| 94 | }) |
| 95 | t.Run("cased", func(t *testing.T) { |
| 96 | actual, err := ParseAllNegative("UGLY") |
| 97 | assert.NoError(t, err) |
| 98 | assert.Equal(t, AllNegativeUgly, actual) |
| 99 | }) |
| 100 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…