mirror of
https://github.com/remko/waforth
synced 2025-01-13 08:01:32 +01:00
Add IMMEDIATE test
This commit is contained in:
parent
b23bf78a45
commit
82e0839b8c
1 changed files with 12 additions and 5 deletions
|
@ -1118,11 +1118,18 @@ function loadTests(wasmModule, arrayToBase64) {
|
|||
});
|
||||
|
||||
describe("IMMEDIATE", () => {
|
||||
it("should make words immediate", () => {
|
||||
run("CREATE FOOBAR IMMEDIATE");
|
||||
loadString("FOOBAR");
|
||||
run("FIND");
|
||||
expect(stack[1]).to.eql(1);
|
||||
it("should make executable words", () => {
|
||||
run(': FOOBAR ." Hello World" ; IMMEDIATE');
|
||||
expect(output).to.eql("");
|
||||
run("FOOBAR 5");
|
||||
expect(stack[0]).to.eql(5);
|
||||
expect(output).to.eql("Hello World");
|
||||
});
|
||||
|
||||
it("should make immediate words", () => {
|
||||
run(': FOOBAR ." Hello World" ; IMMEDIATE');
|
||||
run(': FOO FOOBAR ." Out There" ; IMMEDIATE');
|
||||
expect(output).to.eql("Hello World");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue