(t *testing.T)
| 231 | } |
| 232 | |
| 233 | func TestIsolationLevelMapping(t *testing.T) { |
| 234 | data := []struct { |
| 235 | level driver.IsolationLevel |
| 236 | expected string |
| 237 | }{ |
| 238 | { |
| 239 | level: driver.IsolationLevel(sql.LevelReadCommitted), |
| 240 | expected: "READ COMMITTED", |
| 241 | }, |
| 242 | { |
| 243 | level: driver.IsolationLevel(sql.LevelRepeatableRead), |
| 244 | expected: "REPEATABLE READ", |
| 245 | }, |
| 246 | { |
| 247 | level: driver.IsolationLevel(sql.LevelReadUncommitted), |
| 248 | expected: "READ UNCOMMITTED", |
| 249 | }, |
| 250 | { |
| 251 | level: driver.IsolationLevel(sql.LevelSerializable), |
| 252 | expected: "SERIALIZABLE", |
| 253 | }, |
| 254 | } |
| 255 | |
| 256 | for i, td := range data { |
| 257 | if actual, err := mapIsolationLevel(td.level); actual != td.expected || err != nil { |
| 258 | t.Fatal(i, td.expected, actual, err) |
| 259 | } |
| 260 | } |
| 261 | |
| 262 | // check unsupported mapping |
| 263 | expectedErr := "mysql: unsupported isolation level: 7" |
| 264 | actual, err := mapIsolationLevel(driver.IsolationLevel(sql.LevelLinearizable)) |
| 265 | if actual != "" || err == nil { |
| 266 | t.Fatal("Expected error on unsupported isolation level") |
| 267 | } |
| 268 | if err.Error() != expectedErr { |
| 269 | t.Fatalf("Expected error to be %q, got %q", expectedErr, err) |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | func TestAppendDateTime(t *testing.T) { |
| 274 | tests := []struct { |
nothing calls this directly
no test coverage detected