diff --git a/odata-parser.pegjs b/odata-parser.pegjs index 81400b6..4b825b5 100644 --- a/odata-parser.pegjs +++ b/odata-parser.pegjs @@ -180,12 +180,12 @@ SortProperty = TopOption = 'top=' - value:UnsignedInteger + value:UnsignedIntegerBind { return { name: '$top', value } } SkipOption = 'skip=' - value:UnsignedInteger + value:UnsignedIntegerBind { return { name: '$skip', value } } InlineCountOption = @@ -675,6 +675,10 @@ NumberBind = n:Number { return Bind('Real', n) } +UnsignedIntegerBind = + n:UnsignedInteger + { return Bind('Integer', n) } + Date = type:( 'datetime' diff --git a/test/paging.js b/test/paging.js index 16823b3..564edec 100644 --- a/test/paging.js +++ b/test/paging.js @@ -2,14 +2,21 @@ import * as assert from 'assert'; export default (test) => { describe('Paging', function () { - test('$top=5&$skip=100', function (result) { - it('top should be specified', () => { - assert.equal(result.options.$top, 5); - }); - it('skip should be specified', () => { - assert.equal(result.options.$skip, 100); - }); - }); + test( + '$top=5&$skip=100', + [ + ['Integer', 5], + ['Integer', 100], + ], + function (result) { + it('top should be specified', () => { + assert.deepEqual(result.options.$top, { bind: 0 }); + }); + it('skip should be specified', () => { + assert.deepEqual(result.options.$skip, { bind: 1 }); + }); + }, + ); test('$inlinecount=allpages', (result) => { it('inline should be specified', () => {