| ... | @@ -403,6 +403,71 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -403,6 +403,71 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 403 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | 403 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 404 | }, | 404 | }, |
| 405 | ); | 405 | ); |
| | 406 | db.addLldbTest( |
| | 407 | "unions", |
| | 408 | target, |
| | 409 | &.{ |
| | 410 | .{ |
| | 411 | .path = "unions.zig", |
| | 412 | .source = |
| | 413 | \\const Unions = struct { |
| | 414 | \\ const Enum = enum { first, second, third }; |
| | 415 | \\ const Untagged = extern union { |
| | 416 | \\ u32: u32, |
| | 417 | \\ i32: i32, |
| | 418 | \\ f32: f32, |
| | 419 | \\ }; |
| | 420 | \\ const SafetyTagged = union { |
| | 421 | \\ void: void, |
| | 422 | \\ en: Enum, |
| | 423 | \\ eu: error{Error}!Enum, |
| | 424 | \\ }; |
| | 425 | \\ const Tagged = union(enum) { |
| | 426 | \\ void: void, |
| | 427 | \\ en: Enum, |
| | 428 | \\ eu: error{Error}!Enum, |
| | 429 | \\ }; |
| | 430 | \\ |
| | 431 | \\ untagged: Untagged = .{ .f32 = -1.5 }, |
| | 432 | \\ safety_tagged: SafetyTagged = .{ .en = .second }, |
| | 433 | \\ tagged: Tagged = .{ .eu = error.Error }, |
| | 434 | \\}; |
| | 435 | \\fn testUnions(unions: Unions) void { |
| | 436 | \\ _ = unions; |
| | 437 | \\} |
| | 438 | \\pub fn main() void { |
| | 439 | \\ testUnions(.{}); |
| | 440 | \\} |
| | 441 | \\ |
| | 442 | , |
| | 443 | }, |
| | 444 | }, |
| | 445 | \\breakpoint set --file unions.zig --source-pattern-regexp '_ = unions;' |
| | 446 | \\process launch |
| | 447 | \\frame variable --show-types unions |
| | 448 | \\breakpoint delete --force 1 |
| | 449 | , |
| | 450 | &.{ |
| | 451 | \\(lldb) frame variable --show-types unions |
| | 452 | \\(root.unions.Unions) unions = { |
| | 453 | \\ (root.unions.Unions.Untagged) untagged = { |
| | 454 | \\ (u32) u32 = 3217031168 |
| | 455 | \\ (i32) i32 = -1077936128 |
| | 456 | \\ (f32) f32 = -1.5 |
| | 457 | \\ } |
| | 458 | \\ (root.unions.Unions.SafetyTagged) safety_tagged = { |
| | 459 | \\ (root.unions.Unions.Enum) en = .second |
| | 460 | \\ } |
| | 461 | \\ (root.unions.Unions.Tagged) tagged = { |
| | 462 | \\ (error{Error}!root.unions.Unions.Enum) eu = { |
| | 463 | \\ (error{Error}) error = error.Error |
| | 464 | \\ } |
| | 465 | \\ } |
| | 466 | \\} |
| | 467 | \\(lldb) breakpoint delete --force 1 |
| | 468 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| | 469 | }, |
| | 470 | ); |
| 406 | db.addLldbTest( | 471 | db.addLldbTest( |
| 407 | "storage", | 472 | "storage", |
| 408 | target, | 473 | target, |