Skip to content
Snippets Groups Projects
Commit 5278df47 authored by Brian Terlson's avatar Brian Terlson
Browse files

Merge pull request #5 from hankyates/array-from-tests

* array-from-tests:
  Adding test for Array.from
parents 262ce4d0 7edb891f
No related branches found
No related tags found
No related merge requests found
// Copyright (c) 2014 Hank Yates. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*
* @description Testing Array.from when passed a String
* @author Hank Yates (hankyates@gmail.com)
*/
runTestCase(function () {
var arrLikeSource = 'testValue',
testArr = Array.from(arrLikeSource);
if (testArr.length != 9) {
return false;
}
return true;
});
// Copyright (c) 2014 Hank Yates. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*
* @description Testing Array.from when passed an Object is passed
* @author Hank Yates (hankyates@gmail.com)
*/
runTestCase(function () {
var testArr = Array.from({
'a': 1,
'b': '2',
'c': 'three',
'length': '3'
});
if (testArr.length != 3) {
return false;
}
return true;
});
// Copyright (c) 2014 Hank Yates. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*
* @description Testing Array.from when passed an undefined
* @author Hank Yates (hankyates@gmail.com)
* /
runTestCase(function () {
try {
Array.from(undefined);
} catch (e) {
return e instanceof TypeError;
}
return false;
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment