diff options
author | Dan Kegel <[email protected]> | 2021-12-15 21:24:31 -0800 |
---|---|---|
committer | Nia <[email protected]> | 2021-12-16 16:36:53 -0500 |
commit | 51d6ffb3bed7633faf4dd17e5b1d5eb6ad7b5bc0 (patch) | |
tree | 51483df16b5c96397e4ad7c3195fd7b2f1042541 /src/os/os_chmod_test.go | |
parent | 964aa7058aa3e9d0ad8ac32d64bba878610a112e (diff) | |
download | tinygo-51d6ffb3bed7633faf4dd17e5b1d5eb6ad7b5bc0.tar.gz tinygo-51d6ffb3bed7633faf4dd17e5b1d5eb6ad7b5bc0.zip |
os: Chmod: don't test on wasi yet, wasi-libc does not yet support it
Lets "tinygo test -target wasi os" compile, if not pass.
For https://github.com/tinygo-org/tinygo/issues/2369
Diffstat (limited to 'src/os/os_chmod_test.go')
-rw-r--r-- | src/os/os_chmod_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/os/os_chmod_test.go b/src/os/os_chmod_test.go new file mode 100644 index 000000000..eef507c3d --- /dev/null +++ b/src/os/os_chmod_test.go @@ -0,0 +1,27 @@ +// +build !baremetal,!js,!wasi + +// TODO: Move this into os_test.go (as upstream has it) when wasi supports chmod + +package os_test + +import ( + . "os" + "runtime" + "testing" +) + +func TestChmod(t *testing.T) { + f := newFile("TestChmod", t) + defer Remove(f.Name()) + defer f.Close() + // Creation mode is read write + + fm := FileMode(0456) + if runtime.GOOS == "windows" { + fm = FileMode(0444) // read-only file + } + if err := Chmod(f.Name(), fm); err != nil { + t.Fatalf("chmod %s %#o: %s", f.Name(), fm, err) + } + checkMode(t, f.Name(), fm) +} |