From 38fef28c84b8436b1ebf90be5724751c364fe5c2 Mon Sep 17 00:00:00 2001 From: JT Date: Mon, 9 Aug 2021 09:55:18 +1200 Subject: [PATCH] Add subcommand test --- src/parser.rs | 1 + src/tests.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/parser.rs b/src/parser.rs index a8598eef5b..12e4821af6 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -805,6 +805,7 @@ impl<'a> ParserWorkingSet<'a> { Some(ParseError::UnknownCommand(spans[0])), ); } + let name = self.get_span_contents(spans[pos]); pos += 1; diff --git a/src/tests.rs b/src/tests.rs index e726beac06..9e130394db 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -133,3 +133,8 @@ fn env_shorthand() -> TestResult { fn floating_add() -> TestResult { run_test("10.1 + 0.8", "10.9") } + +#[test] +fn subcommand() -> TestResult { + run_test("def foo [] {}; def \"foo bar\" [] {3}; foo bar", "3") +}