-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_clear.cpp
More file actions
36 lines (29 loc) · 1.01 KB
/
Copy pathtest_clear.cpp
File metadata and controls
36 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <cfbox/applets.hpp>
#include <cfbox/applet_config.hpp>
#include <gtest/gtest.h>
#include "test_capture.hpp"
#if CFBOX_ENABLE_CLEAR
TEST(ClearTest, ReturnsZero) {
char a0[] = "clear";
char* argv[] = {a0, nullptr};
EXPECT_EQ(clear_main(1, argv), 0);
}
TEST(ClearTest, OutputsEscapeSequence) {
char a0[] = "clear";
char* argv[] = {a0, nullptr};
auto out = cfbox::test::capture_stdout([&] { return clear_main(1, argv); });
EXPECT_NE(out.find("\033[2J\033[H"), std::string::npos);
}
TEST(ClearTest, Help) {
char a0[] = "clear", a1[] = "--help";
char* argv[] = {a0, a1, nullptr};
auto out = cfbox::test::capture_stdout([&] { return clear_main(2, argv); });
EXPECT_NE(out.find("clear"), std::string::npos);
}
TEST(ClearTest, Version) {
char a0[] = "clear", a1[] = "--version";
char* argv[] = {a0, a1, nullptr};
auto out = cfbox::test::capture_stdout([&] { return clear_main(2, argv); });
EXPECT_NE(out.find("cfbox"), std::string::npos);
}
#endif // CFBOX_ENABLE_CLEAR