Skip to content

Commit

Permalink
Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Nov 13, 2023
1 parent cdc6ba0 commit 9787864
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/subscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,15 @@ test('ext: justin', async t => {

test('ext: assignment', async t => {
binary('=', 10, true)
operator('=', (a, b) => ctx => ctx[a] = ctx[b])
operator('=', (a, b) => {
const calc = compile(b);
return ctx => (ctx[a] = calc(ctx))
})

const fn = subscript('a = b')
const fn = subscript('a = b * 2')
let state = { b: 1 }
fn(state)
is(state, { a: 1, b: 1 })
is(state, { a: 2, b: 1 })
})

test('ext: comments', t => {
Expand Down

0 comments on commit 9787864

Please sign in to comment.