From 92675b5b1b25dda8c7687c27f01bb6557f1c64f9 Mon Sep 17 00:00:00 2001 From: Rogier Reerink Date: Sun, 15 Nov 2026 12:02:51 +0100 Subject: [PATCH] More tests. --- src/parser.rs | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index 64b0794..06141c5 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -413,7 +413,7 @@ mod tests { ); pretty_assertions::assert_eq!(parser.next(), None); - let input = "f(x, y)"; + let input = "f(x, 500.0, \"hello\", g(x))"; let lexer = Lexer::new(input); let mut parser = Parser::new(input, lexer); pretty_assertions::assert_eq!( @@ -428,12 +428,33 @@ mod tests { name: "x".to_string(), span: Span::new(2, 3), }), - Expr::Variable(Ident { - name: "y".to_string(), - span: Span::new(5, 6), - }), + Expr::Literal( + LitNumber { + value: 500.0, + span: Span::new(5, 10), + } + .into() + ), + Expr::Literal( + LitString { + value: "hello".to_string(), + span: Span::new(12, 19), + } + .into() + ), + Expr::FnCall(FnCall { + name: Ident { + name: "g".to_string(), + span: Span::new(21, 22), + }, + args: vec![Expr::Variable(Ident { + name: "x".to_string(), + span: Span::new(23, 24), + })], + span: Span::new(21, 25), + }) ], - span: Span::new(0, 7), + span: Span::new(0, 26), })) ); pretty_assertions::assert_eq!(parser.next(), None);