Browse Source

+ added a basic JS promise test

Nikolay Nikolov 2 years ago
parent
commit
d2396a848b
1 changed files with 34 additions and 0 deletions
  1. 34 0
      tests/test/wasm/tjspromise1.pp

+ 34 - 0
tests/test/wasm/tjspromise1.pp

@@ -0,0 +1,34 @@
+{ %cpu=wasm32 }
+{ %norun }
+
+library tjspromise1;
+
+var
+  state: double;
+
+function init_state: double; external 'js';
+function compute_delta: double; external 'js' suspending;
+
+procedure init;
+begin
+  state := init_state;
+end;
+
+function get_state: double;
+begin
+  get_state := state;
+end;
+
+function update_state: double;
+begin
+  state := state + compute_delta;
+  update_state := state;
+end;
+
+exports
+  get_state,
+  update_state promising;
+
+begin
+  init;
+end.