fix: throw an error if : omitted unintentionally, #212, #208

This commit is contained in:
harttle
2020-03-31 14:05:38 +08:00
parent c30766ffe1
commit 8daf281fca
14 changed files with 86 additions and 25 deletions
+5
View File
@@ -207,6 +207,11 @@ describe('Tokenize', function () {
expect(token).to.have.property('name', 'plus')
expect(token).to.have.property('args').to.deep.equal([])
})
it('should read null if name not found', function () {
const tokenizer = new Tokenizer('|')
const token = tokenizer.readFilter()
expect(token).to.be.null
})
it('should read a filter with k/v argument', function () {
const tokenizer = new Tokenizer(' | plus: a:1')
const token = tokenizer.readFilter()