aoqi@0: /* aoqi@0: * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: /** aoqi@0: * JDK-8011714: Regexp decimal escape handling still not correct aoqi@0: * aoqi@0: * @test aoqi@0: * @run aoqi@0: */ aoqi@0: aoqi@0: // \0 should be interpreted as character here aoqi@0: print(/\08/.test("\x008")); aoqi@0: print(/[\08]/.test("8")); aoqi@0: print(/[\08]/.test("\x00")); aoqi@0: aoqi@0: // Can't be converted to octal thus encoded as literal char sequence aoqi@0: print(/\8/.exec("\\8")); aoqi@0: print(/[\8]/.exec("\\")); aoqi@0: print(/[\8]/.exec("8")); aoqi@0: aoqi@0: // 0471 is too high for an octal escape so it is \047 outside a character class aoqi@0: // and \\471 inside a character class aoqi@0: print(/\471/.exec("\x271")); aoqi@0: print(/[\471]/.exec("1")); aoqi@0: print(/[\471]/.exec("\x27")); aoqi@0: aoqi@0: // 0366 is a valid octal escape (246) aoqi@0: print(/\366/.test("\xf6")); aoqi@0: print(/[\366]/.test("\xf6")); aoqi@0: print(/[\366]/.test("\xf6")); aoqi@0: aoqi@0: // more tests for conversion of invalid backreferences to octal escapes or literals aoqi@0: print(/(a)(b)(c)(d)\4/.exec("abcdd")); aoqi@0: print(/(a)(b)(c)(d)\4x/.exec("abcddx")); aoqi@0: print(/(a)(b)(c)(d)\47/.exec("abcdd7")); aoqi@0: print(/(a)(b)(c)(d)\47/.exec("abcd\x27")); aoqi@0: print(/(a)(b)(c)(d)\47xyz/.exec("abcd\x27xyz")); aoqi@0: print(/(a)(b)(c)(d)[\47]/.exec("abcd\x27")); aoqi@0: print(/(a)(b)(c)(d)[\47]xyz/.exec("abcd\x27xyz")); aoqi@0: print(/(a)(b)(c)(d)\48/.exec("abcd\x048")); aoqi@0: print(/(a)(b)(c)(d)\48xyz/.exec("abcd\x048xyz")); aoqi@0: print(/(a)(b)(c)(d)[\48]/.exec("abcd\x04")); aoqi@0: print(/(a)(b)(c)(d)[\48]xyz/.exec("abcd\x04xyz")); aoqi@0: print(/(a)(b)(c)(d)\84/.exec("abcd84")); aoqi@0: print(/(a)(b)(c)(d)\84xyz/.exec("abcd84xyz")); aoqi@0: print(/(a)(b)(c)(d)[\84]/.exec("abcd8")); aoqi@0: print(/(a)(b)(c)(d)[\84]xyz/.exec("abcd8xyz")); aoqi@0: