aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/repro_2005.test.js
blob: dc0cd9a975cbd8e34d69b28259c8b1035498c32a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
import { it, expect } from "bun:test";

it("regex literal with non-Latin1 should work", () => {
  const text = "这是一段要替换的文字";

  //Correct results: 这是一段的文字
  expect(text.replace(new RegExp("要替换"), "")).toBe("这是一段的文字");

  //Incorrect result: 这是一段要替换的文字
  expect(text.replace(/要替换/, "")).toBe("这是一段的文字");
});