summaryrefslogtreecommitdiff
path: root/alacritty_terminal/tests
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2020-03-25 13:08:30 +0100
committerGitHub <noreply@github.com>2020-03-25 15:08:30 +0300
commit69ca8951761cb0f28675963cb49d15200aea4059 (patch)
tree235676b63b8ca27ab46be7f7d1ccbd08a508e6ff /alacritty_terminal/tests
parentc35dbc96575f6147de97be15c5134bc7fabe50bd (diff)
downloadalacritty-69ca8951761cb0f28675963cb49d15200aea4059.tar.gz
alacritty-69ca8951761cb0f28675963cb49d15200aea4059.zip
Remove std::fs::read_to_string reimplementation from tests
Diffstat (limited to 'alacritty_terminal/tests')
-rw-r--r--alacritty_terminal/tests/ref.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/alacritty_terminal/tests/ref.rs b/alacritty_terminal/tests/ref.rs
index 6c693dbf..b5371e58 100644
--- a/alacritty_terminal/tests/ref.rs
+++ b/alacritty_terminal/tests/ref.rs
@@ -1,7 +1,7 @@
use serde::Deserialize;
use serde_json as json;
-use std::fs::File;
+use std::fs::{read_to_string, File};
use std::io::{self, Read};
use std::path::Path;
@@ -75,16 +75,6 @@ where
res
}
-fn read_string<P>(path: P) -> Result<String, ::std::io::Error>
-where
- P: AsRef<Path>,
-{
- let mut res = String::new();
- File::open(path.as_ref()).and_then(|mut f| f.read_to_string(&mut res))?;
-
- Ok(res)
-}
-
#[derive(Deserialize, Default)]
struct RefConfig {
history_size: u32,
@@ -97,9 +87,9 @@ impl EventListener for Mock {
fn ref_test(dir: &Path) {
let recording = read_u8(dir.join("alacritty.recording"));
- let serialized_size = read_string(dir.join("size.json")).unwrap();
- let serialized_grid = read_string(dir.join("grid.json")).unwrap();
- let serialized_cfg = read_string(dir.join("config.json")).unwrap();
+ let serialized_size = read_to_string(dir.join("size.json")).unwrap();
+ let serialized_grid = read_to_string(dir.join("grid.json")).unwrap();
+ let serialized_cfg = read_to_string(dir.join("config.json")).unwrap();
let size: SizeInfo = json::from_str(&serialized_size).unwrap();
let grid: Grid<Cell> = json::from_str(&serialized_grid).unwrap();