mirror of
https://github.com/dlang/phobos.git
synced 2025-04-28 22:21:09 +03:00
Merge pull request #8956 from the-horo/file.d-unittest-fix
std/file.d: Don't check for OS-dependent error message in unittest
This commit is contained in:
commit
fb24ef3d0e
1 changed files with 2 additions and 3 deletions
|
@ -1083,6 +1083,7 @@ private void removeImpl(scope const(char)[] name, scope const(FSChar)* namez) @t
|
||||||
@safe unittest
|
@safe unittest
|
||||||
{
|
{
|
||||||
import std.exception : collectExceptionMsg, assertThrown;
|
import std.exception : collectExceptionMsg, assertThrown;
|
||||||
|
import std.algorithm.searching : startsWith;
|
||||||
|
|
||||||
string filename = null; // e.g. as returned by File.tmpfile.name
|
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
|
// exact exception message is OS-dependent
|
||||||
auto msg = filename.remove.collectExceptionMsg!FileException;
|
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)
|
else version (Windows)
|
||||||
{
|
{
|
||||||
import std.algorithm.searching : startsWith;
|
|
||||||
|
|
||||||
// don't test exact message on windows, it's language dependent
|
// don't test exact message on windows, it's language dependent
|
||||||
auto msg = filename.remove.collectExceptionMsg!FileException;
|
auto msg = filename.remove.collectExceptionMsg!FileException;
|
||||||
assert(msg.startsWith("(null):"), msg);
|
assert(msg.startsWith("(null):"), msg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue