From f6bc957a02c6eedc76a3a89a843acf63d3cbb23d Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Sun, 24 Mar 2024 22:01:41 +0100 Subject: [PATCH] Test identifier formatting --- .../io/trino/sql/TestExpressionFormatter.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/core/trino-parser/src/test/java/io/trino/sql/TestExpressionFormatter.java b/core/trino-parser/src/test/java/io/trino/sql/TestExpressionFormatter.java index 3fbd3bf56f44..be452f97adb7 100644 --- a/core/trino-parser/src/test/java/io/trino/sql/TestExpressionFormatter.java +++ b/core/trino-parser/src/test/java/io/trino/sql/TestExpressionFormatter.java @@ -15,6 +15,7 @@ import io.trino.sql.tree.Expression; import io.trino.sql.tree.GenericLiteral; +import io.trino.sql.tree.Identifier; import io.trino.sql.tree.IntervalLiteral; import io.trino.sql.tree.StringLiteral; import org.junit.jupiter.api.Test; @@ -30,6 +31,20 @@ public class TestExpressionFormatter { + @Test + public void testIdentifier() + { + assertFormattedExpression( + new Identifier("abc"), + "abc"); + assertFormattedExpression( + new Identifier("with a space"), + "\"with a space\""); + assertFormattedExpression( + new Identifier("with \" quote, $ dollar and ' apostrophe"), + "\"with \"\" quote, $ dollar and ' apostrophe\""); + } + @Test public void testStringLiteral() {