aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorFederico G. Schwindt <[email protected]>2021-11-25 11:03:24 +0000
committerRon Evans <[email protected]>2021-12-10 09:50:38 +0100
commit08d0dc0d25b267730312d7809ea72e9ca272cd9d (patch)
tree666c72788dce39514addf2014a41532b84ef82d1
parent039186a2a376da94f9b02e8eba9547e240dffcd4 (diff)
downloadtinygo-08d0dc0d25b267730312d7809ea72e9ca272cd9d.tar.gz
tinygo-08d0dc0d25b267730312d7809ea72e9ca272cd9d.zip
Enable Getwd() in wasi and add tests
-rw-r--r--src/syscall/file_emulated.go2
-rw-r--r--src/syscall/file_hosted.go2
-rw-r--r--testdata/filesystem.go8
3 files changed, 10 insertions, 2 deletions
diff --git a/src/syscall/file_emulated.go b/src/syscall/file_emulated.go
index 0185965bb..1fe1103b8 100644
--- a/src/syscall/file_emulated.go
+++ b/src/syscall/file_emulated.go
@@ -1,4 +1,4 @@
-// +build baremetal wasi wasm
+// +build baremetal wasm
// This file emulates some file-related functions that are only available
// under a real operating system.
diff --git a/src/syscall/file_hosted.go b/src/syscall/file_hosted.go
index a7df35490..45b657d18 100644
--- a/src/syscall/file_hosted.go
+++ b/src/syscall/file_hosted.go
@@ -1,4 +1,4 @@
-// +build !baremetal,!wasi,!wasm
+// +build !baremetal,!wasm
// This file assumes there is a libc available that runs on a real operating
// system.
diff --git a/testdata/filesystem.go b/testdata/filesystem.go
index 5f41318e3..1f561ba84 100644
--- a/testdata/filesystem.go
+++ b/testdata/filesystem.go
@@ -34,4 +34,12 @@ func main() {
}
os.Stdout.Write(data)
+
+ path, err := os.Getwd()
+ if err != nil {
+ panic(err)
+ }
+ if path == "" {
+ panic("path is empty")
+ }
}