@@ -175,7 +175,6 @@ TEST(PackDistribution, LaunchersPickTheArchitectureAndTheRunner) {
175175 l.runner = { " okrun" , " {}" };
176176 l.entry = { { " x86_64" , " hello.oke" }, { " aarch64" , " hello.oke" } };
177177 l.loader = " okrun" ;
178- ASSERT_TRUE (d::launchable (l));
179178 const auto sh = d::posix_launcher (l);
180179 EXPECT_TRUE (sh.starts_with (" #!/bin/sh\n " ));
181180 EXPECT_NE (sh.find (" x86_64|amd64|AMD64) arch=x86_64" ), std::string::npos);
@@ -186,10 +185,8 @@ TEST(PackDistribution, LaunchersPickTheArchitectureAndTheRunner) {
186185 // The package is found through a link to the launcher, without readlink -f.
187186 EXPECT_NE (sh.find (" readlink -- \" $self\" " ), std::string::npos);
188187 EXPECT_EQ (sh.find (" readlink -f" ), std::string::npos);
189- const auto cmd = d::windows_launcher (l);
190- EXPECT_NE (cmd.find (" PROCESSOR_ARCHITEW6432" ), std::string::npos);
191- EXPECT_NE (cmd.find (" libexec\\ okrun\\ windows-%arch%\\ okrun.exe" ), std::string::npos);
192- EXPECT_NE (cmd.find (" \" %runner%\" \" %image%\" %*" ), std::string::npos);
188+ // A POSIX shell on Windows hands over to the program of the same name.
189+ EXPECT_NE (sh.find (" MINGW*|MSYS*|CYGWIN*) exec \" $top/bin/\" 'hello'.exe \" $@\" " ), std::string::npos) << sh;
193190}
194191
195192// The runner's words expand as `mcpp run` expands them: a word's `{}` is the
@@ -201,32 +198,32 @@ TEST(PackDistribution, LaunchersExpandTheRunnerAsMcppRunDoes) {
201198 l.runner = { " okrun" , " --image={}" , " it's" };
202199 EXPECT_NE (d::posix_launcher (l).find (" exec \" $runner\" '--image='\" $image\" 'it'\\ ''s' \" $@\" " ),
203200 std::string::npos) << d::posix_launcher (l);
204- EXPECT_NE (d::windows_launcher (l).find (" \" %runner%\" \" --image=%image%\" \" it's\" %*" ), std::string::npos)
205- << d::windows_launcher (l);
206201 l.runner = { " okrun" , " --quiet" };
207202 EXPECT_NE (d::posix_launcher (l).find (" exec \" $runner\" '--quiet' \" $image\" \" $@\" " ), std::string::npos)
208203 << d::posix_launcher (l);
209- EXPECT_NE (d::windows_launcher (l).find (" \" %runner%\" \" --quiet\" \" %image%\" %*" ), std::string::npos)
210- << d::windows_launcher (l);
211204}
212205
213- // A .cmd doubles `%` in what it states literally, and a word it cannot state
214- // (a double quote) is refused: the .cmd written for it runs nothing.
215- TEST (PackDistribution, AWindowsLauncherEscapesWhatItStates) {
206+ // The Windows launcher is a program (design 2026-10-29 §4.3): its source states
207+ // the launch as constants, finds the package from its own path, reads the
208+ // machine's architecture, and expands the runner's words as `mcpp run` does.
209+ // Any word is stated, quotes and percent signs included: a raw string holds it.
210+ TEST (PackDistribution, TheWindowsLauncherIsAProgram) {
216211 d::Launch l;
217212 l.name = " hello" ;
218- l.entry = { { " x86_64" , " hello.oke" } };
219- l.runner = { " ok%run" , " --load=50%" , " {}" };
220- const auto cmd = d::windows_launcher (l);
221- EXPECT_NE (cmd.find (" set \" runner=ok%%run\" " ), std::string::npos) << cmd;
222- EXPECT_NE (cmd.find (" \" %runner%\" \" --load=50%%\" \" %image%\" %*" ), std::string::npos) << cmd;
223- l.runner = { " okrun" , " --say=\" hi\" " , " {}" };
224- auto ok = d::launchable (l);
225- ASSERT_FALSE (ok);
226- EXPECT_NE (ok.error ().find (" double quote" ), std::string::npos) << ok.error ();
227- const auto refused = d::windows_launcher (l);
228- EXPECT_EQ (refused.find (" %runner%" ), std::string::npos) << refused;
229- EXPECT_NE (refused.find (" exit /b 126" ), std::string::npos) << refused;
213+ l.entry = { { " x86_64" , " hello.oke" }, { " aarch64" , " hello.oke" } };
214+ l.runner = { " okrun" , " --say=\" 50%\" " , " {}" };
215+ l.loader = " okrun" ;
216+ const auto src = d::exe_launcher_main (l);
217+ EXPECT_NE (src.find (" import mcpplibs.os;" ), std::string::npos) << src;
218+ EXPECT_NE (src.find (" os::env::image()" ), std::string::npos) << src;
219+ EXPECT_NE (src.find (" PROCESSOR_ARCHITEW6432" ), std::string::npos) << src;
220+ EXPECT_NE (src.find (" R\" mcpp(--say=\" 50%\" )mcpp\" " ), std::string::npos) << src;
221+ EXPECT_NE (src.find (" R\" mcpp(aarch64)mcpp\" " ), std::string::npos) << src;
222+ EXPECT_NE (src.find (" (\" windows-\" + arch)" ), std::string::npos) << src;
223+ EXPECT_NE (src.find (" os::process::exec" ), std::string::npos) << src;
224+ const auto manifest = d::exe_launcher_manifest (" hello" , " 1.0.0" );
225+ EXPECT_NE (manifest.find (" os = \" 0.2.1\" " ), std::string::npos) << manifest;
226+ EXPECT_NE (manifest.find (" [targets.hello]" ), std::string::npos) << manifest;
230227}
231228
232229// The POSIX launcher, run through a link to it from another directory, finds
0 commit comments