Skip to content

Commit 467feaa

Browse files
committed
Add support for console colors
1 parent 4389a1c commit 467feaa

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/main/java/io/github/utplsql/api/TestRunner.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public class TestRunner {
1515

1616
private List<String> pathList = new ArrayList<>();
1717
private List<Reporter> reporterList = new ArrayList<>();
18+
private boolean colorConsole = false;
1819
private List<String> coverageSchemes = new ArrayList<>();
1920
private List<String> sourceFiles = new ArrayList<>();
2021
private List<String> testFiles = new ArrayList<>();
@@ -36,6 +37,11 @@ public TestRunner addReporter(Reporter reporter) {
3637
return this;
3738
}
3839

40+
public TestRunner colorConsole(boolean colorConsole) {
41+
this.colorConsole = colorConsole;
42+
return this;
43+
}
44+
3945
public TestRunner addReporterList(List<Reporter> reporterList) {
4046
this.reporterList.addAll(reporterList);
4147
return this;
@@ -87,13 +93,16 @@ public void run(Connection conn) throws SQLException {
8793
Array includeObjectsArray = oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST, this.includeObjects.toArray());
8894
Array excludeObjectsArray = oraConn.createARRAY(CustomTypes.UT_VARCHAR2_LIST, this.excludeObjects.toArray());
8995

96+
// Workaround because Oracle JDBC doesn't support passing boolean to stored procedures.
97+
String colorConsoleStr = Boolean.toString(this.colorConsole);
98+
9099
CallableStatement callableStatement = null;
91100
try {
92101
callableStatement = conn.prepareCall(
93102
"BEGIN " +
94103
"ut_runner.run(" +
95-
"a_paths => ?, a_reporters => ?, a_coverage_schemes => ?," +
96-
"a_source_files => ?, a_test_files => ?, " +
104+
"a_paths => ?, a_reporters => ?, a_color_console => " + colorConsoleStr + ", " +
105+
"a_coverage_schemes => ?, a_source_files => ?, a_test_files => ?, " +
97106
"a_include_objects => ?, a_exclude_objects => ?); " +
98107
"END;");
99108
callableStatement.setArray(1, pathArray);

0 commit comments

Comments
 (0)