Clean up test includes for File and Path
This commit is contained in:
parent
8c867a001a
commit
77de6e5d6a
@ -1,8 +1,8 @@
|
|||||||
|
use serde::Deserialize;
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
use std::fs::{remove_file};
|
use std::fs::{remove_file};
|
||||||
use std::path::{PathBuf};
|
use std::path::{PathBuf};
|
||||||
use std::process::{self, Command, Output};
|
use std::process::{self, Command, Output};
|
||||||
use serde::Deserialize;
|
|
||||||
|
|
||||||
const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"];
|
const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"];
|
||||||
|
|
||||||
@ -60,13 +60,20 @@ impl Display for Exercise {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod test {
|
||||||
|
use super::*;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::fs::File;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_clean() {
|
fn test_clean() {
|
||||||
std::fs::File::create(&temp_file()).unwrap();
|
File::create(&temp_file()).unwrap();
|
||||||
let exercise = Exercise {
|
let exercise = Exercise {
|
||||||
path: PathBuf::from("example.rs"),
|
path: PathBuf::from("example.rs"),
|
||||||
mode: Mode::Test,
|
mode: Mode::Test,
|
||||||
};
|
};
|
||||||
exercise.clean();
|
exercise.clean();
|
||||||
assert!(!std::path::Path::new(&temp_file()).exists());
|
assert!(!Path::new(&temp_file()).exists());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user