summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Tuple/prototype/toSorted/comparefn-calls.js
blob: e8d65b944515d18d5f25370c6ca56f85c021c2fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// |reftest| skip-if(!this.hasOwnProperty("Tuple"))
var expectedThis = (function() {
  return this;
})();


var sample = #[42, 42, 42, 42, 42];
var calls = [];

var comparefn = function() {
    calls.push([this, arguments]);
};

let result = sample.toSorted(comparefn);

assertEq(calls.length > 0, true);

calls.forEach(function(args) {
    assertEq(args[0], expectedThis);
    assertEq(args[1].length, 2);
    assertEq(args[1][0], 42);
    assertEq(args[1][0], 42);
});

reportCompare(0, 0);