57 {
58 cxxopts::Options options("Specs.cpp", "Specs.cpp command line options");
59 options.allow_unrecognised_options();
60
61
62
63 options.add_options()
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 ("h,help", "Print usage");
83
84 auto result = options.parse(argc, argv);
85 if (result.count("help")) {
86 std::cout << options.help() << std::endl;
87 return 0;
88 }
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129 if (result.unmatched().size() > 0) {
130 std::cout << "Unrecognized options:" << std::endl;
131 for (auto& option : result.unmatched()) std::cout << " " << option << std::endl;
132 return 1;
133 }
134
138 );
140 &_stdExceptionExceptionHandler
141 );
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161 _reporters.
add(
"debug", &_reporter);
162 _runner.
run(_specs.
root_group(), &_reporters,
nullptr, &_onSuiteComplete);
163
164 if (_totalTests == 0) {
165 std::cout << "No tests found.\n" << std::endl;
166 std::cout << options.help() << std::endl;
167 return 0;
168 }
169
170 return _returnCode;
171 }
static GlobalSpecCodeBlocks & instance()
void set(ISpecEnvironment *environment)
static GlobalSpecGroup & instance()
ISpecGroup * root_group() const override
ILocalSpecExceptionHandlerCollection * local_exception_handlers() const override
void add(const char *name, ISpecReporter *reporter) override
void run(ISpecGroup *group, ISpecReporterCollection *reporters, ISpecRunOptions *options, ISpecSuiteRunResultCallbackFn *callback) override
GlobalSpecEnvironment & global_spec_environment()
virtual void register_exception_handler(ILocalSpecExceptionHandler *)=0
virtual void merge(ISpecGroup *)=0