aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/os
diff options
context:
space:
mode:
authorDan Kegel <[email protected]>2022-04-24 20:20:30 -0700
committerRon Evans <[email protected]>2022-04-25 17:59:39 +0200
commit9239c61edb749216c3fc16fa06f8f1d5a0ae7d79 (patch)
tree8750373ae9d6d89ffbe95303d899eebbf5643a14 /src/os
parent008b373df48cfdb31a628a830046bcc7990af09c (diff)
downloadtinygo-9239c61edb749216c3fc16fa06f8f1d5a0ae7d79.tar.gz
tinygo-9239c61edb749216c3fc16fa06f8f1d5a0ae7d79.zip
TestChdir: avoid cd .., as wasi does not really support it yet. Tiptoes around #2799.
Diffstat (limited to 'src/os')
-rw-r--r--src/os/file_anyos_test.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/os/file_anyos_test.go b/src/os/file_anyos_test.go
index 595d120e8..25fcfd281 100644
--- a/src/os/file_anyos_test.go
+++ b/src/os/file_anyos_test.go
@@ -31,9 +31,14 @@ func TestTempDir(t *testing.T) {
func TestChdir(t *testing.T) {
// create and cd into a new directory
+ oldDir, err := Getwd()
+ if err != nil {
+ t.Errorf("Getwd() returned %v", err)
+ return
+ }
dir := "_os_test_TestChDir"
Remove(dir)
- err := Mkdir(dir, 0755)
+ err = Mkdir(dir, 0755)
defer Remove(dir) // even though not quite sure which directory it will execute in
if err != nil {
t.Errorf("Mkdir(%s, 0755) returned %v", dir, err)
@@ -55,7 +60,9 @@ func TestChdir(t *testing.T) {
t.Errorf("Close %s: %s", file, err)
}
// cd back to original directory
- err = Chdir("..")
+ // TODO: emulate "cd .." in wasi-libc better?
+ //err = Chdir("..")
+ err = Chdir(oldDir)
if err != nil {
t.Errorf("Chdir ..: %s", err)
}