chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)

This commit is contained in:
runny committed 2026-11-13 17:54:56 +08:00
commit 9097ee699d
5769 files changed
+1446466

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import { changedRange } from './pageReveal.ts'
test('changedRange is the span of the new text that differs', () => {
assert.equal(changedRange('same', 'same'), null)
assert.deepEqual(changedRange('# A\nold line\nend', '# A\nnew text here\nend'), { start: 4, end: 16 },
'the shared "e" before the newline stays outside')
assert.deepEqual(changedRange('abc', 'abXc'), { start: 2, end: 3 }, 'an insertion')
assert.deepEqual(changedRange('abXc', 'abc'), { start: 2, end: 2 }, 'a deletion is an empty span where it was')
assert.deepEqual(changedRange('aaa', 'aaaa'), { start: 3, end: 4 }, 'repeats do not overlap prefix and suffix')
assert.deepEqual(changedRange('', 'new'), { start: 0, end: 3 })
})