Skip to content

Commit

Permalink
Fix stdin_works... test on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Mar 4, 2019
1 parent 8aa0f44 commit 6b993c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::str::Chars;

use crate::config::{Color, Config, EmitMode, FileName, ReportTactic};
use crate::config::{Color, Config, EmitMode, FileName, NewlineStyle, ReportTactic};
use crate::formatting::{ReportedErrors, SourceFile};
use crate::rustfmt_diff::{make_diff, print_diff, DiffLine, Mismatch, ModifiedChunk, OutputWriter};
use crate::source_file;
Expand Down Expand Up @@ -299,6 +299,7 @@ fn stdin_works_with_modified_lines() {

let input = Input::Text(input.to_owned());
let mut config = Config::default();
config.set().newline_style(NewlineStyle::Unix);
config.set().emit_mode(EmitMode::ModifiedLines);
let mut buf: Vec<u8> = vec![];
{
Expand All @@ -310,8 +311,7 @@ fn stdin_works_with_modified_lines() {
};
assert_eq!(session.errors, errors);
}
let newline = if cfg!(windows) { "\r\n" } else { "\n" };
assert_eq!(buf, output.replace('\n', newline).as_bytes());
assert_eq!(buf, output.as_bytes());
}

#[test]
Expand Down

0 comments on commit 6b993c8

Please sign in to comment.