pull in and reflect changes from upstream/master

This commit is contained in:
Kunall Banerjee 2017-09-28 18:49:52 -04:00
parent 23caa33a5a
commit 00cfddcd32
2 changed files with 65 additions and 8 deletions

41
test.js
View file

@ -10,7 +10,11 @@ const ErrorSubclassFixture = class extends Error {};
const types = new Map([
['undefined', undefined],
['null', null],
['string', '🦄'],
['string', [
'🦄',
'hello world',
''
]],
['number', [
6,
1.4,
@ -319,3 +323,38 @@ test('is.typedArray', t => {
t.false(m.typedArray([]));
t.false(m.typedArray({}));
});
test('is.inRange', t => {
const x = 3;
t.true(m.inRange(x, [0, 5]));
t.true(m.inRange(x, [5, 0]));
t.true(m.inRange(x, [-5, 5]));
t.true(m.inRange(x, [5, -5]));
t.false(m.inRange(x, [4, 8]));
t.true(m.inRange(-7, [-5, -10]));
t.true(m.inRange(-5, [-5, -10]));
t.true(m.inRange(-10, [-5, -10]));
t.true(m.inRange(x, 10));
t.true(m.inRange(0, 0));
t.true(m.inRange(-2, -3));
t.false(m.inRange(x, 2));
t.false(m.inRange(-3, -2));
t.throws(() => {
m.inRange(0);
});
t.throws(() => {
m.inRange(0, []);
});
t.throws(() => {
m.inRange(0, [5]);
});
t.throws(() => {
m.inRange(0, [1, 2, 3]);
});
});