@@ -5486,6 +5486,16 @@ static void test_resolve_runner(TestBuild& tb, const TestOptions& testOpts, bool
54865486 }
54875487}
54885488
5489+ // A CASE THAT DECLARES CASES (a suite run as a case) is told by them: neither a
5490+ // program's line nor the run's summary counts it beside them, so that the two
5491+ // counts of one run agree (an mtest program of one suite and seven cases read
5492+ // `8 cases` on its line and `7 passed` in the summary).
5493+ bool declares_cases (const mcpp::build::test_protocol::Report& rep, const std::string& id) {
5494+ return std::ranges::any_of (rep.cases , [&](const auto & c) {
5495+ return c.id .size () > id.size () && c.id .starts_with (id) && c.id [id.size ()] == ' /' ;
5496+ });
5497+ }
5498+
54895499// A failed test whose file imports a module no package of this build provides:
54905500// the compiler says only that the module was not built. A test's framework is a
54915501// `[dev-dependencies]` entry (docs/08), which a manifest written over the
@@ -6007,8 +6017,10 @@ static int test_run_member(TestBuild& tb, const TestOptions& testOpts,
60076017 report = {};
60086018 spoken = 0 ;
60096019 } else {
6010- casesNote = std::format (" , {} case{}" , report.cases .size (),
6011- report.cases .size () == 1 ? " " : " s" );
6020+ const auto told = std::ranges::count_if (report.cases , [&](const auto & c) {
6021+ return !declares_cases (report, c.id );
6022+ });
6023+ casesNote = std::format (" , {} case{}" , told, told == 1 ? " " : " s" );
60126024 if (exitCode == 0 && !timedOut && report.failed ()) exitCode = 1 ;
60136025 }
60146026 }
@@ -6858,15 +6870,10 @@ static int test_run_member(TestBuild& tb, const TestOptions& testOpts,
68586870
68596871 // THE CASES, BESIDE THE PROGRAMS THE COUNT ABOVE IS OF. A case that
68606872 // declared cases (a suite run as a case) is told by them, not counted.
6861- auto declares = [](const mcpp::build::test_protocol::Report& rep, const std::string& id) {
6862- return std::ranges::any_of (rep.cases , [&](const auto & c) {
6863- return c.id .size () > id.size () && c.id .starts_with (id) && c.id [id.size ()] == ' /' ;
6864- });
6865- };
68666873 int casesPassed = 0 , casesFailed = 0 , casesSkipped = 0 ;
68676874 for (auto & r : results)
68686875 for (const auto & c : r.report .cases ) {
6869- if (declares (r.report , c.id )) continue ;
6876+ if (declares_cases (r.report , c.id )) continue ;
68706877 if (c.status == " pass" || c.status == " xfail" ) ++casesPassed;
68716878 else if (c.status == " fail" || c.status == " xpass" ) ++casesFailed;
68726879 else if (c.status == " skip" ) ++casesSkipped;
@@ -6905,7 +6912,7 @@ static int test_run_member(TestBuild& tb, const TestOptions& testOpts,
69056912 continue ;
69066913 std::println (" {}" , r.name );
69076914 for (const auto & c : r.report .cases ) {
6908- if ((c.status != " fail" && c.status != " xpass" ) || declares (r.report , c.id )) continue ;
6915+ if ((c.status != " fail" && c.status != " xpass" ) || declares_cases (r.report , c.id )) continue ;
69096916 if (c.failures .empty ())
69106917 std::println (" {} {}" , c.id , c.status == " xpass" ? " passed, expected to fail"
69116918 : c.reason .empty () ? std::string (" failed" ) : c.reason );
0 commit comments