Files
allwpilib/commandsv2/src/test/native/cpp/wpi/command/PrintCommandTest.cpp

29 lines
813 B
C++
Raw Normal View History

// 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.
#include <regex>
2025-11-07 19:56:21 -05:00
#include "CommandTestBase.hpp"
2025-11-07 19:57:55 -05:00
#include "wpi/commands2/Commands.hpp"
2025-11-07 19:56:21 -05:00
#include "wpi/commands2/PrintCommand.hpp"
2025-11-07 20:00:05 -05:00
using namespace wpi::cmd;
class PrintCommandTest : public CommandTestBase {};
TEST_F(PrintCommandTest, PrintCommandSchedule) {
CommandScheduler scheduler = GetScheduler();
auto command = cmd::Print("Test!");
testing::internal::CaptureStdout();
scheduler.Schedule(command);
scheduler.Run();
EXPECT_TRUE(std::regex_search(testing::internal::GetCapturedStdout(),
std::regex("Test!")));
EXPECT_FALSE(scheduler.IsScheduled(command));
}