aboutsummaryrefslogtreecommitdiff
path: root/lib/std/fmt.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-03-22 02:04:48 -0700
committerGitHub <noreply@github.com>2024-03-22 02:04:48 -0700
commitd8bb139da44d9140fd8992608fcbbddcd1816889 (patch)
treea6277199a72ae9ae6265c7b2dd8274d8e54d220a /lib/std/fmt.zig
parenta2651cbc829d44df4c3773037598b30e8cf0c4da (diff)
parent90c94a2f0b7ce71aae1b69cf9e7b517c3a771906 (diff)
downloadzig-d8bb139da44d9140fd8992608fcbbddcd1816889.tar.gz
zig-d8bb139da44d9140fd8992608fcbbddcd1816889.zip
Merge pull request #19390 from ziglang/valgrind
make the behavior tests run almost valgrind clean
Diffstat (limited to 'lib/std/fmt.zig')
-rw-r--r--lib/std/fmt.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index e5b359d30f..c4a170b67f 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -1303,7 +1303,7 @@ pub fn fmtDuration(ns: u64) Formatter(formatDuration) {
return .{ .data = data };
}
-test "fmtDuration" {
+test fmtDuration {
var buf: [24]u8 = undefined;
inline for (.{
.{ .s = "0ns", .d = 0 },
@@ -1367,7 +1367,7 @@ pub fn fmtDurationSigned(ns: i64) Formatter(formatDurationSigned) {
return .{ .data = ns };
}
-test "fmtDurationSigned" {
+test fmtDurationSigned {
var buf: [24]u8 = undefined;
inline for (.{
.{ .s = "0ns", .d = 0 },
@@ -1497,7 +1497,7 @@ pub fn parseInt(comptime T: type, buf: []const u8, base: u8) ParseIntError!T {
return parseWithSign(T, buf, base, .pos);
}
-test "parseInt" {
+test parseInt {
try std.testing.expect((try parseInt(i32, "-10", 10)) == -10);
try std.testing.expect((try parseInt(i32, "+10", 10)) == 10);
try std.testing.expect((try parseInt(u32, "+10", 10)) == 10);
@@ -1639,7 +1639,7 @@ pub fn parseUnsigned(comptime T: type, buf: []const u8, base: u8) ParseIntError!
return parseWithSign(T, buf, base, .pos);
}
-test "parseUnsigned" {
+test parseUnsigned {
try std.testing.expect((try parseUnsigned(u16, "050124", 10)) == 50124);
try std.testing.expect((try parseUnsigned(u16, "65535", 10)) == 65535);
try std.testing.expect((try parseUnsigned(u16, "65_535", 10)) == 65535);
@@ -1713,7 +1713,7 @@ pub fn parseIntSizeSuffix(buf: []const u8, digit_base: u8) ParseIntError!usize {
return math.mul(usize, number, multiplier);
}
-test "parseIntSizeSuffix" {
+test parseIntSizeSuffix {
try std.testing.expect(try parseIntSizeSuffix("2", 10) == 2);
try std.testing.expect(try parseIntSizeSuffix("2B", 10) == 2);
try std.testing.expect(try parseIntSizeSuffix("2kB", 10) == 2000);
@@ -1796,7 +1796,7 @@ pub fn allocPrintZ(allocator: mem.Allocator, comptime fmt: []const u8, args: any
return result[0 .. result.len - 1 :0];
}
-test "bufPrintInt" {
+test bufPrintIntToSlice {
var buffer: [100]u8 = undefined;
const buf = buffer[0..];
@@ -1830,7 +1830,7 @@ pub inline fn comptimePrint(comptime fmt: []const u8, args: anytype) *const [cou
}
}
-test "comptimePrint" {
+test comptimePrint {
@setEvalBranchQuota(2000);
try std.testing.expectEqual(*const [3:0]u8, @TypeOf(comptimePrint("{}", .{100})));
try std.testing.expectEqualSlices(u8, "100", comptimePrint("{}", .{100}));
@@ -2445,14 +2445,14 @@ pub fn hexToBytes(out: []u8, input: []const u8) ![]u8 {
return out[0 .. in_i / 2];
}
-test "bytesToHex" {
+test bytesToHex {
const input = "input slice";
const encoded = bytesToHex(input, .lower);
var decoded: [input.len]u8 = undefined;
try std.testing.expectEqualSlices(u8, input, try hexToBytes(&decoded, &encoded));
}
-test "hexToBytes" {
+test hexToBytes {
var buf: [32]u8 = undefined;
try expectFmt("90" ** 32, "{s}", .{fmtSliceHexUpper(try hexToBytes(&buf, "90" ** 32))});
try expectFmt("ABCD", "{s}", .{fmtSliceHexUpper(try hexToBytes(&buf, "ABCD"))});