diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 15:19:32 -0400 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 15:19:32 -0400 |
commit | 034d62f90d9c748f38209991c812692e5a99bbd9 (patch) | |
tree | 838d3134bba93dbe46b2ccb3bbce00c41433ab80 /__tests__ | |
parent | b84fe7672ad62a7e507b10704fbbd216afaaff44 (diff) |
Add test for lexing negatives
Diffstat (limited to '__tests__')
-rw-r--r-- | __tests__/lexer.test.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/__tests__/lexer.test.js b/__tests__/lexer.test.js index 12835df..6900764 100644 --- a/__tests__/lexer.test.js +++ b/__tests__/lexer.test.js @@ -125,6 +125,19 @@ describe('lex', () => { }) }) + describe('lexes negatives', () => { + it('-(1d6)', () => { + expect(lex('-(1d6)')).toEqual([ + { type: 'minus' }, + { type: '(' }, + { type: 'constant', value: 1 }, + { type: 'd' }, + { type: 'constant', value: 6 }, + { type: ')' } + ]) + }) + }) + describe('exploding dice', () => { test('1E1d6', () => { expect(lex('1E1d6')).toEqual([ |