You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/01/07 01:07:46 UTC

[GitHub] [hive] ujc714 commented on a change in pull request #1814: HIVE-15820: comment at the head of beeline -e

ujc714 commented on a change in pull request #1814:
URL: https://github.com/apache/hive/pull/1814#discussion_r553051915



##########
File path: beeline/src/test/org/apache/hive/beeline/TestCommands.java
##########
@@ -30,21 +30,35 @@
 
   @Test
   public void testLinesEndingWithComments() {
-    int[] escape = {-1};
-    assertEquals("show tables;", removeComments("show tables;",escape));
-    assertEquals("show tables;", removeComments("show tables; --comments",escape));
-    assertEquals("show tables;", removeComments("show tables; -------comments",escape));
-    assertEquals("show tables;", removeComments("show tables; -------comments;one;two;three;;;;",escape));
-    assertEquals("show", removeComments("show-- tables; -------comments",escape));
-    assertEquals("show", removeComments("show --tables; -------comments",escape));
-    assertEquals("s", removeComments("s--how --tables; -------comments",escape));
-    assertEquals("", removeComments("-- show tables; -------comments",escape));
+    assertEquals("show tables;", removeComments("show tables;"));
+    assertEquals("show tables;", removeComments("show tables; --comments"));
+    assertEquals("show tables;", removeComments("show tables; -------comments"));
+    assertEquals("show tables;", removeComments("show tables; -------comments;one;two;three;;;;"));
+    assertEquals("show", removeComments("show-- tables; -------comments"));
+    assertEquals("show", removeComments("show --tables; -------comments"));
+    assertEquals("s", removeComments("s--how --tables; -------comments"));
+    assertEquals("", removeComments("-- show tables; -------comments"));
 
-    assertEquals("\"show tables\"", removeComments("\"show tables\" --comments",escape));
-    assertEquals("\"show --comments tables\"", removeComments("\"show --comments tables\" --comments",escape));
-    assertEquals("\"'show --comments' tables\"", removeComments("\"'show --comments' tables\" --comments",escape));
-    assertEquals("'show --comments tables'", removeComments("'show --comments tables' --comments",escape));
-    assertEquals("'\"show --comments tables\"'", removeComments("'\"show --comments tables\"' --comments",escape));
+    assertEquals("\"show tables\"", removeComments("\"show tables\" --comments"));
+    assertEquals("\"show --comments tables\"", removeComments("\"show --comments tables\" --comments"));
+    assertEquals("\"'show --comments' tables\"", removeComments("\"'show --comments' tables\" --comments"));
+    assertEquals("'show --comments tables'", removeComments("'show --comments tables' --comments"));
+    assertEquals("'\"show --comments tables\"'", removeComments("'\"show --comments tables\"' --comments"));
+
+    assertEquals("show tables;", removeComments("--comments\nshow tables;"));
+    assertEquals("show tables;", removeComments("--comments\nshow tables; --comments"));
+    assertEquals("show tables;", removeComments("--comments\nshow tables; -------comments"));
+    assertEquals("show tables;", removeComments("--comments\nshow tables; -------comments;one;two;three;;;;"));
+    assertEquals("show", removeComments("--comments\nshow-- tables; -------comments"));
+    assertEquals("show", removeComments("--comments\nshow --tables; -------comments"));
+    assertEquals("s", removeComments("--comments\ns--how --tables; -------comments"));
+    assertEquals("", removeComments("--comments\n-- show tables; -------comments"));
+
+    assertEquals("\"show tables\"", removeComments("--comments\n\"show tables\" --comments"));
+    assertEquals("\"show --comments tables\"", removeComments("--comments\n\"show --comments tables\" --comments"));
+    assertEquals("\"'show --comments' tables\"", removeComments("--comments\n\"'show --comments' tables\" --comments"));
+    assertEquals("'show --comments tables'", removeComments("--comments\n'show --comments tables' --comments"));
+    assertEquals("'\"show --comments tables\"'", removeComments("--comments\n'\"show --comments tables\"' --comments"));

Review comment:
       Thanks for having a look! I added your example. It contains both separate comment lines and inline comment.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org