remove panic on malformed @import

This commit is contained in:
Connor Skees 2020-07-06 12:55:34 -04:00
parent 60c9327cf3
commit 2fa1804ccd
2 changed files with 10 additions and 1 deletions

View File

@ -14,7 +14,7 @@ impl<'a> Parser<'a> {
let mut file_name = String::new(); let mut file_name = String::new();
let next = match self.toks.next() { let next = match self.toks.next() {
Some(v) => v, Some(v) => v,
None => todo!("expected input after @import"), None => return Err(("expected more input.", self.span_before).into()),
}; };
match next.kind { match next.kind {
q @ '"' | q @ '\'' => { q @ '"' | q @ '\'' => {

View File

@ -1,6 +1,10 @@
#![cfg(test)]
use std::io::Write; use std::io::Write;
use tempfile::Builder; use tempfile::Builder;
#[macro_use]
mod macros;
/// Create a temporary file with the given name /// Create a temporary file with the given name
/// and contents. /// and contents.
/// ///
@ -132,4 +136,9 @@ fn chained_imports_in_directory() {
); );
} }
error!(
missing_input_after_import,
"@import", "Error: expected more input."
);
// todo: test for calling paths, e.g. `grass b\index.scss` // todo: test for calling paths, e.g. `grass b\index.scss`