Adding some more checks for CharsetRange tests

This commit is contained in:
Jeff Avallone 2014-12-22 16:16:17 -05:00
parent b35dece228
commit 281ca50d32

View File

@ -5,17 +5,40 @@ import _ from 'lodash';
describe('parser/javascript/charset_range.js', function() { describe('parser/javascript/charset_range.js', function() {
it('parses "a-z" as a CharsetRange', function() { _.forIn({
var parser = new javascript.Parser('a-z'); 'a-z': {
expect(parser.__consume__charset_range()).toEqual(jasmine.objectContaining({ first: jasmine.objectContaining({ textValue: 'a' }),
type: 'charset-range', last: jasmine.objectContaining({ textValue: 'z' })
first: jasmine.objectContaining({ },
textValue: 'a' '\\b-z': {
}), first: jasmine.objectContaining({ textValue: '\\b' }),
last: jasmine.objectContaining({ last: jasmine.objectContaining({ textValue: 'z' })
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([ _.each([