mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
Added tests with tuple
This commit is contained in:
parent
78a1f6976d
commit
f9bdf325d3
@ -363,10 +363,13 @@ test "std.meta.trait.hasDecls" {
|
||||
pub fn useless() void {}
|
||||
};
|
||||
|
||||
const tuple = .{"a", "b", "c"};
|
||||
|
||||
testing.expect(!hasDecls(TestStruct1, .{"a"}));
|
||||
testing.expect(hasDecls(TestStruct2, .{"a", "b"}));
|
||||
testing.expect(hasDecls(TestStruct2, .{"a", "b", "useless"}));
|
||||
testing.expect(!hasDecls(TestStruct2, .{"a", "b", "c"}));
|
||||
testing.expect(!hasDecls(TestStruct2, tuple));
|
||||
}
|
||||
|
||||
pub fn hasFields(comptime T: type, comptime names: var) bool {
|
||||
@ -386,9 +389,13 @@ test "std.meta.trait.hasFields" {
|
||||
pub fn useless() void {}
|
||||
};
|
||||
|
||||
|
||||
const tuple = .{"a", "b", "c"};
|
||||
|
||||
testing.expect(!hasFields(TestStruct1, .{"a"}));
|
||||
testing.expect(hasFields(TestStruct2, .{"a", "b"}));
|
||||
testing.expect(hasFields(TestStruct2, .{"a", "b", "c"}));
|
||||
testing.expect(hasFields(TestStruct2, tuple));
|
||||
testing.expect(!hasFields(TestStruct2, .{"a", "b", "useless"}));
|
||||
}
|
||||
|
||||
@ -407,7 +414,10 @@ test "std.meta.trait.hasFunctions" {
|
||||
fn b() void {}
|
||||
};
|
||||
|
||||
const tuple = .{"a", "b", "c"};
|
||||
|
||||
testing.expect(!hasFunctions(TestStruct1, .{"a"}));
|
||||
testing.expect(hasFunctions(TestStruct2, .{"a", "b"}));
|
||||
testing.expect(!hasFunctions(TestStruct2, .{"a", "b", "c"}));
|
||||
testing.expect(!hasFunctions(TestStruct2, tuple));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user