chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import test from 'tape'
|
||||
import nlp from '../_lib.js'
|
||||
const here = '[one/pointer-complement] '
|
||||
|
||||
test('pointer-complement-basic :', function (t) {
|
||||
const doc = nlp('ooh. one two three four five six seven')
|
||||
|
||||
// start + end overlap
|
||||
const m = doc.update([[1, 0, 4]])
|
||||
const res = m.complement()
|
||||
t.equal(res.text(), 'ooh. five six seven', here + 'complement-one')
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('complement-match :', function (t) {
|
||||
const str = 'one match two three. four five match six'
|
||||
const doc = nlp(str)
|
||||
|
||||
let res = doc.match('match .').complement()
|
||||
t.deepEqual(res.out('array'), ['one', 'three.', 'four five'], here + 'compliment-multi')
|
||||
|
||||
res = doc.match('one match').complement()
|
||||
t.deepEqual(res.text('machine'), 'two three. four five match six', here + 'compliment-start')
|
||||
|
||||
res = doc.eq(0).complement()
|
||||
t.deepEqual(res.text(), 'four five match six', here + 'compliment-no-n')
|
||||
|
||||
res = doc.match('foo foo').complement()
|
||||
t.deepEqual(res.text(), str, here + 'compliment-of-null')
|
||||
|
||||
res = doc.complement()
|
||||
t.deepEqual(res.text(), '', here + 'compliment-of-all')
|
||||
|
||||
t.end()
|
||||
})
|
||||
Reference in New Issue
Block a user