Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

levenshteinDistance doesn't correctly handle code points over U+FFFF #6013

Closed
lionel-rowe opened this issue Sep 18, 2024 · 0 comments · Fixed by #6014
Closed

levenshteinDistance doesn't correctly handle code points over U+FFFF #6013

lionel-rowe opened this issue Sep 18, 2024 · 0 comments · Fixed by #6014
Labels
bug Something isn't working

Comments

@lionel-rowe
Copy link
Contributor

Describe the bug

levenshteinDistance doesn't correctly handle code points over U+FFFF.

Steps to Reproduce

Deno.test("levenshteinDistance() handles code points above U+FFFF", () => {
  assertEquals(levenshteinDistance("💩", "x"), 1);
  assertEquals(levenshteinDistance("x", "💩"), 1);
  // first surrogate same
  assertEquals(levenshteinDistance("💩", "💫"), 1);
  // both surrogates different
  assertEquals(levenshteinDistance("💩", "🦄"), 1);
});

Currently, of the above tests, only "💩", "💫" passes.

Expected behavior

All four cases pass.

Environment

  • OS: Ubuntu 20.04 on WSL
  • deno version: deno 1.46.3
  • std version: @std/text@1.0.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants