aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/os/file_other.go8
-rw-r--r--tests/os/smoke/smoke_test.go27
3 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 716d56b33..0fc074515 100644
--- a/Makefile
+++ b/Makefile
@@ -298,6 +298,8 @@ tinygo-bench-wasi-fast:
.PHONY: smoketest
smoketest:
$(TINYGO) version
+ # regression test for #2563
+ cd tests/os/smoke && $(TINYGO) test -c -target=pybadge && rm smoke.test
# test all examples (except pwm)
$(TINYGO) build -size short -o test.hex -target=pca10040 examples/blinky1
@$(MD5SUM) test.hex
diff --git a/src/os/file_other.go b/src/os/file_other.go
index d29fb56a9..e03c2b4fd 100644
--- a/src/os/file_other.go
+++ b/src/os/file_other.go
@@ -62,6 +62,14 @@ func Pipe() (r *File, w *File, err error) {
return nil, nil, ErrNotImplemented
}
+func (f *File) Seek(offset int64, whence int) (ret int64, err error) {
+ return 0, ErrNotImplemented
+}
+
+func Readlink(name string) (string, error) {
+ return "", ErrNotImplemented
+}
+
func tempDir() string {
return "/tmp"
}
diff --git a/tests/os/smoke/smoke_test.go b/tests/os/smoke/smoke_test.go
new file mode 100644
index 000000000..068023d61
--- /dev/null
+++ b/tests/os/smoke/smoke_test.go
@@ -0,0 +1,27 @@
+package os_smoke_test
+
+// Simple smoke tests for the os package or things that depend on it.
+// Intended to catch build tag mistakes affecting bare metal targets.
+
+import (
+ "fmt"
+ "path/filepath"
+ "testing"
+)
+
+// Regression test for https://github.com/tinygo-org/tinygo/issues/2563
+func TestFilepath(t *testing.T) {
+ if filepath.Base("foo/bar") != "bar" {
+ t.Errorf("filepath.Base is very confused")
+ }
+}
+
+// Regression test for https://github.com/tinygo-org/tinygo/issues/2530
+func TestFmt(t *testing.T) {
+ n, err := fmt.Printf("Hello, world!\n")
+ if err != nil {
+ t.Errorf("printf returned error %s", err)
+ } else if n != 14 {
+ t.Errorf("printf returned %d, expected 14", n)
+ }
+}