Dwarf: test enums

This commit is contained in:
Jacob Young 2024-08-18 13:59:00 -04:00
parent 49e6041391
commit 9a64b80377

View File

@ -305,6 +305,51 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void {
\\1 breakpoints deleted; 0 breakpoint locations disabled.
},
);
db.addLldbTest(
"enums",
target,
&.{
.{
.path = "enums.zig",
.source =
\\const Enums = struct {
\\ const Zero = enum(u4) { _ };
\\ const One = enum { first };
\\ const Two = enum(i32) { first, second, _ };
\\ const Three = enum { first, second, third };
\\
\\ zero: Zero = @enumFromInt(13),
\\ one: One = .first,
\\ two: Two = @enumFromInt(-1234),
\\ three: Three = .second,
\\};
\\fn testEnums(enums: Enums) void {
\\ _ = enums;
\\}
\\pub fn main() void {
\\ testEnums(.{});
\\}
\\
,
},
},
\\breakpoint set --file enums.zig --source-pattern-regexp '_ = enums;'
\\process launch
\\frame variable --show-types enums
\\breakpoint delete --force 1
,
&.{
\\(lldb) frame variable --show-types enums
\\(root.enums.Enums) enums = {
\\ (root.enums.Enums.Zero) zero = @enumFromInt(13)
\\ (root.enums.Enums.One) one = .first
\\ (root.enums.Enums.Two) two = @enumFromInt(-1234)
\\ (root.enums.Enums.Three) three = .second
\\}
\\(lldb) breakpoint delete --force 1
\\1 breakpoints deleted; 0 breakpoint locations disabled.
},
);
db.addLldbTest(
"errors",
target,