Skip to content

Commit af37082

Browse files
committed
fix one wrong change
Signed-off-by: lance6716 <[email protected]>
1 parent 466a5f5 commit af37082

File tree

1 file changed

+1
-45
lines changed

1 file changed

+1
-45
lines changed

replication/row_event_test.go

+1-45
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,14 @@
11
package replication
22

33
import (
4-
"fmt"
54
"testing"
65

7-
"github.com/pingcap/errors"
86
"github.com/shopspring/decimal"
97
"github.com/stretchr/testify/require"
108

119
"github.com/go-mysql-org/go-mysql/mysql"
1210
)
1311

14-
func check(params []interface{}, names []string) error {
15-
var test int
16-
val := struct {
17-
Value decimal.Decimal
18-
Pos int
19-
Err error
20-
EValue decimal.Decimal
21-
EPos int
22-
EErr error
23-
}{}
24-
25-
for i, name := range names {
26-
switch name {
27-
case "obtainedValue":
28-
val.Value, _ = params[i].(decimal.Decimal)
29-
case "obtainedPos":
30-
val.Pos, _ = params[i].(int)
31-
case "obtainedErr":
32-
val.Err, _ = params[i].(error)
33-
case "expectedValue":
34-
val.EValue, _ = params[i].(decimal.Decimal)
35-
case "expectedPos":
36-
val.EPos, _ = params[i].(int)
37-
case "expectedErr":
38-
val.EErr, _ = params[i].(error)
39-
case "caseNumber":
40-
test = params[i].(int)
41-
}
42-
}
43-
errorMsgFmt := fmt.Sprintf("For Test %v: ", test) + "Did not get expected %v(%v), got %v instead."
44-
if val.Err != val.EErr {
45-
return errors.Errorf(errorMsgFmt, "error", val.EErr, val.Err)
46-
}
47-
if val.Pos != val.EPos {
48-
return errors.Errorf(errorMsgFmt, "position", val.EPos, val.Pos)
49-
}
50-
if !val.Value.Equal(val.EValue) {
51-
return errors.Errorf(errorMsgFmt, "value", val.EValue, val.Value)
52-
}
53-
return nil
54-
}
55-
5612
func TestDecodeDecimal(t *testing.T) {
5713
// _PLACEHOLDER_ := 0
5814
testcases := []struct {
@@ -1180,7 +1136,7 @@ func TestInvalidEvent(t *testing.T) {
11801136
e2.tables = map[uint64]*TableMapEvent{}
11811137
e2.tables[0x140] = table
11821138
err := e2.Decode([]byte(data))
1183-
require.NoError(t, err)
1139+
require.Error(t, err)
11841140
}
11851141

11861142
func TestDecodeTime2(t *testing.T) {

0 commit comments

Comments
 (0)