(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func TestInvalidNumberError(t *testing.T) { |
| 63 | sql := "SELECT * FROM users WHERE age > 18.45.6" |
| 64 | location := models.Location{Line: 1, Column: 33} |
| 65 | |
| 66 | err := InvalidNumberError("18.45.6", location, sql) |
| 67 | |
| 68 | if err.Code != ErrCodeInvalidNumber { |
| 69 | t.Errorf("InvalidNumberError() code = %v, want %v", err.Code, ErrCodeInvalidNumber) |
| 70 | } |
| 71 | |
| 72 | output := err.Error() |
| 73 | if !strings.Contains(output, "invalid numeric literal") { |
| 74 | t.Errorf("Error should mention invalid numeric literal, got: %s", output) |
| 75 | } |
| 76 | if !strings.Contains(output, "18.45.6") { |
| 77 | t.Errorf("Error should include the invalid number, got: %s", output) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestUnexpectedTokenError(t *testing.T) { |
| 82 | sql := "SELECT * FORM users" |
nothing calls this directly
no test coverage detected