Skip to content

Commit

Permalink
test: remove mockall
Browse files Browse the repository at this point in the history
(bug with rust 1.65)
  • Loading branch information
Guillaume CAMUS authored and guiyomh committed Dec 13, 2022
1 parent c45c535 commit be9287b
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 189 deletions.
134 changes: 0 additions & 134 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ vergen = { version = "7.4.3", default-features = false, features = [
"rustc",
] }

[dev-dependencies]
mockall = "0.11.3"
mockall_double = "0.3.0"

[profile.release]
strip = true
opt-level = "s"
Expand Down
1 change: 0 additions & 1 deletion src/chart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
// SPDX-License-Identifier: MIT

pub mod dataset;

47 changes: 1 addition & 46 deletions src/reporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,12 @@ use std::{
path::Path,
};

use crate::utils::fs;
use crate::GraphChoice;
use handlebars::Handlebars;
#[cfg(test)]
use mockall_double::double;
use rust_embed::RustEmbed;
use serde::Serialize;

#[cfg_attr(test, double)]
use crate::utils::fs;

#[derive(RustEmbed)]
#[folder = "templates/"]
struct Templates;
Expand Down Expand Up @@ -52,44 +48,3 @@ pub fn write_report(

Ok(())
}

#[cfg(test)]
mod tests {
use mockall::predicate;

use super::write_report;
use crate::{utils, GraphChoice};
use std::path::{Path, PathBuf};

#[test]
fn write_edge_report() {
let output = Path::new("/tmp/foo");

let mock = utils::mock_fs::write_context();
mock.expect::<PathBuf, String>()
.with(
predicate::function(move |x: &PathBuf| x.eq(&output.join("edge-bundling.html"))),
predicate::always(),
)
.return_once(|_, _| Ok(()));

let result = write_report(output, GraphChoice::Edge, "fake".to_owned());
assert!(result.is_ok())
}

#[test]
fn write_force_directed_report() {
let output = Path::new("/tmp/foo");

let mock = utils::mock_fs::write_context();
mock.expect::<PathBuf, String>()
.with(
predicate::function(move |x: &PathBuf| x.eq(&output.join("force-directed.html"))),
predicate::always(),
)
.return_once(|_, _| Ok(()));

let result = write_report(output, GraphChoice::Directed, "fake".to_owned());
assert!(result.is_ok())
}
}
4 changes: 0 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
#[cfg(test)]
use mockall::automock;

#[cfg_attr(test, automock)]
pub mod fs {
use std::{fs as stdFs, io, path::Path};

Expand Down

0 comments on commit be9287b

Please sign in to comment.