Skip to content

Commit 3a4c19f

Browse files
committed
Fix tests which failed on Windows because crlf vs lf
1 parent 27d4a43 commit 3a4c19f

File tree

1 file changed

+5
-2
lines changed
  • httpsnippet/src/test/java/io/github/atkawa7/httpsnippet/fixtures

1 file changed

+5
-2
lines changed

httpsnippet/src/test/java/io/github/atkawa7/httpsnippet/fixtures/FixtureTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import lombok.extern.slf4j.Slf4j;
1111

1212
import org.apache.commons.io.FileUtils;
13+
import org.apache.commons.lang3.StringUtils;
1314
import org.junit.jupiter.api.BeforeAll;
1415
import org.junit.jupiter.api.DisplayName;
1516
import org.junit.jupiter.params.ParameterizedTest;
@@ -60,7 +61,7 @@ void testFixtures(Fixture fixture) throws Exception {
6061

6162
Client client = snippet.getClient();
6263
Language language = snippet.getLanguage();
63-
String code = snippet.getCode();
64+
String code = snippet.getCode().replaceAll("\r\n", "\n").trim();
6465
Path codeDir =
6566
Paths.get(
6667
fixtureBuilder.getOutput().toString(),
@@ -71,7 +72,9 @@ void testFixtures(Fixture fixture) throws Exception {
7172
codeDir.toString(),
7273
String.format("%s%s", fixture.getFixtureType().getName(), language.getExtname()));
7374

74-
assertEquals(FileUtils.readFileToString(codePath.toFile()), code);
75+
String expected = FileUtils.readFileToString(codePath.toFile()).replaceAll("\r\n", "\n").trim();
76+
77+
assertEquals(expected, code);
7578
}
7679
}
7780
}

0 commit comments

Comments
 (0)