@@ -2328,7 +2328,7 @@ fn testMergeStrings(b: *Build, opts: Options) *Step {
2328
2328
fn testMergeStrings2 (b : * Build , opts : Options ) * Step {
2329
2329
const test_step = addTestStep (b , "merge-strings2" , opts );
2330
2330
2331
- const obj1 = addObject (b , opts , .{ .name = "a.o " , .zig_source_bytes =
2331
+ const obj1 = addObject (b , opts , .{ .name = "a" , .zig_source_bytes =
2332
2332
\\const std = @import("std");
2333
2333
\\export fn foo() void {
2334
2334
\\ var arr: [5:0]u16 = [_:0]u16{ 1, 2, 3, 4, 5 };
@@ -2337,7 +2337,7 @@ fn testMergeStrings2(b: *Build, opts: Options) *Step {
2337
2337
\\}
2338
2338
});
2339
2339
2340
- const exe = addExecutable (b , opts , .{ .name = "main " , .zig_source_bytes =
2340
+ const obj2 = addObject (b , opts , .{ .name = "b " , .zig_source_bytes =
2341
2341
\\const std = @import("std");
2342
2342
\\extern fn foo() void;
2343
2343
\\pub fn main() void {
@@ -2347,18 +2347,43 @@ fn testMergeStrings2(b: *Build, opts: Options) *Step {
2347
2347
\\ std.testing.expectEqualSlices(u16, arr[0..2], slice) catch unreachable;
2348
2348
\\}
2349
2349
});
2350
- exe .addObject (obj1 );
2351
2350
2352
- const run = addRunArtifact (exe );
2353
- run .expectExitCode (0 );
2354
- test_step .dependOn (& run .step );
2351
+ {
2352
+ const exe = addExecutable (b , opts , .{ .name = "main1" });
2353
+ exe .addObject (obj1 );
2354
+ exe .addObject (obj2 );
2355
2355
2356
- const check = exe .checkObject ();
2357
- check .dumpSection (".rodata.str" );
2358
- check .checkContains ("\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x00\x00 " );
2359
- check .dumpSection (".rodata.str" );
2360
- check .checkContains ("\x05\x00\x04\x00\x03\x00\x02\x00\x01\x00\x00\x00 " );
2361
- test_step .dependOn (& check .step );
2356
+ const run = addRunArtifact (exe );
2357
+ run .expectExitCode (0 );
2358
+ test_step .dependOn (& run .step );
2359
+
2360
+ const check = exe .checkObject ();
2361
+ check .dumpSection (".rodata.str" );
2362
+ check .checkContains ("\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x00\x00 " );
2363
+ check .dumpSection (".rodata.str" );
2364
+ check .checkContains ("\x05\x00\x04\x00\x03\x00\x02\x00\x01\x00\x00\x00 " );
2365
+ test_step .dependOn (& check .step );
2366
+ }
2367
+
2368
+ {
2369
+ const obj3 = addObject (b , opts , .{ .name = "c" });
2370
+ obj3 .addObject (obj1 );
2371
+ obj3 .addObject (obj2 );
2372
+
2373
+ const exe = addExecutable (b , opts , .{ .name = "main2" });
2374
+ exe .addObject (obj3 );
2375
+
2376
+ const run = addRunArtifact (exe );
2377
+ run .expectExitCode (0 );
2378
+ test_step .dependOn (& run .step );
2379
+
2380
+ const check = exe .checkObject ();
2381
+ check .dumpSection (".rodata.str" );
2382
+ check .checkContains ("\x01\x00\x02\x00\x03\x00\x04\x00\x05\x00\x00\x00 " );
2383
+ check .dumpSection (".rodata.str" );
2384
+ check .checkContains ("\x05\x00\x04\x00\x03\x00\x02\x00\x01\x00\x00\x00 " );
2385
+ test_step .dependOn (& check .step );
2386
+ }
2362
2387
2363
2388
return test_step ;
2364
2389
}
0 commit comments