-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_rev.cpp
More file actions
31 lines (26 loc) · 809 Bytes
/
Copy pathtest_rev.cpp
File metadata and controls
31 lines (26 loc) · 809 Bytes
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
#include <gtest/gtest.h>
#include <cfbox/applet_config.hpp>
#if CFBOX_ENABLE_REV
#include <cfbox/applets.hpp>
TEST(RevTest, HelpAndVersion) {
char a0[] = "rev";
char a1[] = "--help";
char* argv[] = {a0, a1, nullptr};
testing::internal::CaptureStdout();
int rc = rev_main(2, argv);
std::string out = testing::internal::GetCapturedStdout();
EXPECT_EQ(rc, 0);
EXPECT_NE(out.find("rev"), std::string::npos);
}
TEST(RevTest, NonExistentFile) {
char a0[] = "rev";
char a1[] = "/nonexistent_file_xyz";
char* argv[] = {a0, a1, nullptr};
testing::internal::CaptureStdout();
testing::internal::CaptureStderr();
int rc = rev_main(2, argv);
testing::internal::GetCapturedStdout();
testing::internal::GetCapturedStderr();
EXPECT_EQ(rc, 1);
}
#endif