From 333e140a50658151002c9287aa68855358bedd56 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Jul 2018 15:25:52 +0300 Subject: Mior --- tests/parser.rs | 4 ++-- tests/testutils/Cargo.toml | 1 - tests/testutils/src/lib.rs | 17 +++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/parser.rs b/tests/parser.rs index eb955278e..770610974 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -2,13 +2,13 @@ extern crate libsyntax2; extern crate testutils; use libsyntax2::parse; -use libsyntax2::utils::dump_tree_green; +use libsyntax2::utils::dump_tree; use testutils::dir_tests; #[test] fn parser_tests() { dir_tests(&["parser/inline", "parser/ok", "parser/err"], |text| { let file = parse(text.to_string()); - dump_tree_green(&file) + dump_tree(&file) }) } diff --git a/tests/testutils/Cargo.toml b/tests/testutils/Cargo.toml index 806c3de52..53b20f17b 100644 --- a/tests/testutils/Cargo.toml +++ b/tests/testutils/Cargo.toml @@ -4,5 +4,4 @@ version = "0.1.0" authors = ["Aleksey Kladov "] [dependencies] -file = "1.0" difference = "2.0.0" diff --git a/tests/testutils/src/lib.rs b/tests/testutils/src/lib.rs index 43b806541..7c481156f 100644 --- a/tests/testutils/src/lib.rs +++ b/tests/testutils/src/lib.rs @@ -1,8 +1,9 @@ extern crate difference; -extern crate file; -use std::fs::read_dir; -use std::path::{Path, PathBuf}; +use std::{ + fs, + path::{Path, PathBuf} +}; use difference::Changeset; @@ -18,7 +19,7 @@ use difference::Changeset; /// /// so this should always be correct. fn read_text(path: &Path) -> String { - file::get_text(path).unwrap().replace("\r\n", "\n") + fs::read_to_string(path).unwrap().replace("\r\n", "\n") } pub fn dir_tests(paths: &[&str], f: F) @@ -33,7 +34,7 @@ where println!("\nfile: {}", path.display()); println!("No .txt file with expected result, creating...\n"); println!("{}\n{}", input_code, parse_tree); - file::put_text(&path, parse_tree).unwrap(); + fs::write(&path, parse_tree).unwrap(); panic!("No expected result") } let expected = read_text(&path); @@ -61,7 +62,7 @@ fn collect_tests(paths: &[&str]) -> Vec { fn test_from_dir(dir: &Path) -> Vec { let mut acc = Vec::new(); - for file in read_dir(&dir).unwrap() { + for file in fs::read_dir(&dir).unwrap() { let file = file.unwrap(); let path = file.path(); if path.extension().unwrap_or_default() == "rs" { @@ -80,12 +81,12 @@ fn print_difference(expected: &str, actual: &str, path: &Path) { if expected.trim() == actual.trim() { println!("whitespace difference, rewriting"); println!("file: {}\n", path.display()); - file::put_text(path, actual).unwrap(); + fs::write(path, actual).unwrap(); return; } if REWRITE { println!("rewriting {}", path.display()); - file::put_text(path, actual).unwrap(); + fs::write(path, actual).unwrap(); return; } let changeset = Changeset::new(actual, expected, "\n"); -- cgit v1.2.3