Skip to content

Commit

Permalink
added ut
Browse files Browse the repository at this point in the history
  • Loading branch information
lsm1 committed Feb 15, 2023
1 parent d4dc21a commit 425c536
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ int initArgs(String[] args) {
}
if (!commands.isEmpty()) {
for (Iterator<String> i = commands.iterator(); i.hasNext(); ) {
String command = HiveStringUtils.removeComments(i.next().toString());
String command = i.next().toString();
debug(loc("executing-command", command));
if (!dispatch(command)) {
code++;
Expand All @@ -193,4 +193,9 @@ int initArgs(String[] args) {
}
return code;
}

@Override
boolean dispatch(String line) {
return super.dispatch(HiveStringUtils.removeComments(line));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,13 @@ public void testKyuubiBeelineWithoutArgs() {
int result = kyuubiBeeLine.initArgs(new String[0]);
assertEquals(0, result);
}

@Test
public void testKyuubiBeelineComment() {
KyuubiBeeLine kyuubiBeeLine = new KyuubiBeeLine();
int result = kyuubiBeeLine.initArgsFromCliVars(new String[] { "-e", "--comment show database;" });
assertEquals(0, result);
result = kyuubiBeeLine.initArgsFromCliVars(new String[] {"-e", "--comment\n show database;" });
assertEquals(1, result);
}
}

0 comments on commit 425c536

Please sign in to comment.