iffyio commented on code in PR #1811: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1811#discussion_r2046111411
########## tests/sqlparser_mssql.rs: ########## @@ -2053,3 +2053,37 @@ fn parse_drop_trigger() { } ); } + +#[test] +fn parse_print() { + let print_string_literal = "PRINT 'Hello, world!'"; + let print_stmt = ms().one_statement_parses_to(print_string_literal, ""); + assert_eq!( + print_stmt, + Statement::Print(PrintStatement { + message: Box::new(Expr::Value( + (Value::SingleQuotedString("Hello, world!".to_string())).with_empty_span() + )), + }) + ); + + let print_national_string = "PRINT N'Hello, ⛄️!'"; + let print_stmt = ms().one_statement_parses_to(print_national_string, ""); + assert_eq!( + print_stmt, + Statement::Print(PrintStatement { + message: Box::new(Expr::Value( + (Value::NationalStringLiteral("Hello, ⛄️!".to_string())).with_empty_span() + )), + }) + ); + + let print_variable = "PRINT @my_variable"; + let print_stmt = ms().one_statement_parses_to(print_variable, ""); + assert_eq!( + print_stmt, + Statement::Print(PrintStatement { + message: Box::new(Expr::Identifier(Ident::new("@my_variable"))), + }) + ); Review Comment: oh was there a requirement to use `one_statement_parses_to` instead of `verified_stmt` for these tests? Also with vierified_stmt we can simplify the tests except, for the hello world example, to skip assertion on the AST -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org