tests: restore Go 1.7 compatibility
Go 1.7 does not have t.Name() yet.
This commit is contained in:
parent
930c37e03d
commit
84d6fafeca
|
@ -886,7 +886,9 @@ func TestMagicNames(t *testing.T) {
|
||||||
|
|
||||||
// Test that chmod works correctly
|
// Test that chmod works correctly
|
||||||
func TestChmod(t *testing.T) {
|
func TestChmod(t *testing.T) {
|
||||||
path := test_helpers.DefaultPlainDir + "/" + t.Name()
|
// Note: t.Name() is not available before in Go 1.8
|
||||||
|
tName := "TestChmod"
|
||||||
|
path := test_helpers.DefaultPlainDir + "/" + tName
|
||||||
file, err := os.Create(path)
|
file, err := os.Create(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
|
@ -213,7 +213,9 @@ func TestTooLongSymlink(t *testing.T) {
|
||||||
// all directory in the path with O_RDONLY. Now it uses O_PATH, which only needs
|
// all directory in the path with O_RDONLY. Now it uses O_PATH, which only needs
|
||||||
// the executable bit.
|
// the executable bit.
|
||||||
func Test0100Dir(t *testing.T) {
|
func Test0100Dir(t *testing.T) {
|
||||||
dir := dirA + "/" + t.Name()
|
// Note: t.Name() is not available before in Go 1.8
|
||||||
|
tName := "Test0100Dir"
|
||||||
|
dir := dirA + "/" + tName
|
||||||
err := os.Mkdir(dir, 0700)
|
err := os.Mkdir(dir, 0700)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -228,7 +230,7 @@ func Test0100Dir(t *testing.T) {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileReverse := dirC + "/" + t.Name() + "/hello"
|
fileReverse := dirC + "/" + tName + "/hello"
|
||||||
fd, err := os.Open(fileReverse)
|
fd, err := os.Open(fileReverse)
|
||||||
// Make sure the dir can be removed after the test is done
|
// Make sure the dir can be removed after the test is done
|
||||||
os.Chmod(dir, 0700)
|
os.Chmod(dir, 0700)
|
||||||
|
|
Loading…
Reference in New Issue