|
26 | 26 | import cloud.commandframework.Command; |
27 | 27 | import cloud.commandframework.CommandManager; |
28 | 28 | import cloud.commandframework.annotations.parsers.Parser; |
| 29 | +import cloud.commandframework.annotations.specifier.Greedy; |
| 30 | +import cloud.commandframework.annotations.specifier.Quoted; |
29 | 31 | import cloud.commandframework.annotations.specifier.Range; |
30 | 32 | import cloud.commandframework.annotations.suggestions.Suggestions; |
31 | 33 | import cloud.commandframework.arguments.StaticArgument; |
|
37 | 39 | import cloud.commandframework.meta.SimpleCommandMeta; |
38 | 40 | import io.leangen.geantyref.TypeToken; |
39 | 41 |
|
40 | | -import java.util.ArrayList; |
41 | | -import java.util.HashSet; |
42 | | - |
43 | | -import java.util.Set; |
44 | | - |
45 | | -import org.junit.jupiter.api.Assertions; |
46 | | -import org.junit.jupiter.api.BeforeAll; |
47 | | -import org.junit.jupiter.api.Test; |
48 | | -import org.junit.jupiter.api.TestInstance; |
49 | | - |
50 | 42 | import java.lang.annotation.ElementType; |
51 | 43 | import java.lang.annotation.Retention; |
52 | 44 | import java.lang.annotation.RetentionPolicy; |
53 | 45 | import java.lang.annotation.Target; |
54 | 46 | import java.lang.reflect.Method; |
| 47 | +import java.util.ArrayList; |
55 | 48 | import java.util.Arrays; |
56 | 49 | import java.util.Collection; |
57 | 50 | import java.util.Collections; |
| 51 | +import java.util.HashSet; |
58 | 52 | import java.util.LinkedList; |
59 | 53 | import java.util.List; |
60 | 54 | import java.util.Queue; |
| 55 | +import java.util.Set; |
61 | 56 | import java.util.concurrent.CompletionException; |
62 | 57 | import java.util.function.BiFunction; |
63 | 58 |
|
| 59 | +import org.junit.jupiter.api.Assertions; |
| 60 | +import org.junit.jupiter.api.BeforeAll; |
| 61 | +import org.junit.jupiter.api.Test; |
| 62 | +import org.junit.jupiter.api.TestInstance; |
| 63 | + |
64 | 64 | @TestInstance(TestInstance.Lifecycle.PER_CLASS) |
65 | 65 | class AnnotationParserTest { |
66 | 66 |
|
@@ -107,6 +107,8 @@ void testMethodConstruction() { |
107 | 107 | manager.executeCommand(new TestCommandSender(), "test 101").join()); |
108 | 108 | manager.executeCommand(new TestCommandSender(), "flagcommand -p").join(); |
109 | 109 | manager.executeCommand(new TestCommandSender(), "flagcommand --print --word peanut").join(); |
| 110 | + manager.executeCommand(new TestCommandSender(), "parserflagcommand -s \"Hello World\"").join(); |
| 111 | + manager.executeCommand(new TestCommandSender(), "parserflagcommand -s \"Hello World\" -o This is a test").join(); |
110 | 112 | manager.executeCommand(new TestCommandSender(), "class method").join(); |
111 | 113 | } |
112 | 114 |
|
@@ -244,6 +246,15 @@ public void testFlags( |
244 | 246 | } |
245 | 247 | } |
246 | 248 |
|
| 249 | + @CommandMethod("parserflagcommand") |
| 250 | + public void testQuotedFlags( |
| 251 | + final TestCommandSender sender, |
| 252 | + @Flag(value = "sentence", aliases = "s") @Quoted final String sentence, |
| 253 | + @Flag(value = "other", aliases = "o") @Greedy final String otherStuff |
| 254 | + ) { |
| 255 | + System.out.println(sentence + (otherStuff == null ? "" : " " + otherStuff)); |
| 256 | + } |
| 257 | + |
247 | 258 | @CommandMethod("namedsuggestions <input>") |
248 | 259 | public void testNamedSuggestionProviders( |
249 | 260 | @Argument(value = "input", suggestions = "some-name") final String argument |
|
0 commit comments