aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/repro_2005.test.js
blob: bd80ab7dd9fa00e5eb2828c840bcbcd04a65b4c3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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("这是一段的文字");

});