Test fixture for ClearCommand integration tests.
More...
#include <ClearCommandTest.hxx>
|
| void | SetUp () override |
| | Sets up the test environment.
|
| void | TearDown () override |
| | Tears down the test environment.
|
| void | createTestFile (const std::string &filename, const std::string &content="test content") const |
| | Creates a test file inside the test directory.
|
| void | createTestDirectory (const std::string &dirname) const |
| | Creates a test directory inside the test directory.
|
| void | simulateUserInput (const std::string &input) |
| | Simulates user input by redirecting std::cin to a string stream.
|
| bool | repositoryExists () const |
| | Checks if the .svcs repository directory exists.
|
|
|
std::shared_ptr< MockSubject > | mockEventBus |
| | Mock event bus for capturing system notifications.
|
|
std::shared_ptr< RepositoryManager > | repoManager |
| | Real RepositoryManager instance under test.
|
|
std::unique_ptr< ClearCommand > | command |
| | ClearCommand instance under test.
|
|
std::filesystem::path | testDir |
| | Path to the temporary directory used as the repository root.
|
|
std::stringstream | inputStream |
| | String stream used to feed simulated input to std::cin.
|
|
std::streambuf * | originalCin |
| | Pointer to the original buffer of std::cin, saved for restoration.
|
Test fixture for ClearCommand integration tests.
Manages the setup and teardown of a temporary, initialized SVCS repository. Provides utility methods to create test files/directories and to simulate user input required for the 'clear' confirmation prompt.
◆ createTestDirectory()
| void svcs::test::cli::utils::ClearCommandTest::createTestDirectory |
( |
const std::string & | dirname | ) |
const |
|
protected |
Creates a test directory inside the test directory.
- Parameters
-
| dirname | The name of the directory to create. |
◆ createTestFile()
| void svcs::test::cli::utils::ClearCommandTest::createTestFile |
( |
const std::string & | filename, |
|
|
const std::string & | content = "test content" ) const |
|
protected |
Creates a test file inside the test directory.
- Parameters
-
| filename | The name of the file to create. |
| content | The content of the file (defaults to "test content"). |
◆ repositoryExists()
| bool svcs::test::cli::utils::ClearCommandTest::repositoryExists |
( |
| ) |
const |
|
protected |
Checks if the .svcs repository directory exists.
- Returns
- true if the repository exists, false otherwise.
◆ SetUp()
| void svcs::test::cli::utils::ClearCommandTest::SetUp |
( |
| ) |
|
|
overrideprotected |
Sets up the test environment.
Creates and initializes a new temporary SVCS repository and saves the original std::cin buffer.
◆ simulateUserInput()
| void svcs::test::cli::utils::ClearCommandTest::simulateUserInput |
( |
const std::string & | input | ) |
|
|
protected |
Simulates user input by redirecting std::cin to a string stream.
- Parameters
-
| input | The string that will be read as user input. |
◆ TearDown()
| void svcs::test::cli::utils::ClearCommandTest::TearDown |
( |
| ) |
|
|
overrideprotected |
Tears down the test environment.
Restores the original std::cin buffer and recursively removes the temporary directory.
The documentation for this class was generated from the following files: