[commands] Remove EndlessCommand (#4483)

This commit is contained in:
Starlight220
2022-10-21 03:24:54 +03:00
committed by GitHub
parent 16cdc741cf
commit dc037f8d41
16 changed files with 44 additions and 289 deletions

View File

@@ -201,22 +201,6 @@ class CommandDecoratorTest extends CommandTestBase {
}
}
@Test
void endlesslyTest() {
try (CommandScheduler scheduler = new CommandScheduler()) {
Command command = new InstantCommand();
Command perpetual = command.endlessly();
scheduler.schedule(perpetual);
scheduler.run();
scheduler.run();
scheduler.run();
assertTrue(scheduler.isScheduled(perpetual));
}
}
@Test
void unlessTest() {
try (CommandScheduler scheduler = new CommandScheduler()) {

View File

@@ -1,23 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj2.command;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
class EndlessCommandTest extends CommandTestBase {
@Test
void endlessCommandScheduleTest() {
try (CommandScheduler scheduler = new CommandScheduler()) {
EndlessCommand command = new EndlessCommand(new InstantCommand());
scheduler.schedule(command);
scheduler.run();
assertTrue(scheduler.isScheduled(command));
}
}
}

View File

@@ -137,8 +137,8 @@ class ParallelRaceGroupTest extends CommandTestBase {
Command command1 = command1Holder.getMock();
MockCommandHolder command2Holder = new MockCommandHolder(true, system2);
Command command2 = command2Holder.getMock();
MockCommandHolder endlessCommandHolder = new MockCommandHolder(true);
Command command3 = new EndlessCommand(endlessCommandHolder.getMock());
MockCommandHolder command3Holder = new MockCommandHolder(true);
Command command3 = command3Holder.getMock();
Command group1 = new SequentialCommandGroup(command1, command2);
assertNotNull(group1);
@@ -153,6 +153,7 @@ class ParallelRaceGroupTest extends CommandTestBase {
command2Holder.setFinished(true);
// at this point the sequential group should be done
assertDoesNotThrow(() -> scheduler.run());
assertFalse(scheduler.isScheduled(group2));
}
}

View File

@@ -36,7 +36,7 @@ class ScheduleCommandTest extends CommandTestBase {
new SequentialCommandGroup(new InstantCommand(), scheduleCommand);
scheduler.schedule(group);
scheduler.schedule(new InstantCommand().endlessly());
scheduler.schedule(new RunCommand(() -> {}));
scheduler.run();
assertDoesNotThrow(scheduler::run);
}