mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[commands] Remove EndlessCommand (#4483)
This commit is contained in:
@@ -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()) {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user