|
9 | 9 | package mysql |
10 | 10 |
|
11 | 11 | import ( |
| 12 | + "bytes" |
12 | 13 | "fmt" |
13 | 14 | "testing" |
14 | | - "bytes" |
15 | 15 | "time" |
16 | 16 | ) |
17 | 17 |
|
@@ -57,11 +57,12 @@ func TestDSNParser(t *testing.T) { |
57 | 57 |
|
58 | 58 | func TestDSNParserInvalid(t *testing.T) { |
59 | 59 | var invalidDSNs = []string{ |
60 | | - "@net(addr/", // no closing brace |
61 | | - "@tcp(/", // no closing brace |
62 | | - "tcp(/", // no closing brace |
63 | | - "(/", // no closing brace |
64 | | - "net(addr)//", // unescaped |
| 60 | + "@net(addr/", // no closing brace |
| 61 | + "@tcp(/", // no closing brace |
| 62 | + "tcp(/", // no closing brace |
| 63 | + "(/", // no closing brace |
| 64 | + "net(addr)//", // unescaped |
| 65 | + "user:pass@tcp(1.2.3.4:3306)", // no trailing slash |
65 | 66 | //"/dbname?arg=/some/unescaped/path", |
66 | 67 | } |
67 | 68 |
|
@@ -126,8 +127,8 @@ func TestScanNullTime(t *testing.T) { |
126 | 127 |
|
127 | 128 | func TestLengthEncodedInteger(t *testing.T) { |
128 | 129 | var integerTests = []struct { |
129 | | - num uint64 |
130 | | - encoded []byte |
| 130 | + num uint64 |
| 131 | + encoded []byte |
131 | 132 | }{ |
132 | 133 | {0x0000000000000000, []byte{0x00}}, |
133 | 134 | {0x0000000000000012, []byte{0x12}}, |
@@ -155,10 +156,9 @@ func TestLengthEncodedInteger(t *testing.T) { |
155 | 156 | t.Errorf("%x: expected size %d, got %d", tst.encoded, len(tst.encoded), numLen) |
156 | 157 | } |
157 | 158 | encoded := appendLengthEncodedInteger(nil, num) |
158 | | - if (!bytes.Equal(encoded, tst.encoded)) { |
| 159 | + if !bytes.Equal(encoded, tst.encoded) { |
159 | 160 | t.Errorf("%v: expected %x, got %x", num, tst.encoded, encoded) |
160 | 161 | } |
161 | 162 | } |
162 | 163 |
|
163 | | - |
164 | 164 | } |
0 commit comments