summaryrefslogtreecommitdiffstats
path: root/rust-cli/grrs/tests/test_utils.rs
blob: d408e87fa850908610cdeca893f532c7093ca1f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::{fs::{File}, path::Path};

pub fn get_test_file_with_contents(name: &str, contents:&str) -> &File {
    let  path = get_unused_filename();
    return File::open(path);
}

fn get_unused_filename() -> String {
    let files = std::fs::read_dir(Path::new(".")).unwrap();
    let file_suffix = "-testing.txt";
    let mut file_no = 1;
    for file in files {
        let dir = file.unwrap();
    }

    return file_no
        .to_string()
        .to_owned()
        .push_str(&file_suffix);
}