(t *testing.T)
| 154 | } |
| 155 | |
| 156 | func TestGetCode(t *testing.T) { |
| 157 | err := NewError(ErrCodeUnexpectedToken, "test", models.Location{}) |
| 158 | |
| 159 | code := GetCode(err) |
| 160 | if code != ErrCodeUnexpectedToken { |
| 161 | t.Errorf("GetCode() = %v, want %v", code, ErrCodeUnexpectedToken) |
| 162 | } |
| 163 | |
| 164 | // Test with nil |
| 165 | code = GetCode(nil) |
| 166 | if code != "" { |
| 167 | t.Errorf("GetCode(nil) = %v, want empty string", code) |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func TestError_FormatContext(t *testing.T) { |
| 172 | tests := []struct { |