mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
Add lots of tests
This commit is contained in:
parent
fdb9f06880
commit
94796e6447
3 changed files with 125 additions and 6 deletions
|
@ -34,6 +34,10 @@ impl SyntaxError {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> SyntaxErrorKind {
|
||||
self.kind.clone()
|
||||
}
|
||||
|
||||
pub fn location(&self) -> Location {
|
||||
self.location.clone()
|
||||
}
|
||||
|
@ -64,6 +68,7 @@ impl fmt::Display for SyntaxError {
|
|||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum SyntaxErrorKind {
|
||||
ParseError(ParseError),
|
||||
UnescapedCodepoint,
|
||||
EmptyChar,
|
||||
UnclosedChar,
|
||||
LongChar,
|
||||
|
@ -86,6 +91,7 @@ impl fmt::Display for SyntaxErrorKind {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
use self::SyntaxErrorKind::*;
|
||||
match self {
|
||||
UnescapedCodepoint => write!(f, "This codepoint should always be escaped"),
|
||||
EmptyAsciiEscape => write!(f, "Empty escape sequence"),
|
||||
InvalidAsciiEscape => write!(f, "Invalid escape sequence"),
|
||||
EmptyChar => write!(f, "Empty char literal"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue