fix: use fixed testfiles location
This commit is contained in:
parent
3a2e4c8abe
commit
7bcff13eb8
20 changed files with 80 additions and 62 deletions
|
|
@ -363,14 +363,18 @@ pub fn b64_decode<T: AsRef<[u8]>>(input: T) -> Result<Vec<u8>, base64::DecodeErr
|
|||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{fs::File, io::BufReader};
|
||||
pub(crate) mod tests {
|
||||
use std::{fs::File, io::BufReader, path::PathBuf};
|
||||
|
||||
use path_macro::path;
|
||||
use rstest::rstest;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Get the path of the `testfiles` directory
|
||||
pub static TESTFILES: Lazy<PathBuf> =
|
||||
Lazy::new(|| path!(env!("CARGO_MANIFEST_DIR") / "testfiles"));
|
||||
|
||||
#[rstest]
|
||||
#[case("1.000", 1000)]
|
||||
#[case("4 Hello World 2", 42)]
|
||||
|
|
@ -450,7 +454,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn t_parse_large_numstr_samples() {
|
||||
let json_path = path!("testfiles" / "dict" / "large_number_samples.json");
|
||||
let json_path = path!(*TESTFILES / "dict" / "large_number_samples.json");
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
let number_samples: BTreeMap<Language, BTreeMap<u8, (String, u64)>> =
|
||||
serde_json::from_reader(BufReader::new(json_file)).unwrap();
|
||||
|
|
@ -464,7 +468,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn t_parse_large_numstr_samples2() {
|
||||
let json_path = path!("testfiles" / "dict" / "large_number_samples_all.json");
|
||||
let json_path = path!(*TESTFILES / "dict" / "large_number_samples_all.json");
|
||||
let json_file = File::open(json_path).unwrap();
|
||||
let number_samples: BTreeMap<Language, BTreeMap<String, u64>> =
|
||||
serde_json::from_reader(BufReader::new(json_file)).unwrap();
|
||||
|
|
|
|||
Reference in a new issue