Skip to content

Commit

Permalink
Make the data from an ExpectFile accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Robinson committed Jul 12, 2023
1 parent 93b703b commit 6ff13e4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ fn find_str_lit_len(str_lit_to_eof: &str) -> Option<usize> {
impl ExpectFile {
/// Checks if file contents is equal to `actual`.
pub fn assert_eq(&self, actual: &str) {
let expected = self.read();
let expected = self.data();
if actual == expected {
return;
}
Expand All @@ -445,7 +445,8 @@ impl ExpectFile {
let actual = format!("{:#?}\n", actual);
self.assert_eq(&actual)
}
fn read(&self) -> String {
/// Returns the content of this expect.
pub fn data(&self) -> String {
fs::read_to_string(self.abs_path()).unwrap_or_default().replace("\r\n", "\n")
}
fn write(&self, contents: &str) {
Expand Down

0 comments on commit 6ff13e4

Please sign in to comment.