Skip to content

Commit

Permalink
test: use tempfile
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdoret committed Oct 11, 2024
1 parent 9b97574 commit 5164f57
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fuzon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ pub fn gather_terms(readers: Vec<(impl BufRead, RdfFormat)>) -> impl Iterator<It
#[cfg(test)]
mod tests {
use super::*;
use tempfile;

#[test]
fn matcher_from_source() {
Expand All @@ -182,9 +183,9 @@ mod tests {
fn serde() {
let source = vec!["../data/test_schema.ttl"];
let matcher = TermMatcher::from_paths(source).unwrap();
let path = Path::new("test_cache");
let _ = matcher.dump(path);
let loaded = TermMatcher::load(path).unwrap();
let out = tempfile::NamedTempFile::new().unwrap();
let _ = matcher.dump(&out.path());
let loaded = TermMatcher::load(&out.path()).unwrap();
assert_eq!(matcher, loaded);
}
}

0 comments on commit 5164f57

Please sign in to comment.