From 281ca50d32ee20971d51f80e34f2b2f04cdabb4c Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Mon, 22 Dec 2014 16:16:17 -0500 Subject: [PATCH] Adding some more checks for CharsetRange tests --- spec/parser/javascript/charset_range_spec.js | 45 +++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/spec/parser/javascript/charset_range_spec.js b/spec/parser/javascript/charset_range_spec.js index e4d1b03..981b291 100644 --- a/spec/parser/javascript/charset_range_spec.js +++ b/spec/parser/javascript/charset_range_spec.js @@ -5,17 +5,40 @@ import _ from 'lodash'; describe('parser/javascript/charset_range.js', function() { - it('parses "a-z" as a CharsetRange', function() { - var parser = new javascript.Parser('a-z'); - expect(parser.__consume__charset_range()).toEqual(jasmine.objectContaining({ - type: 'charset-range', - first: jasmine.objectContaining({ - textValue: 'a' - }), - last: jasmine.objectContaining({ - textValue: 'z' - }) - })); + _.forIn({ + 'a-z': { + first: jasmine.objectContaining({ textValue: 'a' }), + last: jasmine.objectContaining({ textValue: 'z' }) + }, + '\\b-z': { + first: jasmine.objectContaining({ textValue: '\\b' }), + last: jasmine.objectContaining({ textValue: 'z' }) + }, + '\\f-z': { + first: jasmine.objectContaining({ textValue: '\\f' }), + last: jasmine.objectContaining({ textValue: 'z' }) + }, + '\\n-z': { + first: jasmine.objectContaining({ textValue: '\\n' }), + last: jasmine.objectContaining({ textValue: 'z' }) + }, + '\\r-z': { + first: jasmine.objectContaining({ textValue: '\\r' }), + last: jasmine.objectContaining({ textValue: 'z' }) + }, + '\\t-z': { + first: jasmine.objectContaining({ textValue: '\\t' }), + last: jasmine.objectContaining({ textValue: 'z' }) + }, + '\\v-z': { + first: jasmine.objectContaining({ textValue: '\\v' }), + last: jasmine.objectContaining({ textValue: 'z' }) + } + }, (content, str) => { + it(`parses "${str}" as a CharsetRange`, function() { + var parser = new javascript.Parser(str); + expect(parser.__consume__charset_range()).toEqual(jasmine.objectContaining(content)); + }); }); _.each([