Skip to content

Commit

Permalink
feat(diff)!: support deno 2
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Sep 28, 2024
1 parent 2ffcff5 commit 6e9330d
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 91 deletions.
10 changes: 5 additions & 5 deletions diff/deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"./diff": "./diff.ts"
},
"imports": {
"@libs/testing": "jsr:@libs/testing@2"
"@libs/testing": "jsr:@libs/testing@3"
},
"test:permissions": {
"read": true,
Expand All @@ -43,11 +43,11 @@
},
"tasks": {
"test": "deno test --allow-read --allow-run=deno,node,bun,npx --no-prompt --coverage --clean --trace-leaks --doc",
"test:deno": "deno task clean:deno && deno fmt --check && deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js && deno lint",
"test:deno": "deno task clean:deno && deno fmt --check && deno task test --filter='/DENO/' --quiet && deno coverage --exclude=.js && deno lint",
"test:deno-future": "deno task clean:deno && DENO_FUTURE=1 && deno task test:deno",
"test:others": "deno task clean:others && deno fmt --check && deno task test --filter='/^\\[node|bun \\]/' --quiet && deno coverage --exclude=.js && deno lint",
"coverage:html": "deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js --html && sleep 1",
"dev": "deno fmt && deno task test --filter='/^\\[deno\\]/' && deno coverage --exclude=.js --detailed && deno task lint",
"test:others": "deno task clean:others && deno fmt --check && deno task test --filter='/NODE|BUN/' --quiet && deno coverage --exclude=.js && deno lint",
"coverage:html": "deno task test --filter='/DENO/' --quiet && deno coverage --exclude=.js --html && sleep 1",
"dev": "deno fmt && deno task test --filter='/DENO/' && deno coverage --exclude=.js --detailed && deno task lint",
"lint": "deno fmt --check && deno lint && deno doc --lint mod.ts && deno publish --dry-run --quiet --allow-dirty",
"clean:deno": "rm -rf node_modules .npmrc deno.lock",
"clean:others": "rm -rf node_modules .npmrc deno.lock package.json package-lock.json bun.lockb"
Expand Down
162 changes: 88 additions & 74 deletions diff/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions diff/diff_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,62 @@ async function read(test: string) {
return { a: a.replaceAll("\r\n", "\n"), b: b.replaceAll("\r\n", "\n"), c: c.replaceAll("\r\n", "\n") }
}

test("deno")("diff() handles empty texts", async () => {
test("deno")("`diff()` handles empty texts", async () => {
const { a, b, c } = await read("empty")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles empty unchanged texts", async () => {
test("deno")("`diff()` handles empty unchanged texts", async () => {
const { a, b, c } = await read("identical")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles final newline in texts", async () => {
test("deno")("`diff()` handles final newline in texts", async () => {
const { a, b, c } = await read("newline")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles single addition", async () => {
test("deno")("`diff()` handles single addition", async () => {
const { a, b, c } = await read("single/addition")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles additions", async () => {
test("deno")("`diff()` handles additions", async () => {
const { a, b, c } = await read("addition")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles single deletion", async () => {
test("deno")("`diff()` handles single deletion", async () => {
const { a, b, c } = await read("single/deletion")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles deletions", async () => {
test("deno")("`diff()` handles deletions", async () => {
const { a, b, c } = await read("deletion")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles single edition", async () => {
test("deno")("`diff()` handles single edition", async () => {
const { a, b, c } = await read("single/edition")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles editions", async () => {
test("deno")("`diff()` handles editions", async () => {
const { a, b, c } = await read("edition")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles multiple hunks", async () => {
test("deno")("`diff()` handles multiple hunks", async () => {
const { a, b, c } = await read("hunks")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles moved lines", async () => {
test("deno")("`diff()` handles moved lines", async () => {
const { a, b, c } = await read("moved")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

test("deno")("diff() handles complex texts", async () => {
test("deno")("`diff()` handles complex texts", async () => {
const { a, b, c } = await read("lorem")
expect(diff(a, b)).toStrictEqual(c)
}, { permissions: { read: true } })

0 comments on commit 6e9330d

Please sign in to comment.