~ubuntu-branches/ubuntu/vivid/mozjs24/vivid

« back to all changes in this revision

Viewing changes to js/src/tests/ecma_2/RegExp/octal-001.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-02-11 21:55:34 UTC
  • Revision ID: package-import@ubuntu.com-20140211215534-m1zyq5aj59md3y07
Tags: upstream-24.2.0
ImportĀ upstreamĀ versionĀ 24.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
7
/**
 
8
 *  File Name:          RegExp/octal-001.js
 
9
 *  ECMA Section:       15.7.1
 
10
 *  Description:        Based on ECMA 2 Draft 7 February 1999
 
11
 *  Simple test cases for matching OctalEscapeSequences.
 
12
 *  Author:             christine@netscape.com
 
13
 *  Date:               19 February 1999
 
14
 */
 
15
var SECTION = "RegExp/octal-001.js";
 
16
var VERSION = "ECMA_2";
 
17
var TITLE   = "RegExp patterns that contain OctalEscapeSequences";
 
18
var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
 
19
 
 
20
startTest();
 
21
 
 
22
 
 
23
// backreference
 
24
AddRegExpCases(
 
25
  /(.)\1/,
 
26
  "/(.)\\1/",
 
27
  "HI!!",
 
28
  "HI!",
 
29
  2,
 
30
  ["!!", "!"] );
 
31
 
 
32
test();
 
33
 
 
34
function AddRegExpCases(
 
35
  regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
 
36
 
 
37
  // prevent a runtime error
 
38
 
 
39
  if ( regexp.exec(pattern) == null || matches_array == null ) {
 
40
    AddTestCase(
 
41
      regexp + ".exec(" + str_pattern +")",
 
42
      matches_array,
 
43
      regexp.exec(pattern) );
 
44
 
 
45
    return;
 
46
  }
 
47
  AddTestCase(
 
48
    str_regexp + ".exec(" + str_pattern +").length",
 
49
    matches_array.length,
 
50
    regexp.exec(pattern).length );
 
51
 
 
52
  AddTestCase(
 
53
    str_regexp + ".exec(" + str_pattern +").index",
 
54
    index,
 
55
    regexp.exec(pattern).index );
 
56
 
 
57
  AddTestCase(
 
58
    str_regexp + ".exec(" + str_pattern +").input",
 
59
    pattern,
 
60
    regexp.exec(pattern).input );
 
61
 
 
62
  AddTestCase(
 
63
    str_regexp + ".exec(" + str_pattern +").toString()",
 
64
    matches_array.toString(),
 
65
    regexp.exec(pattern).toString() );
 
66
/*
 
67
  var limit = matches_array.length > regexp.exec(pattern).length
 
68
  ? matches_array.length
 
69
  : regexp.exec(pattern).length;
 
70
 
 
71
  for ( var matches = 0; matches < limit; matches++ ) {
 
72
  AddTestCase(
 
73
  str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
 
74
  matches_array[matches],
 
75
  regexp.exec(pattern)[matches] );
 
76
  }
 
77
*/
 
78
}