Skip to content

Commit

Permalink
fix 0131db8
Browse files Browse the repository at this point in the history
  • Loading branch information
Librazy committed Feb 15, 2019
1 parent 7f4090b commit 8b3c565
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main/java/cat/nyaa/nyaacore/CommandReceiver.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,10 @@ private Arguments(CommandSender sender) {
this.sender = sender;
}

public static Arguments parse(String[] rawArg) {
return parse(rawArg, null);
}

public static Arguments parse(String[] rawArg, CommandSender sender) {
if (rawArg.length == 0) return new Arguments(sender);
String cmd = rawArg[0];
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/cat/nyaa/nyaacore/ArgumentsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class ArgumentsTest {
@Test
public void test1() throws Exception {
String cmd = "`foo bar` far `bar \\`foo`";
CommandReceiver.Arguments arg = CommandReceiver.Arguments.parse(cmd.split(" "), null);
CommandReceiver.Arguments arg = CommandReceiver.Arguments.parse(cmd.split(" "));
assertNotNull(arg);
assertEquals("foo bar", arg.nextString());
assertEquals("far", arg.nextString());
Expand All @@ -34,7 +34,7 @@ public void test2() throws Exception {
@Test
public void test3() throws Exception {
String cmd = "t w key:`3` key2:`/co l u:miu_bug` ke3y:`12`";
CommandReceiver.Arguments arg = CommandReceiver.Arguments.parse(cmd.split(" "), null);
CommandReceiver.Arguments arg = CommandReceiver.Arguments.parse(cmd.split(" "));
assertNotNull(arg);
assertEquals(3, arg.argInt("key"));
assertEquals("/co l u:miu_bug", arg.argString("key2"));
Expand Down

0 comments on commit 8b3c565

Please sign in to comment.