Skip to content

Commit 2da023d

Browse files
Exit 1 for EncodingTester if test fail
1 parent 0b01c6a commit 2da023d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test-src/nu/validator/htmlparser/test/EncodingTester.java

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ public class EncodingTester {
3939

4040
protected static int SNIFFING_LIMIT = 16384;
4141

42+
private static int exitStatus = 0;
43+
4244
private final InputStream aggregateStream;
4345

4446
private final StringBuilder builder = new StringBuilder();
@@ -74,6 +76,7 @@ private boolean runTest() throws IOException, SAXException {
7476
Charset charset = reader.getCharset();
7577
stream.close();
7678
if (skipLabel()) {
79+
exitStatus = 1;
7780
System.err.println("Premature end of test data.");
7881
return false;
7982
}
@@ -84,6 +87,7 @@ private boolean runTest() throws IOException, SAXException {
8487
case '\n':
8588
break loop;
8689
case -1:
90+
exitStatus = 1;
8791
System.err.println("Premature end of test data.");
8892
return false;
8993
default:
@@ -96,6 +100,7 @@ private boolean runTest() throws IOException, SAXException {
96100
System.err.println("Success.");
97101
// System.err.println(stream);
98102
} else {
103+
exitStatus = 1;
99104
System.err.println("Failure. Expected: " + expected + " got "
100105
+ sniffed + ".");
101106
System.err.println(stream);
@@ -158,6 +163,7 @@ public static void main(String[] args) throws Throwable {
158163
tester.runTests();
159164
}
160165
}
166+
System.exit(exitStatus);
161167
}
162168

163169
}

0 commit comments

Comments
 (0)