mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
fix a couple tests
This commit is contained in:
parent
8331851d97
commit
4626bd45cd
2 changed files with 10 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::{cmp, rc::Rc};
|
||||
use std::{cmp, fmt, rc::Rc};
|
||||
|
||||
use super::builtin_exceptions::BuiltInExceptions;
|
||||
use crate::message::Message;
|
||||
|
@ -80,3 +80,9 @@ impl CommandSyntaxException {
|
|||
self.cursor
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for CommandSyntaxException {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.message())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ impl StringReader<'_> {
|
|||
|
||||
pub fn read_unquoted_string(&mut self) -> &str {
|
||||
let start = self.cursor;
|
||||
while self.can_read() && StringReader::<'_>::is_allowed_in_unquoted_string(self.peek()) {
|
||||
while self.can_read() && StringReader::is_allowed_in_unquoted_string(self.peek()) {
|
||||
self.skip();
|
||||
}
|
||||
&self.string[start..self.cursor]
|
||||
|
@ -395,7 +395,7 @@ mod test {
|
|||
let mut reader = StringReader::from("hello world");
|
||||
assert_eq!(reader.read_unquoted_string(), "hello");
|
||||
assert_eq!(reader.get_read(), "hello");
|
||||
assert_eq!(reader.remaining(), "world");
|
||||
assert_eq!(reader.remaining(), " world");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -417,7 +417,7 @@ mod test {
|
|||
#[test]
|
||||
fn read_quoted_string() {
|
||||
let mut reader = StringReader::from("\"hello world\"");
|
||||
assert_eq!(reader.read_unquoted_string(), "hello world");
|
||||
assert_eq!(reader.read_quoted_string().unwrap(), "hello world");
|
||||
assert_eq!(reader.get_read(), "\"hello world\"");
|
||||
assert_eq!(reader.remaining(), "");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue