From 849a8b4414163e6102b781879bc4c9e0571517b9 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Wed, 19 Aug 2020 03:14:33 -0400 Subject: [PATCH] resolve `todo!()` on malformed `@use` missing string --- src/parse/module.rs | 4 +++- tests/use.rs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parse/module.rs b/src/parse/module.rs index f6a056b..4a2a9ae 100644 --- a/src/parse/module.rs +++ b/src/parse/module.rs @@ -186,7 +186,9 @@ impl<'a> Parser<'a> { let quote = match self.toks.next() { Some(Token { kind: q @ '"', .. }) | Some(Token { kind: q @ '\'', .. }) => q, - Some(..) | None => todo!(), + Some(..) | None => { + return Err(("Expected string.", self.span_before).into()) + } }; let Spanned { node: module, span } = self.parse_quoted_string(quote)?; diff --git a/tests/use.rs b/tests/use.rs index c1017da..65b32b4 100644 --- a/tests/use.rs +++ b/tests/use.rs @@ -38,6 +38,10 @@ error!( module_function_missing_open_parens, "@use \"sass:math\";\na { color: math.floor; }", "Error: expected \"(\"." ); +error!( + module_not_quoted_string, + "@use a", "Error: Expected string." +); test!( use_as, "@use \"sass:math\" as foo;