test/jdk/java/io/PrintStream/FailingConstructors.java
author dholmes
Wed, 06 Nov 2019 21:18:42 -0500
changeset 58956 9a0a5e70eeb2
parent 48252 77b88d8f8380
permissions -rw-r--r--
8233454: Test fails with assert(!is_init_completed(), "should only happen during init") after JDK-8229516 Reviewed-by: jiefu, dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     1
/*
48252
77b88d8f8380 8183743: Umbrella: add overloads that take a Charset parameter
joehw
parents: 47216
diff changeset
     2
 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     4
 *
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     8
 *
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    13
 * accompanied this code).
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    14
 *
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    18
 *
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    21
 * questions.
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    22
 */
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    23
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    24
/**
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    25
 * @test
48252
77b88d8f8380 8183743: Umbrella: add overloads that take a Charset parameter
joehw
parents: 47216
diff changeset
    26
 * @bug 7000511 8190577
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    27
 * @summary PrintStream, PrintWriter, Formatter, Scanner leave files open when
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    28
 *          exception thrown
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    29
 */
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    30
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    31
import java.io.File;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    32
import java.io.FileInputStream;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    33
import java.io.FileOutputStream;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    34
import java.io.FileNotFoundException;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    35
import java.io.IOException;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    36
import java.io.PrintStream;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    37
import java.io.UnsupportedEncodingException;
8559
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    38
import java.nio.file.Files;
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    39
import java.nio.file.Path;
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    40
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    41
public class FailingConstructors {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    42
    static final String fileName = "FailingConstructorsTest";
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    43
    static final String UNSUPPORTED_CHARSET = "unknownCharset";
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    44
    static final String FILE_CONTENTS = "This is a small file!";
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    45
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    46
    private static void realMain(String[] args) throws Throwable {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    47
        test(false, new File(fileName));
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    48
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    49
        /* create the file and write its contents */
8559
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    50
        Path path = Files.createTempFile(fileName, null);
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    51
        try {
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    52
            Files.write(path, FILE_CONTENTS.getBytes());
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    53
            test(true, path.toFile());
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    54
        } finally {
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    55
            Files.delete(path);
826c03991926 7022624: use try-with-resources in java.io tests
smarks
parents: 7966
diff changeset
    56
        }
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    57
    }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    58
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    59
    private static void test(boolean exists, File file) throws Throwable {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    60
        /* PrintStream(File file, String csn) */
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    61
        try {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    62
            new PrintStream(file, UNSUPPORTED_CHARSET);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    63
            fail();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    64
        } catch(FileNotFoundException|UnsupportedEncodingException e) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    65
            pass();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    66
        }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    67
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    68
        check(exists, file);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    69
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    70
        try {
48252
77b88d8f8380 8183743: Umbrella: add overloads that take a Charset parameter
joehw
parents: 47216
diff changeset
    71
            new PrintStream(file, (String)null);
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    72
            fail();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    73
        } catch(FileNotFoundException|NullPointerException e) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    74
            pass();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    75
        }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    76
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    77
        check(exists, file);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    78
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    79
        /* PrintStream(String fileName, String csn)  */
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    80
        try {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    81
            new PrintStream(file.getName(), UNSUPPORTED_CHARSET);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    82
            fail();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    83
        } catch(FileNotFoundException|UnsupportedEncodingException e) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    84
            pass();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    85
        }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    86
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    87
        check(exists, file);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    88
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    89
        try {
48252
77b88d8f8380 8183743: Umbrella: add overloads that take a Charset parameter
joehw
parents: 47216
diff changeset
    90
            new PrintStream(file.getName(), (String)null);
7966
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    91
            fail();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    92
        } catch(FileNotFoundException|NullPointerException e) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    93
            pass();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    94
        }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    95
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    96
        check(exists, file);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    97
    }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    98
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
    99
    private static void check(boolean exists, File file) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   100
        if (exists) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   101
            /* the file should be unchanged */
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   102
            verifyContents(file);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   103
        } else {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   104
            /* the file should not have been created */
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   105
            if (file.exists()) { fail(file + " should not have been created"); }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   106
        }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   107
    }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   108
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   109
    private static void verifyContents(File file) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   110
        try (FileInputStream fis = new FileInputStream(file)) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   111
            byte[] contents = FILE_CONTENTS.getBytes();
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   112
            int read, count = 0;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   113
            while ((read = fis.read()) != -1) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   114
                if (read != contents[count++])  {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   115
                    fail("file contents have been altered");
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   116
                    return;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   117
                }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   118
            }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   119
        } catch (IOException ioe) {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   120
            unexpected(ioe);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   121
        }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   122
    }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   123
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   124
    //--------------------- Infrastructure ---------------------------
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   125
    static volatile int passed = 0, failed = 0;
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   126
    static void pass() {passed++;}
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   127
    static void fail() {failed++; Thread.dumpStack();}
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   128
    static void fail(String message) {System.out.println(message); fail(); }
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   129
    static void unexpected(Throwable t) {failed++; t.printStackTrace();}
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   130
    public static void main(String[] args) throws Throwable {
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   131
        try {realMain(args);} catch (Throwable t) {unexpected(t);}
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   132
        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   133
        if (failed > 0) throw new AssertionError("Some tests failed");}
a23e3f47c5a8 7000511: PrintStream, PrintWriter, Formatter, Scanner leave files open when exception thrown
chegar
parents:
diff changeset
   134
}