fork of chmod for windows (from https://github.com/hectane/go-acl)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
550 B

//+build windows
package acl
import (
"io/ioutil"
"os"
"testing"
)
func TestChmod(t *testing.T) {
f, err := ioutil.TempFile(os.TempDir(), "")
if err != nil {
t.Fatal(err)
}
defer os.Remove(f.Name())
if err := Chmod(f.Name(), 0); err != nil {
t.Fatal(err)
}
9 years ago
r, err := os.Open(f.Name())
if err == nil {
9 years ago
r.Close()
t.Fatal("owner able to access file", f.Name())
}
if err := Chmod(f.Name(), 0400); err != nil {
t.Fatal(err)
}
9 years ago
r, err = os.Open(f.Name())
if err != nil {
9 years ago
t.Fatal("owner unable to access file")
}
9 years ago
r.Close()
}