aboutsummaryrefslogtreecommitdiff
path: root/tests/hello_world_worker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/hello_world_worker.cpp')
-rw-r--r--tests/hello_world_worker.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/hello_world_worker.cpp b/tests/hello_world_worker.cpp
new file mode 100644
index 00000000..5ea26d91
--- /dev/null
+++ b/tests/hello_world_worker.cpp
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <emscripten.h>
+
+int main()
+{
+ printf("you should not see this text when in a worker!\n"); // this should not crash, but also should not show up anywhere if you are in a worker
+ emscripten_run_script("if (typeof postMessage !== 'undefined') { postMessage('hello from worker!') }");
+}
+