diff --git a/src/parse/import.rs b/src/parse/import.rs index 24e37bf..5a7380d 100644 --- a/src/parse/import.rs +++ b/src/parse/import.rs @@ -14,7 +14,7 @@ impl<'a> Parser<'a> { let mut file_name = String::new(); let next = match self.toks.next() { Some(v) => v, - None => todo!("expected input after @import"), + None => return Err(("expected more input.", self.span_before).into()), }; match next.kind { q @ '"' | q @ '\'' => { diff --git a/tests/imports.rs b/tests/imports.rs index 64e5a2d..36bd3b3 100644 --- a/tests/imports.rs +++ b/tests/imports.rs @@ -1,6 +1,10 @@ +#![cfg(test)] use std::io::Write; use tempfile::Builder; +#[macro_use] +mod macros; + /// Create a temporary file with the given name /// 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`