mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-16 02:33:28 +00:00
TestChdir: avoid cd .., as wasi does not really support it yet. Tiptoes around #2799.
This commit is contained in:
@@ -31,9 +31,14 @@ func TestTempDir(t *testing.T) {
|
|||||||
|
|
||||||
func TestChdir(t *testing.T) {
|
func TestChdir(t *testing.T) {
|
||||||
// create and cd into a new directory
|
// create and cd into a new directory
|
||||||
|
oldDir, err := Getwd()
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Getwd() returned %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
dir := "_os_test_TestChDir"
|
dir := "_os_test_TestChDir"
|
||||||
Remove(dir)
|
Remove(dir)
|
||||||
err := Mkdir(dir, 0755)
|
err = Mkdir(dir, 0755)
|
||||||
defer Remove(dir) // even though not quite sure which directory it will execute in
|
defer Remove(dir) // even though not quite sure which directory it will execute in
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Mkdir(%s, 0755) returned %v", dir, err)
|
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)
|
t.Errorf("Close %s: %s", file, err)
|
||||||
}
|
}
|
||||||
// cd back to original directory
|
// cd back to original directory
|
||||||
err = Chdir("..")
|
// TODO: emulate "cd .." in wasi-libc better?
|
||||||
|
//err = Chdir("..")
|
||||||
|
err = Chdir(oldDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Chdir ..: %s", err)
|
t.Errorf("Chdir ..: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user