Skip to content

Commit

Permalink
[Tests] Add more Set tests, per #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 12, 2015
1 parent 3d65d78 commit ca2e21f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"eqeqeq": [2, "allow-null"],
"id-length": [2, { "min": 1, "max": 23 }],
"max-depth": [2, 5],
"max-nested-callbacks": [2, 3],
"max-statements": [1, 10],
"no-extra-parens": [1],
"no-implicit-coercion": [2, {
Expand Down
25 changes: 21 additions & 4 deletions test/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,27 @@ test('iterables', function (t) {
var c = new Set();
c.add('a');

st.equal(isEqual(a, b), true, 'equal Set (a, b) are equal');
st.equal(isEqual(b, a), true, 'equal Set (b, a) are equal');
st.equal(isEqual(a, c), false, 'unequal Set (a, c) are not equal');
st.equal(isEqual(b, c), false, 'unequal Set (b, c) are not equal');
st.ok(isEqual(a, b), 'equal Set (a, b) are equal');
st.ok(isEqual(b, a), 'equal Set (b, a) are equal');
st.notOk(isEqual(a, c), 'unequal Set (a, c) are not equal');
st.notOk(isEqual(b, c), 'unequal Set (b, c) are not equal');

st.test('Sets with strings as iterables', function (sst) {
var ab = new Set('ab');
if (ab.size !== 2) {
// work around IE 11 (and others) bug accepting iterables
ab.add('a');
ab.add('b');
}
var ac = new Set('ac');
if (ab.size !== 2) {
// work around IE 11 (and others) bug accepting iterables
ab.add('a');
ab.add('c');
}
st.notOk(isEqual(ab, ac), 'Sets initially populated with different strings are not equal');
sst.end();
});

st.end();
});
Expand Down

0 comments on commit ca2e21f

Please sign in to comment.