mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
don't character diff emojis
This commit is contained in:
@@ -4543,7 +4543,11 @@ pub const JSValue = enum(JSValueReprInt) {
|
||||
};
|
||||
|
||||
pub fn determineDiffMethod(this: JSValue, other: JSValue, global: *JSGlobalObject) DiffMethod {
|
||||
if ((this.isString() and other.isString()) or (this.isBuffer(global) and other.isBuffer(global))) return .character;
|
||||
if ((this.isString() and other.isString())) {
|
||||
if (this.toString(global).is8Bit() and other.toString(global).is8Bit()) return .character;
|
||||
return .none;
|
||||
}
|
||||
if (this.isBuffer(global) and other.isBuffer(global)) return .character;
|
||||
if ((this.isRegExp() and other.isObject()) or (this.isObject() and other.isRegExp())) return .character;
|
||||
if (this.isObject() and other.isObject()) return .line;
|
||||
|
||||
|
||||
@@ -1914,6 +1914,22 @@ describe("expect()", () => {
|
||||
expect(1).not.toBe("1");
|
||||
expect("hello test").toBe("hello test");
|
||||
expect("hello test").not.toBe("hello test2");
|
||||
|
||||
expect(() => {
|
||||
expect("🟢🟢🟢").toBe("🔴🔴🔴");
|
||||
}).toThrow("🔴🔴🔴");
|
||||
expect(() => {
|
||||
expect(String("🟢🟢🟢")).toBe(String("🔴🔴🔴"));
|
||||
}).toThrow("🔴🔴🔴");
|
||||
expect(() => {
|
||||
expect(new String("🟢🟢🟢")).toBe(String("🔴🔴🔴"));
|
||||
}).toThrow("🔴🔴🔴");
|
||||
expect(() => {
|
||||
expect(String("🟢🟢🟢")).toBe(new String("🔴🔴🔴"));
|
||||
}).toThrow("🔴🔴🔴");
|
||||
expect(() => {
|
||||
expect(new String("🟢🟢🟢")).toBe(new String("🔴🔴🔴"));
|
||||
}).toThrow("🔴🔴🔴");
|
||||
});
|
||||
|
||||
test("toHaveLength()", () => {
|
||||
|
||||
Reference in New Issue
Block a user