Skip to content

Commit 6ff13e4

Browse files
author
Scott Robinson
committed
Make the data from an ExpectFile accessible
1 parent 93b703b commit 6ff13e4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ fn find_str_lit_len(str_lit_to_eof: &str) -> Option<usize> {
434434
impl ExpectFile {
435435
/// Checks if file contents is equal to `actual`.
436436
pub fn assert_eq(&self, actual: &str) {
437-
let expected = self.read();
437+
let expected = self.data();
438438
if actual == expected {
439439
return;
440440
}
@@ -445,7 +445,8 @@ impl ExpectFile {
445445
let actual = format!("{:#?}\n", actual);
446446
self.assert_eq(&actual)
447447
}
448-
fn read(&self) -> String {
448+
/// Returns the content of this expect.
449+
pub fn data(&self) -> String {
449450
fs::read_to_string(self.abs_path()).unwrap_or_default().replace("\r\n", "\n")
450451
}
451452
fn write(&self, contents: &str) {

0 commit comments

Comments
 (0)