From fa8248282367b3814d41f81acc195d05dff9f281 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Tue, 20 Sep 2011 03:41:07 +0200 Subject: [PATCH] Added a new test for get[Padded]Slice and renamed testHangingQuote to testUnmatchedQuote. --- .../util/commands/CommandContextTest.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java b/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java index 6763d887c..0e7ed73a1 100644 --- a/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java +++ b/src/test/java/com/sk89q/minecraft/util/commands/CommandContextTest.java @@ -81,7 +81,7 @@ public class CommandContextTest { } @Test - public void testHangingQuote() { + public void testUnmatchedQuote() { String cmd = "r \"hello goodbye have fun"; try { new CommandContext(cmd); @@ -131,4 +131,16 @@ public class CommandContextTest { fail("Error creating CommandContext"); } } + + @Test + public void testSlice() { + try { + CommandContext context = new CommandContext("foo bar baz"); + assertArrayEquals(new String[] { "foo", "bar", "baz" }, context.getSlice(0)); + + } catch (CommandException e) { + e.printStackTrace(); + fail("Error creating CommandContext"); + } + } }