(t *testing.T)
| 23 | ) |
| 24 | |
| 25 | func TestFormatQuestion(t *testing.T) { |
| 26 | testCases := []struct { |
| 27 | question string |
| 28 | optimistic bool |
| 29 | expected string |
| 30 | }{ |
| 31 | { |
| 32 | question: "Are you sure?", |
| 33 | optimistic: false, |
| 34 | expected: "Are you sure? (y/N)", |
| 35 | }, |
| 36 | { |
| 37 | question: "Continue?", |
| 38 | optimistic: true, |
| 39 | expected: "Continue? (Y/n)", |
| 40 | }, |
| 41 | } |
| 42 | |
| 43 | for _, tc := range testCases { |
| 44 | t.Run(tc.question, func(t *testing.T) { |
| 45 | result := FormatQuestion(tc.question, tc.optimistic) |
| 46 | assert.Equal(t, result, tc.expected, "formatted question mismatch") |
| 47 | }) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func TestReadYesNo(t *testing.T) { |
| 52 | testCases := []struct { |
nothing calls this directly
no test coverage detected