PageRenderTime 51ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/js/src/tests/js1_2/regexp/endLine.js

https://bitbucket.org/thinker/mozilla-central
JavaScript | 49 lines | 20 code | 12 blank | 17 comment | 0 complexity | 648102c1b23a4784479570a51c9f03bc MD5 | raw file
Possible License(s): JSON, 0BSD, LGPL-3.0, BSD-2-Clause, MIT, MPL-2.0-no-copyleft-exception, BSD-3-Clause, GPL-2.0, AGPL-1.0, MPL-2.0, Apache-2.0, LGPL-2.1
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. /**
  6. Filename: endLine.js
  7. Description: 'Tests regular expressions containing $'
  8. Author: Nick Lerissa
  9. Date: March 10, 1998
  10. */
  11. var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
  12. var VERSION = 'no version';
  13. startTest();
  14. var TITLE = 'RegExp: $';
  15. writeHeaderToLog('Executing script: endLine.js');
  16. writeHeaderToLog( SECTION + " "+ TITLE);
  17. // 'abcde'.match(new RegExp('de$'))
  18. new TestCase ( SECTION, "'abcde'.match(new RegExp('de$'))",
  19. String(["de"]), String('abcde'.match(new RegExp('de$'))));
  20. // 'ab\ncde'.match(new RegExp('..$e$'))
  21. new TestCase ( SECTION, "'ab\ncde'.match(new RegExp('..$e$'))",
  22. null, 'ab\ncde'.match(new RegExp('..$e$')));
  23. // 'yyyyy'.match(new RegExp('xxx$'))
  24. new TestCase ( SECTION, "'yyyyy'.match(new RegExp('xxx$'))",
  25. null, 'yyyyy'.match(new RegExp('xxx$')));
  26. // 'a$$$'.match(new RegExp('\\$+$'))
  27. new TestCase ( SECTION, "'a$$$'.match(new RegExp('\\$+$'))",
  28. String(['$$$']), String('a$$$'.match(new RegExp('\\$+$'))));
  29. // 'a$$$'.match(/\$+$/)
  30. new TestCase ( SECTION, "'a$$$'.match(/\\$+$/)",
  31. String(['$$$']), String('a$$$'.match(/\$+$/)));
  32. RegExp.multiline = true;
  33. // 'abc\n123xyz890\nxyz'.match(new RegExp('\d+$')) <multiline==true>
  34. new TestCase ( SECTION, "'abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))",
  35. String(['890']), String('abc\n123xyz890\nxyz'.match(new RegExp('\\d+$'))));
  36. test();