Skip to content

Commit 702b355

Browse files
committed
Attempt to fix Windows CI.
1 parent bdb7453 commit 702b355

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

crates/wac-parser/tests/parser.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ fn compare_result(test: &Path, result: &str, should_fail: bool) -> Result<()> {
5858
}
5959

6060
let expected = fs::read_to_string(&path)
61-
.with_context(|| format!("failed to read result file `{path}`", path = path.display()))?;
61+
.with_context(|| format!("failed to read result file `{path}`", path = path.display()))?
62+
.replace("\r\n", "\n");
6263

6364
if expected != result {
6465
bail!(
@@ -72,7 +73,7 @@ fn compare_result(test: &Path, result: &str, should_fail: bool) -> Result<()> {
7273

7374
fn run_test(test: &Path, ntests: &AtomicUsize) -> Result<()> {
7475
let should_fail = test.parent().map(|p| p.ends_with("fail")).unwrap_or(false);
75-
let source = std::fs::read_to_string(test)?;
76+
let source = std::fs::read_to_string(test)?.replace("\r\n", "\n");
7677
let result = match Document::parse(&source, test) {
7778
Ok(doc) => {
7879
if should_fail {

crates/wac-parser/tests/resolution.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ fn compare_result(test: &Path, result: &str, should_fail: bool) -> Result<()> {
5858
}
5959

6060
let expected = fs::read_to_string(&path)
61-
.with_context(|| format!("failed to read result file `{path}`", path = path.display()))?;
61+
.with_context(|| format!("failed to read result file `{path}`", path = path.display()))?
62+
.replace("\r\n", "\n");
6263

6364
if expected != result {
6465
bail!(
@@ -72,7 +73,7 @@ fn compare_result(test: &Path, result: &str, should_fail: bool) -> Result<()> {
7273

7374
fn run_test(test: &Path, ntests: &AtomicUsize) -> Result<()> {
7475
let should_fail = test.parent().map(|p| p.ends_with("fail")).unwrap_or(false);
75-
let source = std::fs::read_to_string(test)?;
76+
let source = std::fs::read_to_string(test)?.replace("\r\n", "\n");
7677
let document = Document::parse(&source, test)?;
7778
let result = match ResolvedDocument::new(&document, "test:test", None) {
7879
Ok(doc) => {

0 commit comments

Comments
 (0)