VeriBib-rs/tests/bib_roundtrip.rs

30 lines
1016 B
Rust

use veribib::{}; // Not needed; tests use public functions directly
#[test]
fn bib_round_trip_minimal() {
let src = r#"
@article{evans1960,
author = {William E. Evans},
title = {Some Observations on the Echolocation of the Bottlenose Dolphin},
year = {1960},
journal = {Journal of the Acoustical Society of America},
doi = {10.0000/example}
}
"#;
let f = crate::bib::parse_minimal_bib_fields(src);
assert_eq!(f.author.unwrap().contains("Evans"), true);
let cand = crate::net::Candidate {
title: f.title.clone().unwrap_or_default(),
authors: vec![f.author.unwrap_or_default()],
year: f.year.and_then(|y| y.parse::<i32>().ok()),
venue: f.journal.unwrap_or_default(),
doi: f.doi,
concepts: vec![],
source: "test".into(),
};
let out = crate::bib::bib_entry("evans1960", &cand, "exact", 0.99, "Evans 1960", "echolocation", &[]);
assert!(out.contains("@article{evans1960"));
assert!(out.contains("x_status = {exact}"));
}