Add test for table.get
This commit is contained in:
parent
5dc1b9d50b
commit
c8cbf4659a
@ -169,6 +169,19 @@ test "Value equalities"
|
||||
try std.testing.expect(!h.rawEqual(j));
|
||||
}
|
||||
|
||||
test "Table get"
|
||||
{
|
||||
var a = Table { .entries = std.ArrayList(TableEntry).init(std.testing.allocator) };
|
||||
defer a.entries.deinit();
|
||||
try a.entries.append(TableEntry { .key = Value { .Bool = true }, .value = Value { .String = "foo" } });
|
||||
try std.testing.expectEqualStrings(a.get(Value { .Bool = true }).String, "foo");
|
||||
try std.testing.expectEqual(a.get(Value.Nil), Value.Nil);
|
||||
try std.testing.expectEqual(a.get(Value { .Numeral = Numeral { .Integer = 12 } }), Value.Nil);
|
||||
var c = a.get(Value { .Bool = true });
|
||||
c.String = "bar";
|
||||
try std.testing.expectEqual(a.get(Value { .Bool = true }).String, "foo");
|
||||
}
|
||||
|
||||
pub const CodeRegion = struct
|
||||
{
|
||||
start: ?CodeLocation,
|
||||
|
Loading…
x
Reference in New Issue
Block a user