diff options
author | Dan Kegel <[email protected]> | 2022-01-20 13:46:27 -0800 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-01-21 07:39:47 +0100 |
commit | 9c3f9537be5a3a0182ea4fe0b26e8cefa442c815 (patch) | |
tree | a473dacf73647490f73c146a6be247102db3b1c3 /tests | |
parent | f5b792504742111bb2ed37d49d9e0ac2aec9ed11 (diff) | |
download | tinygo-9c3f9537be5a3a0182ea4fe0b26e8cefa442c815.tar.gz tinygo-9c3f9537be5a3a0182ea4fe0b26e8cefa442c815.zip |
os: add stubs for Readlink and File.Seek for baremetal targets, with smoke test.
Test currently enabled on pybadge (chosen at random)
TODO:
- enable test on arduino; currently fails with "interp: ptrtoint integer size..." (#2389)
- enable test on nintendoswitch; currently fails with many missing definitions (#2530)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/os/smoke/smoke_test.go | 27 |
1 files changed, 27 insertions, 0 deletions
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) + } +} |