mirror of
https://github.com/emkay/parser-6502.git
synced 2025-01-02 17:30:47 +00:00
28 lines
677 B
JavaScript
28 lines
677 B
JavaScript
const tap = require('tap')
|
|
const mona = require('mona')
|
|
const instructionParser = require('../parsers/instruction')
|
|
|
|
tap.test('will parse an instruction', (t) => {
|
|
t.plan(1)
|
|
t.deepEqual(mona.parse(instructionParser(), 'sei'), {
|
|
args: null,
|
|
instruction: 'sei'
|
|
})
|
|
})
|
|
|
|
tap.test('will parse an instruction with args', (t) => {
|
|
t.plan(1)
|
|
t.deepEqual(mona.parse(instructionParser(), 'stx $2000'), {
|
|
args: ['$,2000'],
|
|
instruction: 'stx'
|
|
})
|
|
})
|
|
|
|
tap.test('will parse an instruction with multiple args', (t) => {
|
|
t.plan(1)
|
|
t.deepEqual(mona.parse(instructionParser(), 'lda background3, x'), {
|
|
args: ['background3', 'x'],
|
|
instruction: 'lda'
|
|
})
|
|
})
|