Skip to content

Commit 5ca5381

Browse files
committed
[bugfix] Adjust test for Windows
1 parent 491539e commit 5ca5381

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

exist-core/src/test/java/org/exist/xquery/functions/fn/FunEnvironmentTest.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ public void environmentVariable() throws EXistException, XPathException, Permiss
121121
final XQuery xqueryService = pool.getXQueryService();
122122
try (final DBBroker broker = pool.get(Optional.of(pool.getSecurityManager().getSystemSubject()))) {
123123

124-
final String query = "fn:environment-variable('PATH')";
124+
final String query;
125+
if (isWindows()) {
126+
query = "fn:environment-variable('Path')";
127+
} else {
128+
query = "fn:environment-variable('PATH')";
129+
}
130+
125131
final Sequence result = xqueryService.execute(broker, query, null);
126132

127133
if (shouldReturnEmptySequence) {
@@ -131,4 +137,8 @@ public void environmentVariable() throws EXistException, XPathException, Permiss
131137
}
132138
}
133139
}
140+
141+
private static boolean isWindows() {
142+
return System.getProperty("os.name").toLowerCase().startsWith("win");
143+
}
134144
}

0 commit comments

Comments
 (0)