Skip to content

Commit

Permalink
Add tests for #5097
Browse files Browse the repository at this point in the history
  • Loading branch information
jackhorton committed May 7, 2018
1 parent 317632b commit 3d90e7e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Runtime/Library/IntlEngineInterfaceExtensionObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2192,10 +2192,10 @@ namespace Js
{
private:
double num;
Field(const char16) *formatted;
Field(const char16 *) formatted;
const charcount_t formattedLength;
Field(ScriptContext) *sc;
Field(UNumberFormatFields) *fields;
Field(ScriptContext *) sc;
Field(UNumberFormatFields *) fields;

static const UNumberFormatFields UnsetField = static_cast<UNumberFormatFields>(0xFFFFFFFF);

Expand Down
12 changes: 12 additions & 0 deletions test/Intl/Collator.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,16 @@ testRunner.runTests([
pairs.forEach((pair) => test(pair[0], pair[1]));
}
},
{
name: "https://github.com/Microsoft/ChakraCore/issues/5097",
body() {
const cases = [0, 1, true, false, null, undefined, { toString() { return "hello!" }}, [1, 2, 3, 4], {}, new (class ToStringTag { get [Symbol.toStringTag]() { return "MyClass" } })];

const coll = new Intl.Collator();
cases.forEach((test) => {
assert.areEqual(0, ("" + test).localeCompare(test), `${test} did not compare equal to itself using String.prototype.localeCompare`);
assert.areEqual(0, coll.compare("" + test, test), `${test} did not compare equal to itself using Collator.prototype.compare`);
});
}
}
], { verbose: !WScript.Arguments.includes("summary") });

0 comments on commit 3d90e7e

Please sign in to comment.