from-string.js (760B)
1 // Copyright (c) 2014 Hank Yates. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-array.from 6 description: Testing Array.from when passed a String 7 author: Hank Yates (hankyates@gmail.com) 8 ---*/ 9 10 var arrLikeSource = 'Test'; 11 var result = Array.from(arrLikeSource); 12 13 assert.sameValue(result.length, 4, 'The value of result.length is expected to be 4'); 14 assert.sameValue(result[0], 'T', 'The value of result[0] is expected to be "T"'); 15 assert.sameValue(result[1], 'e', 'The value of result[1] is expected to be "e"'); 16 assert.sameValue(result[2], 's', 'The value of result[2] is expected to be "s"'); 17 assert.sameValue(result[3], 't', 'The value of result[3] is expected to be "t"'); 18 19 reportCompare(0, 0);