Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert that we don't get the value we don't want instead of attempting to check for a specific error code. Fixes #39955 #40019

Merged
merged 1 commit into from
Jul 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ public void NotFoundErrorIsExpected()
// Make sure we're returning the native error as expected (and not the PAL error on Unix)
using (LastError le = new LastError(Path.GetRandomFileName()))
{
// Conveniently ERROR_FILE_NOT_FOUND and ENOENT are both 0x2
Assert.Equal(2, le.Error);
// while ERROR_FILE_NOT_FOUND/ENOENT have predictable values on Windows, Linux and Mac,
// we can't rely on ENOENT having the same value on other platforms. Instead, assert
// that we didn't get the PAL error because we know its value.
const int PAL_Error_ENOENT = 0x1002D;
Assert.NotEqual(PAL_Error_ENOENT, le.Error);
}
}

Expand Down