From 9e95aad32431bf74fccfef76e8a16d962a767ad8 Mon Sep 17 00:00:00 2001 From: Horodniceanu Andrei Date: Fri, 22 Mar 2024 09:03:46 +0200 Subject: [PATCH] std/file.d: Don't check for OS-dependent error message in `remove` unittest Signed-off-by: Horodniceanu Andrei --- std/file.d | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/std/file.d b/std/file.d index 5b8925d5eb4..1db779bdf8e 100644 --- a/std/file.d +++ b/std/file.d @@ -1083,6 +1083,7 @@ private void removeImpl(scope const(char)[] name, scope const(FSChar)* namez) @t @safe unittest { import std.exception : collectExceptionMsg, assertThrown; + import std.algorithm.searching : startsWith; string filename = null; // e.g. as returned by File.tmpfile.name @@ -1090,12 +1091,10 @@ private void removeImpl(scope const(char)[] name, scope const(FSChar)* namez) @t { // exact exception message is OS-dependent auto msg = filename.remove.collectExceptionMsg!FileException; - assert("Failed to remove file (null): Bad address" == msg, msg); + assert(msg.startsWith("Failed to remove file (null):"), msg); } else version (Windows) { - import std.algorithm.searching : startsWith; - // don't test exact message on windows, it's language dependent auto msg = filename.remove.collectExceptionMsg!FileException; assert(msg.startsWith("(null):"), msg);