8000 MapArgument feature expansion by willkroboth · Pull Request #455 · CommandAPI/CommandAPI · GitHub
[go: up one dir, main page]

Skip to content

MapArgument feature expansion #455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
7d69d1c
Implement optional quoting for MapArgument
willkroboth May 21, 2023
a1232df
Update MapArgument tests
willkroboth May 21, 2023
a2c96b1
Tweak error message when parsed key is missing delimiter, but is also…
willkroboth May 21, 2023
f05438d
Address some SonarCloud code smells for MapArgument
willkroboth May 22, 2023
3332866
Throw exception when map key is missing after separator
willkroboth May 22, 2023
2887cc6
Adjust map terminator finder logic
willkroboth May 27, 2023
7b3ca51
Update MapArgument execution tests for new features
willkroboth May 27, 2023
fb76743
Give MapArgument tests default visibility
willkroboth May 28, 2023
02c59f5
Extract MapArgument#doseTerminatorContinue logic
willkroboth May 28, 2023
9aa6c84
Further extract MapArgument#doseTerminatorContinue logic
willkroboth May 28, 2023
98ebe1b
8000 Fix escape characters in empty suggestions
willkroboth May 29, 2023
ab7564f
Update MapArgument execution tests for new features
willkroboth May 30, 2023
452d9d9
Automatic formatting cleanup
willkroboth May 30, 2023
72fd6e8
Move StringParser to commandapi-core
willkroboth Jun 5, 2023
35b1286
Add javadocs to StringParser
willkroboth Jun 5, 2023
2cf5083
Update argument_map.md documentation
willkroboth Jun 5, 2023
2e4bcfe
Add note for deprecated char delimiter MapArgumentBuilder constructor…
willkroboth Jun 5, 2023
6b4e6d2
Disable MD038 (no empty spaces in code) for a line.
JorelAli Jun 5, 2023
c001ac7
Fix trailing space in argument_map.md
JorelAli Jun 5, 2023
72c7cd9
Throw exception when delimiter/separator are empty Strings
willkroboth Jun 5, 2023
0f22be8
Only allow constructing the MapArgument with char delimiters
willkroboth Jun 5, 2023
aa044ef
Remove String delimiters from ArgumentMapTests
willkroboth Jun 5, 2023
744a40e
Remove String delimiters from MapArgument documentation
willkroboth Jun 5, 2023
f1dadf9
Fix typo in argument_map.md
willkroboth Jun 6, 2023
ef1292a
Throw IllegalArgumentException when MapArgument separator is null
willkroboth Jun 8, 2023
9ed3f7b
Fix dose-does typo in MapArgument comments
willkroboth Jun 8, 2023
1c896bb
Remove `while(true)` loops from MapArgument
willkroboth Jun 8, 2023
0353b97
Revise wording in argument_map.md
willkroboth Jun 8, 2023
05002bf
Reword javadocs for MapArgumentBuilder key/value list methods
willkroboth Jun 8, 2023
a511a96
Add MapArgument changes to global changelog
willkroboth Jun 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update MapArgument execution tests for new features
  • Loading branch information
willkroboth committed Jun 8, 2023
commit ab7564fc72c6af8d1831f0831a6d55ef7b1530b8
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,35 @@ public boolean suggestionEquals(Suggestion suggestion1, Suggestion suggestion2)
&& suggestion1.getTooltip().getString().equals(suggestion2.getTooltip().getString());
}

public void assertSuggestionListEquals(List<Suggestion> list1, List<Suggestion> list2) {
if (list1.size() != list2.size()) {
throw new AssertionFailedError("List " + list1 + " and " + list2 + " have differing lengths");
public void assertSuggestionListEquals(List<Suggestion> expected, List<Suggestion> actual) {
if (expected.size() != actual.size()) {
throw new AssertionFailedError("List " + expected + " and " + actual + " have differing lengths");
}
for (int i = 0; i < list1.size(); i++) {
if(!suggestionEquals(list1.get(i), list2.get(i))) {
throw new AssertionFailedError("Expected: <" + list1 + "> but was: <" + list2 + ">");
for (int i = 0; i < expected.size(); i++) {
if(!suggestionEquals(expected.get(i), actual.get(i))) {
throw new AssertionFailedError("Expected: <" + expected + "> but was: <" + actual + ">");
}
}
}

public void assertNoSuggestions(CommandSender sender, String command) {
List<Suggestion> suggestions = server.getSuggestionsWithTooltips(sender, command);
if(suggestions.size() != 0) throw new AssertionFailedError("Expected no suggestions, but found <" + suggestions + ">");
}

public void assertCommandSuggests(CommandSender sender, String command, String... expected) {
assertCommandSuggests(sender, command, List.of(expected));
}

public void assertCommandSuggests(CommandSender sender, String command, List<String> expected) {
assertEquals(expected, server.getSuggestions(sender, command));
}

public void assertCommandSuggestsTooltips(CommandSender sender, String command, Suggestion... expected) {
assertCommandSuggestsTooltips(sender, command, List.of(expected));
}

public void assertCommandSuggestsTooltips(CommandSender sender, String command, List<Suggestion> expected) {
assertSuggestionListEquals(expected, server.getSuggestionsWithTooltips(sender, command));
}
}
Loading
0