mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
[command] Add ignoringDisable decorator (#4305)
This commit is contained in:
@@ -55,6 +55,20 @@ class CommandDecoratorTest extends CommandTestBase {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void ignoringDisableTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
var command = new RunCommand(() -> {}).ignoringDisable(true);
|
||||
|
||||
setDSEnabled(false);
|
||||
|
||||
scheduler.schedule(command);
|
||||
|
||||
scheduler.run();
|
||||
assertTrue(scheduler.isScheduled(command));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void beforeStartingTest() {
|
||||
try (CommandScheduler scheduler = new CommandScheduler()) {
|
||||
|
||||
@@ -54,6 +54,19 @@ TEST_F(CommandDecoratorTest, Until) {
|
||||
EXPECT_FALSE(scheduler.IsScheduled(&command));
|
||||
}
|
||||
|
||||
TEST_F(CommandDecoratorTest, IgnoringDisable) {
|
||||
CommandScheduler scheduler = GetScheduler();
|
||||
|
||||
auto command = RunCommand([] {}, {}).IgnoringDisable(true);
|
||||
|
||||
SetDSEnabled(false);
|
||||
|
||||
scheduler.Schedule(command.get());
|
||||
|
||||
scheduler.Run();
|
||||
EXPECT_TRUE(scheduler.IsScheduled(command.get()));
|
||||
}
|
||||
|
||||
TEST_F(CommandDecoratorTest, BeforeStarting) {
|
||||
CommandScheduler scheduler = GetScheduler();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user