nashorn/test/script/basic/JDK-8011714.js
author sundar
Thu, 13 Mar 2014 15:58:24 +0530
changeset 23374 f470afc89c6c
parent 16938 1a8ffed97564
permissions -rw-r--r--
8015958: DataView constructor is not defined Reviewed-by: attila, hannesw, lagergren
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16938
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     1
/*
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     4
 *
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     8
 *
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    13
 * accompanied this code).
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    14
 *
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    18
 *
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    21
 * questions.
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    22
 */
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    23
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    24
/**
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    25
 * JDK-8011714: Regexp decimal escape handling still not correct
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    26
 *
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    27
 * @test
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    28
 * @run
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    29
 */
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    30
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    31
// \0 should be interpreted as <NUL> character here
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    32
print(/\08/.test("\x008"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    33
print(/[\08]/.test("8"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    34
print(/[\08]/.test("\x00"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    35
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    36
// Can't be converted to octal thus encoded as literal char sequence
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    37
print(/\8/.exec("\\8"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    38
print(/[\8]/.exec("\\"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    39
print(/[\8]/.exec("8"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    40
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    41
// 0471 is too high for an octal escape so it is \047 outside a character class
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    42
// and \\471 inside a character class
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    43
print(/\471/.exec("\x271"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    44
print(/[\471]/.exec("1"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    45
print(/[\471]/.exec("\x27"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    46
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    47
// 0366 is a valid octal escape (246)
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    48
print(/\366/.test("\xf6"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    49
print(/[\366]/.test("\xf6"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    50
print(/[\366]/.test("\xf6"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    51
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    52
// more tests for conversion of invalid backreferences to octal escapes or literals
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    53
print(/(a)(b)(c)(d)\4/.exec("abcdd"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    54
print(/(a)(b)(c)(d)\4x/.exec("abcddx"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    55
print(/(a)(b)(c)(d)\47/.exec("abcdd7"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    56
print(/(a)(b)(c)(d)\47/.exec("abcd\x27"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    57
print(/(a)(b)(c)(d)\47xyz/.exec("abcd\x27xyz"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    58
print(/(a)(b)(c)(d)[\47]/.exec("abcd\x27"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    59
print(/(a)(b)(c)(d)[\47]xyz/.exec("abcd\x27xyz"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    60
print(/(a)(b)(c)(d)\48/.exec("abcd\x048"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    61
print(/(a)(b)(c)(d)\48xyz/.exec("abcd\x048xyz"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    62
print(/(a)(b)(c)(d)[\48]/.exec("abcd\x04"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    63
print(/(a)(b)(c)(d)[\48]xyz/.exec("abcd\x04xyz"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    64
print(/(a)(b)(c)(d)\84/.exec("abcd84"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    65
print(/(a)(b)(c)(d)\84xyz/.exec("abcd84xyz"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    66
print(/(a)(b)(c)(d)[\84]/.exec("abcd8"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    67
print(/(a)(b)(c)(d)[\84]xyz/.exec("abcd8xyz"));
1a8ffed97564 8011714: Regexp decimal escape handling still not correct
hannesw
parents:
diff changeset
    68