Skip to content

Commit

Permalink
fixed unit tests on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
juerg committed Jan 14, 2024
1 parent a28ba32 commit a1fe6ce
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/test/java/com/github/jlangch/venice/modules/AppModuleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
package com.github.jlangch.venice.modules;

import static com.github.jlangch.venice.impl.util.StringUtil.to_lf;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand Down Expand Up @@ -51,9 +52,9 @@ public void test_base() throws Exception {
FileUtil.mkdir(subdir);

FileUtil.save(
"(do \n" +
" (load-file (io/file \"util\" \"def.venice\")) \n" +
" (println XXX)) ",
"(do \n" +
" (load-file \"util/def.venice\") \n" +
" (println XXX))) ",
new File(dir, "main.venice"),
true);

Expand All @@ -66,23 +67,23 @@ public void test_base() throws Exception {
// ensure there are no Windows backslashes in the string
// file paths!
final String mainFile = new File(dir, "main.venice")
.getAbsolutePath()
.replace('\\', '/');
.getAbsolutePath()
.replace('\\', '/');
final String defFile = new File(subdir, "def.venice")
.getAbsolutePath()
.replace('\\', '/');
final String baseDir = dir.getAbsolutePath()
final String destDir = dir.getAbsolutePath()
.replace('\\', '/');

final String script =
"(do \n"
+ " (load-module :app) \n"
+ " (app/build \n"
+ " \"test\" \n"
+ " \"main.venice\" \n"
+ " { \"main.venice\" \"" + mainFile + "\" \n"
+ " \"util/def.venice\" \"" + defFile + "\" } \n"
+ " \"" + baseDir + "\"))";
"(do \n"
+ " (load-module :app) \n"
+ " (app/build \n"
+ " \"test\" \n"
+ " \"main.venice\" \n"
+ " { \"main.venice\" \"" + mainFile + "\" \n"
+ " \"util/def.venice\" \"" + defFile + "\" } \n"
+ " \"" + destDir + "\"))";

final Map<?,?> result = (Map<?,?>)venice.eval(script);

Expand All @@ -107,8 +108,8 @@ public void test_base() throws Exception {
stdout.flush();
stderr.flush();

assertEquals("100\n", stdout.getOutput());
assertEquals("", stderr.getOutput());
assertEquals("100\n", to_lf(stdout.getOutput()));
assertEquals("", to_lf(stderr.getOutput()));
}
catch(Exception ex) {
throw ex;
Expand Down

0 comments on commit a1fe6ce

Please sign in to comment.