get_reader_for_file

Function get_reader_for_file 

Source
pub fn get_reader_for_file(path: &str) -> Result<BufReader<File>>
Expand description

Get a BufReader for a file. Use for fixtures you never want to change.

Prefer setup::get_file_contents() when you need to compare the contents of a file. Prefer setup::get_read_only_file() when you need a File handle.

Use to avoid random dependencies in test files for rare test cases.

ยงExample

use common_testing::setup;

#[test]
fn test_1() {
  let mut reader = setup::get_reader_for_file("./fixtures/test.txt").unwrap();
  // some test code
}