mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Bump WebKit (#18784)
Co-authored-by: Ben Grant <ben@bun.sh> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
This commit is contained in:
@@ -2,7 +2,7 @@ option(WEBKIT_VERSION "The version of WebKit to use")
|
||||
option(WEBKIT_LOCAL "If a local version of WebKit should be used instead of downloading")
|
||||
|
||||
if(NOT WEBKIT_VERSION)
|
||||
set(WEBKIT_VERSION 76e7e4177b87b24361a8ed8c08777b2bba7a891a)
|
||||
set(WEBKIT_VERSION 12d2dfab74b34a50c8544c59f8a9454ce2e06e06)
|
||||
endif()
|
||||
|
||||
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)
|
||||
|
||||
@@ -352,9 +352,7 @@ pub const JunitReporter = struct {
|
||||
try this.contents.appendSlice(bun.default_allocator, "\"");
|
||||
|
||||
const elapsed_seconds = elapsed_ms / std.time.ms_per_s;
|
||||
var time_buf: [32]u8 = undefined;
|
||||
const time_str = try std.fmt.bufPrint(&time_buf, " time=\"{d}\"", .{elapsed_seconds});
|
||||
try this.contents.appendSlice(bun.default_allocator, time_str);
|
||||
try this.contents.writer(bun.default_allocator).print(" time=\"{}\"", .{bun.fmt.trimmedPrecision(elapsed_seconds, 6)});
|
||||
|
||||
try this.contents.appendSlice(bun.default_allocator, " file=\"");
|
||||
try escapeXml(file, this.contents.writer(bun.default_allocator));
|
||||
|
||||
27
src/fmt.zig
27
src/fmt.zig
@@ -1575,6 +1575,33 @@ pub fn hexIntUpper(value: anytype) HexIntFormatter(@TypeOf(value), false) {
|
||||
return Formatter{ .value = value };
|
||||
}
|
||||
|
||||
/// Equivalent to `{d:.<precision>}` but trims trailing zeros
|
||||
/// if decimal part is less than `precision` digits.
|
||||
fn TrimmedPrecisionFormatter(comptime precision: usize) type {
|
||||
return struct {
|
||||
num: f64,
|
||||
precision: usize,
|
||||
|
||||
pub fn format(self: @This(), comptime _: []const u8, _: std.fmt.FormatOptions, writer: anytype) !void {
|
||||
const whole = @trunc(self.num);
|
||||
try writer.print("{d}", .{whole});
|
||||
const rem = self.num - whole;
|
||||
if (rem != 0) {
|
||||
var buf: [2 + precision]u8 = undefined;
|
||||
var formatted = std.fmt.bufPrint(&buf, "{d:." ++ std.fmt.comptimePrint("{d}", .{precision}) ++ "}", .{rem}) catch unreachable;
|
||||
formatted = formatted[2..];
|
||||
const trimmed = std.mem.trimRight(u8, formatted, "0");
|
||||
try writer.print(".{s}", .{trimmed});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub fn trimmedPrecision(value: f64, comptime precision: usize) TrimmedPrecisionFormatter(precision) {
|
||||
const Formatter = TrimmedPrecisionFormatter(precision);
|
||||
return Formatter{ .num = value, .precision = precision };
|
||||
}
|
||||
|
||||
const FormatDurationData = struct {
|
||||
ns: u64,
|
||||
negative: bool = false,
|
||||
|
||||
Reference in New Issue
Block a user