| ... | @@ -184,7 +184,8 @@ pub fn addCertsFromDirPath( | ... | @@ -184,7 +184,8 @@ pub fn addCertsFromDirPath( |
| 184 | ) AddCertsFromDirPathError!void { | 184 | ) AddCertsFromDirPathError!void { |
| 185 | var iterable_dir = try dir.openDir(io, sub_dir_path, .{ .iterate = true }); | 185 | var iterable_dir = try dir.openDir(io, sub_dir_path, .{ .iterate = true }); |
| 186 | defer iterable_dir.close(io); | 186 | defer iterable_dir.close(io); |
| 187 | return addCertsFromDir(cb, gpa, io, iterable_dir); | 187 | const now = Io.Clock.real.now(io); |
| | 188 | return addCertsFromDir(cb, gpa, io, now, iterable_dir); |
| 188 | } | 189 | } |
| 189 | | 190 | |
| 190 | pub fn addCertsFromDirPathAbsolute( | 191 | pub fn addCertsFromDirPathAbsolute( |
| ... | @@ -331,6 +332,19 @@ const MapContext = struct { | ... | @@ -331,6 +332,19 @@ const MapContext = struct { |
| 331 | } | 332 | } |
| 332 | }; | 333 | }; |
| 333 | | 334 | |
| | 335 | test "addCertsFromDirPath compiles and accepts an empty directory" { |
| | 336 | const io = std.testing.io; |
| | 337 | const gpa = std.testing.allocator; |
| | 338 | |
| | 339 | var tmp = std.testing.tmpDir(.{ .iterate = true }); |
| | 340 | defer tmp.cleanup(); |
| | 341 | |
| | 342 | var bundle: Bundle = .empty; |
| | 343 | defer bundle.deinit(gpa); |
| | 344 | |
| | 345 | try bundle.addCertsFromDirPath(gpa, io, tmp.dir, "."); |
| | 346 | } |
| | 347 | |
| 334 | test "scan for OS-provided certificates" { | 348 | test "scan for OS-provided certificates" { |
| 335 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | 349 | if (builtin.os.tag == .wasi) return error.SkipZigTest; |
| 336 | | 350 | |