dir-expect-vm

Action

VM state assertions for testing Rhyme code. Use /expect-vm for clean test syntax

Syntax

dir-expect-vm halted

assert execution is halted (st.halt = true)

dir-expect-vm not halted

assert execution is not halted

dir-expect-vm waiting

assert VM is waiting (st.wait = true)

dir-expect-vm not waiting

assert VM is not waiting

dir-expect-vm stack-depth 2

assert execution stack depth (st.K.length)

dir-expect-vm pc equals 42

assert program counter (st.CF.pc)

dir-expect-vm loop-counter 3

assert loop counter (st.lc) equals N

dir-expect-vm loop-limit 10

assert loop limit (st.ll) equals N

dir-expect-vm loop-index "$i"

assert loop index variable name (st.idx)

dir-expect-vm in-loop

assert currently in a loop (st.ll > 0)

dir-expect-vm not in-loop

assert not in a loop

dir-expect-vm if-result true

assert last if condition (st._IFRES) was true

dir-expect-vm elseif-result true

assert last elseif (st._ELSEIFRES) was true

dir-expect-vm init-ran

assert init block executed (st.initRan)

dir-expect-vm start-ran

assert start block executed (st.startRan)

dir-expect-vm config-ran

assert config executed (st.configRan)

dir-expect-vm state "email.to" equals "[email protected]"

assert generic st.* property equals value

dir-expect-vm state "email.to" contains "@"

assert generic st.* property contains substring

dir-expect-vm state "form.valid" is true

assert generic st.* boolean is true

dir-expect-vm state "cart.items" exists

assert generic st.* property exists

dir-expect-vm state "user" not exists

assert generic st.* property not exists

dir-expect-vm state "scrape.timeout" equals 5000

assert generic st.* property equals numeric value

dir-expect-vm action ".button" exists

assert action is registered in vm.actions (by .an property)

dir-expect-vm action ".nonexistent" does-not-exist

assert action is NOT registered in vm.actions

Developer Reference
Set: unittest
Version: 0.0.0-16
Encoding: T_OP_S8
Actcode: 1830739656
Set ID: 112