Skip to content

Commit

Permalink
Clean up test includes for File and Path
Browse files Browse the repository at this point in the history
  • Loading branch information
cjpearce committed Apr 12, 2019
1 parent 9a0f0aa commit b0be60f
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/exercise.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use serde::Deserialize;
use std::fmt::{self, Display, Formatter};
use std::fs::{remove_file};
use std::path::{PathBuf};
use std::process::{self, Command, Output};
use serde::Deserialize;

const RUSTC_COLOR_ARGS: &[&str] = &["--color", "always"];

Expand Down Expand Up @@ -60,13 +60,20 @@ impl Display for Exercise {
}
}

#[test]
fn test_clean() {
std::fs::File::create(&temp_file()).unwrap();
let exercise = Exercise {
path: PathBuf::from("example.rs"),
mode: Mode::Test,
};
exercise.clean();
assert!(!std::path::Path::new(&temp_file()).exists());
#[cfg(test)]
mod test {
use super::*;
use std::path::Path;
use std::fs::File;

#[test]
fn test_clean() {
File::create(&temp_file()).unwrap();
let exercise = Exercise {
path: PathBuf::from("example.rs"),
mode: Mode::Test,
};
exercise.clean();
assert!(!Path::new(&temp_file()).exists());
}
}

0 comments on commit b0be60f

Please sign in to comment.