m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/__tests__
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-22 15:19:32 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-22 15:19:32 -0400
commit034d62f90d9c748f38209991c812692e5a99bbd9 (patch)
tree838d3134bba93dbe46b2ccb3bbce00c41433ab80 /__tests__
parentb84fe7672ad62a7e507b10704fbbd216afaaff44 (diff)
Add test for lexing negatives
Diffstat (limited to '__tests__')
-rw-r--r--__tests__/lexer.test.js13
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([