Skip to content

Commit

Permalink
address comments from review
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot authored and ptomato committed Jan 10, 2024
1 parent 2265898 commit 30a6a68
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ class MySetLike {
"ToNumber(size)",
"getting has",
"getting keys",
"calling keys",
"getting next",
// two calls to has
"calling has",
"calling has",
Expand All @@ -117,8 +115,6 @@ class MySetLike {
"ToNumber(size)",
"getting has",
"getting keys",
"calling keys",
"getting next",
// three calls to has
"calling has",
"calling has",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class MySetLike {
"ToNumber(size)",
"getting has",
"getting keys",
// one calls to has
// one call to has
"calling has",
];

Expand Down
96 changes: 24 additions & 72 deletions test/built-ins/Set/prototype/union/set-like-class-order.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ class MySetLike {
}
}

const expectedOrder = [
"getting size",
"ToNumber(size)",
"getting has",
"getting keys",
"calling keys",
"getting next",
// first iteration, has value
"calling next",
"getting done",
"getting value",
// second iteration, has value
"calling next",
"getting done",
"getting value",
// third iteration, has value
"calling next",
"getting done",
"getting value",
// fourth iteration, no value; ends
"calling next",
"getting done",
];

// this is smaller than argument
{
observedOrder = [];
Expand All @@ -65,30 +89,6 @@ class MySetLike {
const s2 = new MySetLike();
const combined = s1.union(s2);

const expectedOrder = [
"getting size",
"ToNumber(size)",
"getting has",
"getting keys",
"calling keys",
"getting next",
// first iteration, has value
"calling next",
"getting done",
"getting value",
// second iteration, has value
"calling next",
"getting done",
"getting value",
// third iteration, has value
"calling next",
"getting done",
"getting value",
// fourth iteration, no value; ends
"calling next",
"getting done",
];

assert.compareArray([...combined], ["a", "d", "b", "c"]);
assert.compareArray(observedOrder, expectedOrder);
}
Expand All @@ -101,30 +101,6 @@ class MySetLike {
const s2 = new MySetLike();
const combined = s1.union(s2);

const expectedOrder = [
"getting size",
"ToNumber(size)",
"getting has",
"getting keys",
"calling keys",
"getting next",
// first iteration, has value
"calling next",
"getting done",
"getting value",
// second iteration, has value
"calling next",
"getting done",
"getting value",
// third iteration, has value
"calling next",
"getting done",
"getting value",
// fourth iteration, no value; ends
"calling next",
"getting done",
];

assert.compareArray([...combined], ["a", "b", "d", "c"]);
assert.compareArray(observedOrder, expectedOrder);
}
Expand All @@ -137,30 +113,6 @@ class MySetLike {
const s2 = new MySetLike();
const combined = s1.union(s2);

const expectedOrder = [
"getting size",
"ToNumber(size)",
"getting has",
"getting keys",
"calling keys",
"getting next",
// first iteration, has value
"calling next",
"getting done",
"getting value",
// second iteration, has value
"calling next",
"getting done",
"getting value",
// third iteration, has value
"calling next",
"getting done",
"getting value",
// fourth iteration, no value; ends
"calling next",
"getting done",
];

assert.compareArray([...combined], ["a", "b", "d", "e", "c"]);
assert.compareArray(observedOrder, expectedOrder);
}

0 comments on commit 30a6a68

Please sign in to comment.