mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-29 22:37:17 +00:00
Improve error messages with additional colons (#1319)
This commit is contained in:
parent
79af31b672
commit
f16c1afed0
11 changed files with 144 additions and 144 deletions
|
|
@ -3116,7 +3116,7 @@ impl<'a> Parser<'a> {
|
|||
/// Report `found` was encountered instead of `expected`
|
||||
pub fn expected<T>(&self, expected: &str, found: TokenWithLocation) -> Result<T, ParserError> {
|
||||
parser_err!(
|
||||
format!("Expected {expected}, found: {found}"),
|
||||
format!("Expected: {expected}, found: {found}"),
|
||||
found.location
|
||||
)
|
||||
}
|
||||
|
|
@ -11581,7 +11581,7 @@ mod tests {
|
|||
assert_eq!(
|
||||
ast,
|
||||
Err(ParserError::TokenizerError(
|
||||
"Unterminated string literal at Line: 1, Column 5".to_string()
|
||||
"Unterminated string literal at Line: 1, Column: 5".to_string()
|
||||
))
|
||||
);
|
||||
}
|
||||
|
|
@ -11593,7 +11593,7 @@ mod tests {
|
|||
assert_eq!(
|
||||
ast,
|
||||
Err(ParserError::ParserError(
|
||||
"Expected [NOT] NULL or TRUE|FALSE or [NOT] DISTINCT FROM after IS, found: a at Line: 1, Column 16"
|
||||
"Expected: [NOT] NULL or TRUE|FALSE or [NOT] DISTINCT FROM after IS, found: a at Line: 1, Column: 16"
|
||||
.to_string()
|
||||
))
|
||||
);
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ impl fmt::Display for Location {
|
|||
write!(
|
||||
f,
|
||||
// TODO: use standard compiler location syntax (<path>:<line>:<col>)
|
||||
" at Line: {}, Column {}",
|
||||
" at Line: {}, Column: {}",
|
||||
self.line, self.column,
|
||||
)
|
||||
}
|
||||
|
|
@ -1816,7 +1816,7 @@ mod tests {
|
|||
use std::error::Error;
|
||||
assert!(err.source().is_none());
|
||||
}
|
||||
assert_eq!(err.to_string(), "test at Line: 1, Column 1");
|
||||
assert_eq!(err.to_string(), "test at Line: 1, Column: 1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue