/external/contributions/Google/sputnik_conformance_modified/15_Native/15.5_String_Objects/15.5.4_Properties_of_the_String_Prototype_Object/15.5.4.14_String.prototype.split/S15.5.4.14_A4_T24.js

https://bitbucket.org/beala/test262 · JavaScript · 45 lines · 15 code · 8 blank · 22 comment · 4 complexity · 8c9b843aae7dced2ea8031d695e1452f MD5 · raw file

  1. // Copyright 2009 the Sputnik authors. All rights reserved.
  2. // This code is governed by the BSD license found in the LICENSE file.
  3. /**
  4. * @name: S15.5.4.14_A4_T24;
  5. * @section: 15.5.4.14;
  6. * @assertion: String.prototype.split (separator, limit) returns an Array object into which substrings of the result of converting this object to a string have
  7. * been stored. If separator is a regular expression then
  8. * inside of SplitMatch helper the [[Match]] method of R is called giving it the arguments corresponding;
  9. * @description: Argument is regexp /[a-z]/, and instance is String("abc");
  10. */
  11. var __string = new String("abc");
  12. var __re = /[a-z]/;
  13. var __split = __string.split(__re);
  14. var __expected = ["","","",""];
  15. //////////////////////////////////////////////////////////////////////////////
  16. //CHECK#1
  17. if (__split.constructor !== Array) {
  18. $ERROR('#1: __split.constructor === Array. Actual: '+__split.constructor );
  19. }
  20. //
  21. //////////////////////////////////////////////////////////////////////////////
  22. //////////////////////////////////////////////////////////////////////////////
  23. //CHECK#2
  24. if (__split.length !== __expected.length) {
  25. $ERROR('#2: __split.length === __expected.length. Actual: '+__split.length );
  26. }
  27. //
  28. //////////////////////////////////////////////////////////////////////////////
  29. //////////////////////////////////////////////////////////////////////////////
  30. //CHECK#3
  31. for(var index=0; index<__expected.length; index++) {
  32. if (__split[index] !== __expected[index]) {
  33. $ERROR('#3.'+index+': __split['+index+'] === '+__expected[index]+'. Actual: '+__split[index] );
  34. }
  35. }
  36. //
  37. //////////////////////////////////////////////////////////////////////////////