Skip to content

Commit bcca217

Browse files
committed
move mopac tests to snapshots and avoid using /tmp directly
also update some parts of the API to use Path instead of &str everywhere
1 parent a70c587 commit bcca217

File tree

6 files changed

+223
-115
lines changed

6 files changed

+223
-115
lines changed

Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ taylor = { path = "crates/taylor" }
1818
# anyway
1919
tensor = { git = "https://github.com/ntBre/tensor" }
2020

21+
anyhow = "1.0.97"
2122
approx = "0.5.1"
2223
assert_cmd = "2.0.16"
2324
clap = { version = "4.5.31", features = ["derive"] }

crates/psqs/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition.workspace = true
66
[dependencies]
77
symm = { workspace = true }
88

9+
anyhow = { workspace = true }
910
jiff = { workspace = true }
1011
libc = { workspace = true }
1112
log = { workspace = true }

crates/psqs/src/program/mopac/mod.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::collections::hash_map::DefaultHasher;
99
use std::fs::{read_to_string, File};
1010
use std::hash::{Hash, Hasher};
1111
use std::io::{BufRead, BufReader, Write};
12+
use std::path::Path;
1213
use std::sync::OnceLock;
1314

1415
/// kcal/mol per hartree
@@ -250,11 +251,12 @@ impl Mopac {
250251
}
251252

252253
/// write the `params` to `filename`
253-
pub fn write_params(params: &Params, filename: &str) {
254-
let mut file = match File::create(filename) {
254+
pub fn write_params(params: &Params, path: impl AsRef<Path>) {
255+
let path = path.as_ref();
256+
let mut file = match File::create(path) {
255257
Ok(f) => f,
256258
Err(e) => {
257-
eprintln!("failed to create {filename} with {e}");
259+
eprintln!("failed to create {path:?} with {e}");
258260
std::process::exit(1);
259261
}
260262
};

0 commit comments

Comments
 (0)