diff options
author | Ayke van Laethem <[email protected]> | 2021-11-17 17:06:05 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2021-11-17 19:03:20 +0100 |
commit | 51290e5842252fee3a0ebf5d6ebe12a0118e3c4c (patch) | |
tree | 8a639c86b846d2f90bbeb9693cfbc199e0beab81 /main_test.go | |
parent | 22c35c8e313d4f6d3f70066d8711ff88a9bb3dd9 (diff) | |
download | tinygo-51290e5842252fee3a0ebf5d6ebe12a0118e3c4c.tar.gz tinygo-51290e5842252fee3a0ebf5d6ebe12a0118e3c4c.zip |
wasm: support -scheduler=none
Previously, -scheduler=none wasn't possible for WASM targets:
$ tinygo run -target=wasm -scheduler=none ./testdata/stdlib.go
src/runtime/runtime_wasm_js.go:34:2: attempted to start a goroutine without a scheduler
With this commit, it works just fine:
$ tinygo run -target=wasm -scheduler=none ./testdata/stdlib.go
stdin: /dev/stdin
stdout: /dev/stdout
stderr: /dev/stderr
pseudorandom number: 1298498081
strings.IndexByte: 2
strings.Replace: An-example-string
Supporting `-scheduler=none` has some benefits:
* it reduces file size a lot compared to having a scheduler
* it allows JavaScript to call exported functions
Diffstat (limited to 'main_test.go')
-rw-r--r-- | main_test.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/main_test.go b/main_test.go index f4f973f16..d1ef19649 100644 --- a/main_test.go +++ b/main_test.go @@ -164,7 +164,7 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) { t.Parallel() runTest("env.go", options, t, []string{"first", "second"}, []string{"ENV1=VALUE1", "ENV2=VALUE2"}) }) - if options.Target == "wasi" { + if options.Target == "wasi" || options.Target == "wasm" { t.Run("alias.go-scheduler-none", func(t *testing.T) { t.Parallel() options := compileopts.Options(options) |