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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]