From ac97dbf2fac745bd3c465d1211510831e822be90 Mon Sep 17 00:00:00 2001 From: Ryan Chandler Date: Fri, 16 Sep 2022 10:28:16 +0100 Subject: [PATCH] parser: test variable variable method calls --- trunk_parser/src/parser/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/trunk_parser/src/parser/mod.rs b/trunk_parser/src/parser/mod.rs index ca0693f..acbd5e2 100644 --- a/trunk_parser/src/parser/mod.rs +++ b/trunk_parser/src/parser/mod.rs @@ -4259,6 +4259,20 @@ mod tests { ); } + #[test] + fn variable_variable_method_calls() { + assert_ast( + "$$b;", + &[expr!(Expression::MethodCall { + target: Box::new(Expression::Variable { name: "a".into() }), + method: Box::new(Expression::DynamicVariable { + name: Box::new(Expression::Variable { name: "b".into() }) + }), + args: vec![] + })], + ); + } + fn assert_ast(source: &str, expected: &[Statement]) { let mut lexer = Lexer::new(None); let tokens = lexer.tokenize(source).unwrap();