OpenJDK / lambda / lambda / jdk
changeset 8417:dd4fca301037
Test for Pattern.asPredicate.
author | psandoz |
---|---|
date | Mon, 29 Apr 2013 14:14:54 +0200 |
parents | d5456784b348 |
children | 95948a87a8e0 |
files | test/java/util/regex/RegExTest.java |
diffstat | 1 files changed, 19 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/test/java/util/regex/RegExTest.java Fri Apr 26 16:10:11 2013 -0700 +++ b/test/java/util/regex/RegExTest.java Mon Apr 29 14:14:54 2013 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -33,13 +33,14 @@ * 5013885 5003322 4988891 5098443 5110268 6173522 4829857 5027748 6376940 * 6358731 6178785 6284152 6231989 6497148 6486934 6233084 6504326 6635133 * 6350801 6676425 6878475 6919132 6931676 6948903 6990617 7014645 7039066 - * 7067045 7014640 7189363 + * 7067045 7014640 7189363 8012646 */ import java.util.regex.*; import java.util.Random; import java.io.*; import java.util.*; +import java.util.function.Predicate; import java.nio.CharBuffer; /** @@ -144,6 +145,7 @@ horizontalAndVerticalWSTest(); linebreakTest(); branchTest(); + patternAsPredicate(); if (failure) { throw new RuntimeException("RegExTest failed, 1st failure: " + @@ -3947,4 +3949,19 @@ report("branchTest"); } + // This test is for 8012646 + private static void patternAsPredicate() throws Exception { + Predicate<String> p = Pattern.compile("[a-z]+").asPredicate(); + + if (p.test("")) { + failCount++; + } + if (!p.test("word")) { + failCount++; + } + if (p.test("1234")) { + failCount++; + } + report("Pattern.asPredicate"); + } }