mirror of
https://github.com/remko/waforth
synced 2024-12-27 09:59:29 +01:00
Implement [']
This commit is contained in:
parent
5c1c33d63d
commit
f17dac3e09
2 changed files with 23 additions and 0 deletions
|
@ -1195,6 +1195,12 @@
|
|||
(i32.store (i32.const !stateBase) (i32.const 0)))
|
||||
(!def_word "[" "$left-bracket" !fImmediate)
|
||||
|
||||
;; 6.1.2510
|
||||
(func $bracket-tick
|
||||
(call $tick)
|
||||
(call $compilePushConst (call $pop)))
|
||||
(!def_word "[']" "$bracket-tick" !fImmediate)
|
||||
|
||||
;; 6.1.2540
|
||||
(func $right-bracket
|
||||
(i32.store (i32.const !stateBase) (i32.const 1)))
|
||||
|
|
|
@ -1264,6 +1264,23 @@ function loadTests(wasmModule, arrayToBase64) {
|
|||
});
|
||||
});
|
||||
|
||||
describe("[']", () => {
|
||||
beforeEach(() => {
|
||||
core.loadPrelude();
|
||||
});
|
||||
|
||||
it("should work", () => {
|
||||
run(': HELLO ." Hello " ;');
|
||||
run(': GOODBYE ." Goodbye " ;');
|
||||
run("VARIABLE 'aloha ' HELLO 'aloha !");
|
||||
run(": ALOHA 'aloha @ EXECUTE ;");
|
||||
run(": GOING ['] GOODBYE 'aloha ! ;");
|
||||
run("GOING");
|
||||
run("ALOHA");
|
||||
expect(output.trim()).to.eql("Goodbye");
|
||||
});
|
||||
});
|
||||
|
||||
describe("system", () => {
|
||||
beforeEach(() => {
|
||||
core.loadPrelude();
|
||||
|
|
Loading…
Reference in a new issue