Upstream spencermountain/compromise state of the touched files before d0766255ae
This commit is contained in:
1 parent
7a829e015b
commit
2f2fac89a0
2 files changed
+289
No files matched your search
@@ -0,0 +1,52 @@
|
||||
import test from 'tape'
|
||||
import nlp from '../../lib/one.js'
|
||||
const here = '[one/match/encoding] '
|
||||
|
||||
test('reserved-word-in-src:', function (t) {
|
||||
const r = nlp('buy eggs constructor yeah prototype')
|
||||
t.equal(r.has(`backburner`), false, here + 'single')
|
||||
t.equal(r.has(`#Foo`), false, here + 'tag')
|
||||
t.equal(r.has(`(upcoming|backburner)`), false, here + 'anyOf')
|
||||
t.equal(r.has(`lala+`), false, here + 'manyOf')
|
||||
t.equal(r.has(`nword{2,4}`), false, here + 'someOf')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('reserved-word-in-match:', function (t) {
|
||||
const r = nlp('fo foo fulala repeat')
|
||||
t.equal(r.has(`constructor`), false, here + 'single')
|
||||
t.equal(r.has(`#constructor`), false, here + 'tag')
|
||||
t.equal(r.has(`(upcoming|constructor)`), false, here + 'anyOf')
|
||||
t.equal(r.has(`constructor+`), false, here + 'manyOf')
|
||||
t.equal(r.has(`constructor{2,4}`), false, here + 'someOf')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('test-infinite-loop', function (t) {
|
||||
const weirdDoc = nlp('^ ? * . + $')
|
||||
weirdDoc.match('is?')
|
||||
weirdDoc.match('.?')
|
||||
weirdDoc.match('*')
|
||||
weirdDoc.match('.+')
|
||||
weirdDoc.match('+')
|
||||
weirdDoc.match('?')
|
||||
weirdDoc.match('.')
|
||||
weirdDoc.match('? * . +')
|
||||
weirdDoc.not('?')
|
||||
weirdDoc.not('*')
|
||||
weirdDoc.not('^')
|
||||
weirdDoc.not('$')
|
||||
weirdDoc.not('+')
|
||||
weirdDoc.not('? * . +')
|
||||
t.ok(true, here + 'didnt regress')
|
||||
|
||||
let str = 'And you are?. Marshal'
|
||||
let have = nlp(str).all().out()
|
||||
t.equal(have, str, here + 'regression #1')
|
||||
|
||||
str = `- where is she.Oh. you guys don't know?`
|
||||
have = nlp(str).all().out()
|
||||
t.equal(have, str, here + 'regression #2')
|
||||
|
||||
t.end()
|
||||
})
|
||||
Reference in new issue
Block a user