nashorn/test/script/basic/JDK-8012460.js
author hannesw
Wed, 25 Jun 2014 14:36:24 +0200
changeset 25243 7a1edca6ce94
parent 17230 b557a1fa5e4b
permissions -rw-r--r--
8048079: Persistent code store is broken after optimistic types merge Reviewed-by: sundar, jlaskey, attila
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17230
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     1
/*
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     4
 *
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     8
 *
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    13
 * accompanied this code).
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    14
 *
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    18
 *
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    21
 * questions.
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    22
 */
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    23
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    24
/**
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    25
 * JDK-8012460: RegExp regression
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    26
 *
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    27
 * @test
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    28
 * @run
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    29
 */
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    30
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    31
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    32
var semver = "\\s*[v=]*\\s*([0-9]+)" // major
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    33
        + "\\.([0-9]+)" // minor
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    34
        + "\\.([0-9]+)" // patch
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    35
        + "(-[0-9]+-?)?" // build
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    36
        + "([a-zA-Z-+][a-zA-Z0-9-\.:]*)?" // tag
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    37
    , exprComparator = "^((<|>)?=?)\s*("+semver+")$|^$";
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    38
var validComparator = new RegExp("^"+exprComparator+"$");
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    39
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    40
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    41
print(exprComparator);
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    42
print(">=0.6.0-".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    43
print("=0.6.0-".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    44
print("0.6.0-".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    45
print("<=0.6.0-".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    46
print(">=0.6.0-a:b-c.d".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    47
print("=0.6.0-a:b-c.d".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    48
print("0.6.0+a:b-c.d".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    49
print("<=0.6.0+a:b-c.d".match(validComparator));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    50
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    51
print(/[a-zA-Z-+]/.exec("a"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    52
print(/[a-zA-Z-+]/.exec("b"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    53
print(/[a-zA-Z-+]/.exec("y"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    54
print(/[a-zA-Z-+]/.exec("z"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    55
print(/[a-zA-Z-+]/.exec("B"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    56
print(/[a-zA-Z-+]/.exec("Y"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    57
print(/[a-zA-Z-+]/.exec("Z"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    58
print(/[a-zA-Z-+]/.exec("-"));
b557a1fa5e4b 8012460: RegExp regression
hannesw
parents:
diff changeset
    59
print(/[a-zA-Z-+]/.exec("+"));