commit 7628785983486c612bcadc9a14bd784b627a5d21 (tree)
parent 59e9f529df75ee89ba7c72e6e5a6df8b35556ab9
Author: Jari Vetoniemi <jari.vetoniemi@cloudef.pw>
Date: Thu, 15 Feb 2024 23:33:08 +0900
std: use expectError in dynamic_library tests
Diffstat:
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig
@@ -319,10 +319,7 @@ test "ElfDynLib" {
return error.SkipZigTest;
}
- _ = ElfDynLib.open("invalid_so.so") catch |err| {
- try testing.expect(err == error.FileNotFound);
- return;
- };
+ try testing.expectError(error.FileNotFound, ElfDynLib.open("invalid_so.so"));
}
pub const WindowsDynLib = struct {
@@ -423,8 +420,5 @@ test "dynamic_library" {
else => return error.SkipZigTest,
};
- _ = DynLib.open(libname) catch |err| {
- try testing.expect(err == error.FileNotFound);
- return;
- };
+ try testing.expectError(error.FileNotFound, DynLib.open(libname));
}