mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 13:57:09 +01:00
Correct behavior for test cases with slashes
This commit is contained in:
parent
34f1c566ff
commit
a0398fb7dd
7 changed files with 228 additions and 78 deletions
|
|
@ -48,16 +48,21 @@ func TestSkipped(t *testing.T) {
|
|||
func TestCases(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name string
|
||||
fn func(int, int) int
|
||||
a, b, c int
|
||||
}{
|
||||
{"1 + 2 = 3", 1, 2, 3},
|
||||
{"4 + 7 = 11", 4, 7, 11},
|
||||
{"2 + 3 = 4", 2, 3, 4},
|
||||
{"1 + 2 = 3", CalculatorSum, 1, 2, 3},
|
||||
{"4 + 7 = 11", CalculatorSum, 4, 7, 11},
|
||||
{"2 + 3 = 4", CalculatorSum, 2, 3, 4},
|
||||
|
||||
{"1 / 2 = 1", CalculatorDivide, 1, 2, 1},
|
||||
{"9 / 3 = 3", CalculatorDivide, 9, 3, 3},
|
||||
{"14 / 7 = 2", CalculatorDivide, 14, 7, 2},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
randomSleep()
|
||||
|
||||
c := CalculatorSum(tc.a, tc.b)
|
||||
c := tc.fn(tc.a, tc.b)
|
||||
if c != tc.c {
|
||||
t.Fatalf("expected %s, got %d", tc.name, c)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue