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.

33 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)
}
r, err := os.Open(f.Name())
if err == nil {
r.Close()
t.Fatal("owner able to access file", f.Name())
}
if err := Chmod(f.Name(), 0400); err != nil {
t.Fatal(err)
}
r, err = os.Open(f.Name())
if err != nil {
t.Fatal("owner unable to access file")
}
r.Close()
}