authorgravatar for datamanrb@gmail.comdata-man <datamanrb@gmail.com> 2020-05-28 16:41:15+05:00
committergravatar for datamanrb@gmail.comdata-man <datamanrb@gmail.com> 2020-05-28 16:41:15+05:00
logc91786caf3f12ec9c9ad928fc0e71d43783ea7a8
tree0653b8c3c17d4d6eeeef98d7c6b199a29c02511c
parentf9bdf325d318347547b3ea7735367b56b4a26cd2

zig fmt


1 files changed, 11 insertions(+), 12 deletions(-)

lib/std/meta/trait.zig+11-12
......@@ -363,12 +363,12 @@ test "std.meta.trait.hasDecls" {
363363 pub fn useless() void {}
364364 };
365365
366 const tuple = .{"a", "b", "c"};
366 const tuple = .{ "a", "b", "c" };
367367
368368 testing.expect(!hasDecls(TestStruct1, .{"a"}));
369 testing.expect(hasDecls(TestStruct2, .{"a", "b"}));
370 testing.expect(hasDecls(TestStruct2, .{"a", "b", "useless"}));
371 testing.expect(!hasDecls(TestStruct2, .{"a", "b", "c"}));
369 testing.expect(hasDecls(TestStruct2, .{ "a", "b" }));
370 testing.expect(hasDecls(TestStruct2, .{ "a", "b", "useless" }));
371 testing.expect(!hasDecls(TestStruct2, .{ "a", "b", "c" }));
372372 testing.expect(!hasDecls(TestStruct2, tuple));
373373}
374374
......@@ -389,14 +389,13 @@ test "std.meta.trait.hasFields" {
389389 pub fn useless() void {}
390390 };
391391
392
393 const tuple = .{"a", "b", "c"};
392 const tuple = .{ "a", "b", "c" };
394393
395394 testing.expect(!hasFields(TestStruct1, .{"a"}));
396 testing.expect(hasFields(TestStruct2, .{"a", "b"}));
397 testing.expect(hasFields(TestStruct2, .{"a", "b", "c"}));
395 testing.expect(hasFields(TestStruct2, .{ "a", "b" }));
396 testing.expect(hasFields(TestStruct2, .{ "a", "b", "c" }));
398397 testing.expect(hasFields(TestStruct2, tuple));
399 testing.expect(!hasFields(TestStruct2, .{"a", "b", "useless"}));
398 testing.expect(!hasFields(TestStruct2, .{ "a", "b", "useless" }));
400399}
401400
402401pub fn hasFunctions(comptime T: type, comptime names: var) bool {
......@@ -414,10 +413,10 @@ test "std.meta.trait.hasFunctions" {
414413 fn b() void {}
415414 };
416415
417 const tuple = .{"a", "b", "c"};
416 const tuple = .{ "a", "b", "c" };
418417
419418 testing.expect(!hasFunctions(TestStruct1, .{"a"}));
420 testing.expect(hasFunctions(TestStruct2, .{"a", "b"}));
421 testing.expect(!hasFunctions(TestStruct2, .{"a", "b", "c"}));
419 testing.expect(hasFunctions(TestStruct2, .{ "a", "b" }));
420 testing.expect(!hasFunctions(TestStruct2, .{ "a", "b", "c" }));
422421 testing.expect(!hasFunctions(TestStruct2, tuple));
423422}