Commit 7628785983

Jari Vetoniemi <jari.vetoniemi@cloudef.pw>
2024-02-15 15:33:08
std: use expectError in dynamic_library tests
1 parent 59e9f52
Changed files (1)
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));
 }