mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
crypto TLS bundle: make AddCertsFromDirPathError compile
It's calling `addCertsFromDir`, which now requires a timestamp, so it didn't compile any more. Add a test by the way.
This commit is contained in:
committed by
Andrew Kelley
parent
41bc507688
commit
bc08199ef1
@@ -184,7 +184,8 @@ pub fn addCertsFromDirPath(
|
||||
) AddCertsFromDirPathError!void {
|
||||
var iterable_dir = try dir.openDir(io, sub_dir_path, .{ .iterate = true });
|
||||
defer iterable_dir.close(io);
|
||||
return addCertsFromDir(cb, gpa, io, iterable_dir);
|
||||
const now = Io.Clock.real.now(io);
|
||||
return addCertsFromDir(cb, gpa, io, now, iterable_dir);
|
||||
}
|
||||
|
||||
pub fn addCertsFromDirPathAbsolute(
|
||||
@@ -331,6 +332,19 @@ const MapContext = struct {
|
||||
}
|
||||
};
|
||||
|
||||
test "addCertsFromDirPath compiles and accepts an empty directory" {
|
||||
const io = std.testing.io;
|
||||
const gpa = std.testing.allocator;
|
||||
|
||||
var tmp = std.testing.tmpDir(.{ .iterate = true });
|
||||
defer tmp.cleanup();
|
||||
|
||||
var bundle: Bundle = .empty;
|
||||
defer bundle.deinit(gpa);
|
||||
|
||||
try bundle.addCertsFromDirPath(gpa, io, tmp.dir, ".");
|
||||
}
|
||||
|
||||
test "scan for OS-provided certificates" {
|
||||
if (builtin.os.tag == .wasi) return error.SkipZigTest;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user