@@ -46,33 +46,41 @@ class TestProcessExecutor : public TestFixture {
4646 return " process" ;
4747 }
4848
49+ struct CheckOptions
50+ {
51+ CheckOptions () DINIT_NOEXCEPT = default ;
52+ SHOWTIME_MODES showtime = SHOWTIME_MODES::SHOWTIME_NONE;
53+ const char * plistOutput = nullptr ;
54+ std::vector<std::string> filesList;
55+ };
56+
4957 /* *
5058 * Execute check using n jobs for y files which are have
5159 * identical data, given within data.
5260 */
53- void check (unsigned int jobs, int files, int result, const std::string &data, SHOWTIME_MODES showtime = SHOWTIME_MODES::SHOWTIME_NONE, const char * const plistOutput = nullptr , const std::vector<std::string>& filesList = {}) {
61+ void check (unsigned int jobs, int files, int result, const std::string &data, const CheckOptions &opt = {}) {
5462 errout.str (" " );
5563 output.str (" " );
5664
5765 std::map<std::string, std::size_t > filemap;
58- if (filesList.empty ()) {
66+ if (opt. filesList .empty ()) {
5967 for (int i = 1 ; i <= files; ++i) {
6068 std::ostringstream oss;
6169 oss << fprefix () << " _" << i << " .cpp" ;
6270 filemap[oss.str ()] = data.size ();
6371 }
6472 }
6573 else {
66- for (const auto & f : filesList)
74+ for (const auto & f : opt. filesList )
6775 {
6876 filemap[f] = data.size ();
6977 }
7078 }
7179
7280 settings.jobs = jobs;
73- settings.showtime = showtime;
74- if (plistOutput)
75- settings.plistOutput = plistOutput;
81+ settings.showtime = opt. showtime ;
82+ if (opt. plistOutput )
83+ settings.plistOutput = opt. plistOutput ;
7684 // TODO: test with settings.project.fileSettings;
7785 ProcessExecutor executor (filemap, settings, *this );
7886 std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
@@ -127,7 +135,7 @@ class TestProcessExecutor : public TestFixture {
127135 " {\n "
128136 " char *a = malloc(10);\n "
129137 " return 0;\n "
130- " }" , SHOWTIME_MODES::SHOWTIME_SUMMARY);
138+ " }" , dinit (CheckOptions, $. showtime = SHOWTIME_MODES::SHOWTIME_SUMMARY) );
131139 }
132140
133141 void many_threads_plist () {
@@ -139,7 +147,7 @@ class TestProcessExecutor : public TestFixture {
139147 " {\n "
140148 " char *a = malloc(10);\n "
141149 " return 0;\n "
142- " }" , SHOWTIME_MODES::SHOWTIME_NONE, plistOutput);
150+ " }" , dinit (CheckOptions, $. plistOutput = plistOutput) );
143151 }
144152
145153 void no_errors_more_files () {
@@ -184,7 +192,6 @@ class TestProcessExecutor : public TestFixture {
184192 " }" );
185193 }
186194
187-
188195 void markup () {
189196 const Settings settingsOld = settings;
190197 settings.library .mMarkupExtensions .emplace (" .cp1" );
@@ -201,7 +208,7 @@ class TestProcessExecutor : public TestFixture {
201208 " char *a = malloc(10);\n "
202209 " return 0;\n "
203210 " }" ,
204- SHOWTIME_MODES::SHOWTIME_NONE, nullptr , files);
211+ dinit (CheckOptions, $. filesList = files) );
205212 // TODO: order of "Checking" and "checked" is affected by thread
206213 /* TODO_ASSERT_EQUALS("Checking " + fprefix() + "_2.cpp ...\n"
207214 "1/4 files checked 25% done\n"
0 commit comments