PageRenderTime 52ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/webview/native/Source/JavaScriptCore/tests/mozilla/js1_2/regexp/endLine.js

https://bitbucket.org/shemnon/openjfx-8-master-rt
JavaScript | 80 lines | 35 code | 11 blank | 34 comment | 1 complexity | 247f3a99f28bc82455b6aa741069c85c MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, BSD-3-Clause, LGPL-2.1
  1. /* The contents of this file are subject to the Netscape Public
  2. * License Version 1.1 (the "License"); you may not use this file
  3. * except in compliance with the License. You may obtain a copy of
  4. * the License at http://www.mozilla.org/NPL/
  5. *
  6. * Software distributed under the License is distributed on an "AS
  7. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  8. * implied. See the License for the specific language governing
  9. * rights and limitations under the License.
  10. *
  11. * The Original Code is Mozilla Communicator client code, released March
  12. * 31, 1998.
  13. *
  14. * The Initial Developer of the Original Code is Netscape Communications
  15. * Corporation. Portions created by Netscape are
  16. * Copyright (C) 1998 Netscape Communications Corporation. All
  17. * Rights Reserved.
  18. *
  19. * Contributor(s):
  20. *
  21. */
  22. /**
  23. Filename: endLine.js
  24. Description: 'Tests regular expressions containing $'
  25. Author: Nick Lerissa
  26. Date: March 10, 1998
  27. */
  28. var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
  29. var VERSION = 'no version';
  30. startTest();
  31. var TITLE = 'RegExp: $';
  32. writeHeaderToLog('Executing script: endLine.js');
  33. writeHeaderToLog( SECTION + " "+ TITLE);
  34. var count = 0;
  35. var testcases = new Array();
  36. // 'abcde'.match(new RegExp('de$'))
  37. testcases[count++] = new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))",
  38. String(["de"]), String('abcde'.match(new RegExp('de$'))));
  39. // 'ab\ncde'.match(new RegExp('..$e$'))
  40. testcases[count++] = new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))",
  41. null, 'ab\ncde'.match(new RegExp('..$e$')));
  42. // 'yyyyy'.match(new RegExp('xxx$'))
  43. testcases[count++] = new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))",
  44. null, 'yyyyy'.match(new RegExp('xxx$')));
  45. // 'a$$$'.match(new RegExp('\\$+$'))
  46. testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))",
  47. String(['$$$']), String('a$$$'.match(new RegExp('\\$+$'))));
  48. // 'a$$$'.match(/\$+$/)
  49. testcases[count++] = new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)",
  50. String(['$$$']), String('a$$$'.match(/\$+$/)));
  51. RegExp.multiline = true;
  52. // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true>
  53. testcases[count++] = new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$','m'))",
  54. String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$','m'))));
  55. function test()
  56. {
  57. for ( tc=0; tc < testcases.length; tc++ ) {
  58. testcases[tc].passed = writeTestCaseResult(
  59. testcases[tc].expect,
  60. testcases[tc].actual,
  61. testcases[tc].description +" = "+
  62. testcases[tc].actual );
  63. testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
  64. }
  65. stopTest();
  66. return ( testcases );
  67. }
  68. test();