Skip to content

Commit 278d2b8

Browse files
author
alanbchristie
authored
Merge pull request #13 from InformaticsMatters/issue-10
- Initial patch for File.separator regex issue
2 parents 08601c7 + 5f16291 commit 278d2b8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/groovy/Tester.groovy

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* limitations under the License.
1717
*/
1818

19+
import java.util.regex.Pattern
20+
1921
import groovy.json.JsonSlurper
2022
import groovy.text.SimpleTemplateEngine
2123

@@ -36,9 +38,9 @@ class Tester {
3638
// Constants?
3739
int defaultTimeoutSeconds = 60
3840
String testExt = '.test'
39-
String executeAnchorDir = '/src/'
40-
String testFileSpec = "**/*${testExt}"
41-
String testSearchDir = '../../..'
41+
String executeAnchorDir = File.separator + 'src' + File.separator
42+
String testFileSpec = '**' + File.separator + "*${testExt}"
43+
String testSearchDir = '..'+ File.separator + '..' + File.separator + '..'
4244
String sdExt = '.dsd.json'
4345
String optionPrefix = 'arg.'
4446
String metricsFile = 'output_metrics.txt'
@@ -49,8 +51,9 @@ class Tester {
4951
String testPrefix = 'test_'
5052
String ignorePrefix = 'ignore_'
5153

52-
final static String defaultInputPath = '../../data'
53-
final static String defaultOutputPath = System.getProperty('user.dir') + '/tmp/PipelineTester'
54+
final static String defaultInputPath = '..' + File.separator + '..' + File.separator + 'data'
55+
final static String defaultOutputPath = System.getProperty('user.dir') +
56+
File.separator + 'tmp' + File.separator + 'PipelineTester'
5457

5558
// Controlled by setup sections
5659
int testTimeoutSeconds = defaultTimeoutSeconds
@@ -113,7 +116,7 @@ class Tester {
113116

114117
// Reset filename and section number
115118
// along with other test-specific objects
116-
currentTestFilename = path.split(File.separator)[-1]
119+
currentTestFilename = path.split(Pattern.quote(File.separator))[-1]
117120
currentTestFilename = currentTestFilename.
118121
take(currentTestFilename.length() - testExt.length())
119122
sectionNumber = 0
@@ -220,7 +223,7 @@ class Tester {
220223
info('Test files', sprintf('%3s', filesUsed ? filesUsed : '-'))
221224
info('Tests found', sprintf('%3s', testsFound ? testsFound : '-'))
222225
info('Tests passed',sprintf('%3s', testsPassed ? testsPassed : '-'))
223-
info('Tests failed', sprintf('%3s', testsFailed ? failedTests : '-'))
226+
info('Tests failed', sprintf('%3s', testsFailed ? testsFailed : '-'))
224227
info('Tests skipped', sprintf('%3s', testsSkipped ? testsSkipped : '-'))
225228
info('Tests ignored', sprintf('%3s', testsIgnored ? testsIgnored : '-'))
226229
info('Warnings', sprintf('%3s', numWarnings ? numWarnings : '-'))
@@ -516,7 +519,7 @@ class Tester {
516519
*/
517520
private recordFailedTest(testName) {
518521

519-
failedTests.add("${currentTestFilename}/${testName}")
522+
failedTests.add("${currentTestFilename}" + File.separator + "${testName}")
520523

521524
}
522525

0 commit comments

Comments
 (0)