mirror of
https://github.com/kdheepak/taskwarrior-tui.git
synced 2025-08-25 08:47:18 +02:00
Update tests
This commit is contained in:
parent
255490e144
commit
4ee71fd44a
1 changed files with 7 additions and 4 deletions
11
src/app.rs
11
src/app.rs
|
@ -1725,21 +1725,24 @@ pub fn remove_tag(task: &mut Task, tag: String) {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs::File;
|
||||
use std::path::Path;
|
||||
use tui::backend::TestBackend;
|
||||
use tui::buffer::Buffer;
|
||||
|
||||
fn setup() {
|
||||
use std::io::Read;
|
||||
use std::io::Write;
|
||||
use std::process::Stdio;
|
||||
let s = String::from_utf8_lossy(include_bytes!("../tests/data/export.json"));
|
||||
let mut f = File::open(Path::new(env!("TASKDATA")).parent().unwrap().join("export.json")).unwrap();
|
||||
let mut s = String::new();
|
||||
f.read_to_string(&mut s).unwrap();
|
||||
let t = task_hookrs::import::import(s.as_bytes()).unwrap();
|
||||
assert!(task_hookrs::tw::save(&t).is_ok());
|
||||
}
|
||||
|
||||
fn teardown() {
|
||||
use std::ffi::OsStr;
|
||||
use std::path::Path;
|
||||
|
||||
let cd = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/data/.task");
|
||||
std::fs::remove_dir_all(cd).unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue