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" {...@@ -363,12 +363,12 @@ test "std.meta.trait.hasDecls" {
363 pub fn useless() void {}363 pub fn useless() void {}
364 };364 };
365365
366 const tuple = .{"a", "b", "c"};366 const tuple = .{ "a", "b", "c" };
367367
368 testing.expect(!hasDecls(TestStruct1, .{"a"}));368 testing.expect(!hasDecls(TestStruct1, .{"a"}));
369 testing.expect(hasDecls(TestStruct2, .{"a", "b"}));369 testing.expect(hasDecls(TestStruct2, .{ "a", "b" }));
370 testing.expect(hasDecls(TestStruct2, .{"a", "b", "useless"}));370 testing.expect(hasDecls(TestStruct2, .{ "a", "b", "useless" }));
371 testing.expect(!hasDecls(TestStruct2, .{"a", "b", "c"}));371 testing.expect(!hasDecls(TestStruct2, .{ "a", "b", "c" }));
372 testing.expect(!hasDecls(TestStruct2, tuple));372 testing.expect(!hasDecls(TestStruct2, tuple));
373}373}
374374
...@@ -389,14 +389,13 @@ test "std.meta.trait.hasFields" {...@@ -389,14 +389,13 @@ test "std.meta.trait.hasFields" {
389 pub fn useless() void {}389 pub fn useless() void {}
390 };390 };
391391
392392 const tuple = .{ "a", "b", "c" };
393 const tuple = .{"a", "b", "c"};
394393
395 testing.expect(!hasFields(TestStruct1, .{"a"}));394 testing.expect(!hasFields(TestStruct1, .{"a"}));
396 testing.expect(hasFields(TestStruct2, .{"a", "b"}));395 testing.expect(hasFields(TestStruct2, .{ "a", "b" }));
397 testing.expect(hasFields(TestStruct2, .{"a", "b", "c"}));396 testing.expect(hasFields(TestStruct2, .{ "a", "b", "c" }));
398 testing.expect(hasFields(TestStruct2, tuple));397 testing.expect(hasFields(TestStruct2, tuple));
399 testing.expect(!hasFields(TestStruct2, .{"a", "b", "useless"}));398 testing.expect(!hasFields(TestStruct2, .{ "a", "b", "useless" }));
400}399}
401400
402pub fn hasFunctions(comptime T: type, comptime names: var) bool {401pub fn hasFunctions(comptime T: type, comptime names: var) bool {
...@@ -414,10 +413,10 @@ test "std.meta.trait.hasFunctions" {...@@ -414,10 +413,10 @@ test "std.meta.trait.hasFunctions" {
414 fn b() void {}413 fn b() void {}
415 };414 };
416415
417 const tuple = .{"a", "b", "c"};416 const tuple = .{ "a", "b", "c" };
418417
419 testing.expect(!hasFunctions(TestStruct1, .{"a"}));418 testing.expect(!hasFunctions(TestStruct1, .{"a"}));
420 testing.expect(hasFunctions(TestStruct2, .{"a", "b"}));419 testing.expect(hasFunctions(TestStruct2, .{ "a", "b" }));
421 testing.expect(!hasFunctions(TestStruct2, .{"a", "b", "c"}));420 testing.expect(!hasFunctions(TestStruct2, .{ "a", "b", "c" }));
422 testing.expect(!hasFunctions(TestStruct2, tuple));421 testing.expect(!hasFunctions(TestStruct2, tuple));
423}422}