diff --git a/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T1.js b/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T1.js new file mode 100644 index 0000000000..c3bcf25829 --- /dev/null +++ b/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T1.js @@ -0,0 +1,18 @@ +// 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; +}); diff --git a/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T2.js b/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T2.js new file mode 100644 index 0000000000..e1776536e8 --- /dev/null +++ b/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T2.js @@ -0,0 +1,23 @@ +// 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; + +}); diff --git a/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T3.js b/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T3.js new file mode 100644 index 0000000000..5cc03542e4 --- /dev/null +++ b/test/suite/es6/ch22/22.1/22.1.2/S22.1.2.1_T3.js @@ -0,0 +1,19 @@ +// 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; + +}); +