Fixed bug with wands and updated tests

This commit is contained in:
MattBDev
2019-09-18 15:09:04 -04:00
parent 4357c4b049
commit 3bcfcd3008
7 changed files with 92 additions and 18 deletions

View File

@ -54,7 +54,7 @@ public class CommandContextTest {
public void testInvalidFlags() {
final String failingCommand = "herpderp -opw testers";
assertThrows(CommandException.class, () -> {
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
new CommandContext(failingCommand, new HashSet<>(Arrays.asList('o', 'w')));
});
}

View File

@ -24,9 +24,9 @@ import com.sk89q.worldedit.math.transform.Transform;
import com.sk89q.worldedit.world.block.BlockType;
import java.util.HashSet;
import java.util.Set;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled("A platform is currently required to get properties, preventing this test.")
public class BlockTransformExtentTest {
@ -37,7 +37,7 @@ public class BlockTransformExtentTest {
@BeforeEach
public void setUp() {
// BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
//BlockType.REGISTRY.register("worldedit:test", new BlockType("worldedit:test"));
}
@Test

View File

@ -0,0 +1,58 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.internal.command;
import com.google.common.collect.ImmutableList;
import com.sk89q.worldedit.internal.util.Substring;
import org.junit.jupiter.api.Test;
import java.util.List;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
class CommandArgParserTest {
private static List<Substring> argParse(String s) {
return CommandArgParser.forArgString(s).parseArgs().collect(Collectors.toList());
}
@Test
void testArgumentParsing() {
assertEquals(ImmutableList.of(
Substring.wrap("", 0, 0)
), argParse(""));
assertEquals(ImmutableList.of(
Substring.wrap("ab", 0, 2)
), argParse("ab"));
assertEquals(ImmutableList.of(
Substring.wrap("", 0, 0),
Substring.wrap("", 1, 1)
), argParse(" "));
assertEquals(ImmutableList.of(
Substring.wrap("a", 0, 1),
Substring.wrap("", 2, 2)
), argParse("a "));
assertEquals(ImmutableList.of(
Substring.wrap("a", 0, 1),
Substring.wrap("b", 2, 3)
), argParse("a b"));
}
}

View File

@ -19,12 +19,12 @@
package com.sk89q.worldedit.util;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.world.World;
import org.junit.Test;
import org.junit.jupiter.api.Test;
/**
* Tests {@link Location}.