| ... | ... | @@ -106,15 +106,18 @@ const TestContext = struct { |
| 106 | 106 | /// and will be passed a TestContext that can transform a relative path into the path type under test. |
| 107 | 107 | /// The TestContext will also create a tmp directory for you (and will clean it up for you too). |
| 108 | 108 | fn testWithAllSupportedPathTypes(test_func: anytype) !void { |
| 109 | | inline for (@typeInfo(PathType).Enum.fields) |enum_field| { |
| 110 | | const path_type = @field(PathType, enum_field.name); |
| 111 | | if (!(comptime path_type.isSupported(builtin.os))) continue; |
| 109 | try testWithPathTypeIfSupported(.relative, test_func); |
| 110 | try testWithPathTypeIfSupported(.absolute, test_func); |
| 111 | try testWithPathTypeIfSupported(.unc, test_func); |
| 112 | } |
| 112 | 113 | |
| 113 | | var ctx = TestContext.init(path_type, testing.allocator, path_type.getTransformFn()); |
| 114 | | defer ctx.deinit(); |
| 114 | fn testWithPathTypeIfSupported(comptime path_type: PathType, test_func: anytype) !void { |
| 115 | if (!(comptime path_type.isSupported(builtin.os))) return; |
| 115 | 116 | |
| 116 | | try test_func(&ctx); |
| 117 | | } |
| 117 | var ctx = TestContext.init(path_type, testing.allocator, path_type.getTransformFn()); |
| 118 | defer ctx.deinit(); |
| 119 | |
| 120 | try test_func(&ctx); |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | // For use in test setup. If the symlink creation fails on Windows with |