Skip to content

Commit

Permalink
Added test for specific stat case with trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
cgopalan committed Dec 7, 2018
1 parent 20c644f commit c460672
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/os/os_windows_test.go
Expand Up @@ -1010,3 +1010,15 @@ func TestStatOfInvalidName(t *testing.T) {
t.Fatal(`os.Stat("*.go") unexpectedly succeeded`)
}
}

func TestStatOfInvalidNameWithTrailingSlash(t *testing.T) {
const ERROR_INVALID_PARAMETER = syscall.Errno(87)
_, err := os.Stat("doesnotexist/")
if err == nil {
t.Fatal(`os.Stat("doesnotexist/") unexpectedly succeeded`)
}
if perr, ok := err.(*os.PathError); !ok {
t.Errorf("got %v, want %v", perr.Err, ERROR_INVALID_PARAMETER)
}
}

0 comments on commit c460672

Please sign in to comment.