fix: use path_macro in tests/codegen for cross-platform paths

This commit is contained in:
ThetaDev 2022-11-30 10:04:16 +01:00
parent 394f8609a8
commit 64d009615e
25 changed files with 150 additions and 151 deletions

View file

@ -124,7 +124,10 @@ impl MapResponse<SearchResult> for response::Search {
#[cfg(test)]
mod tests {
use std::{fs::File, io::BufReader, path::Path};
use std::{fs::File, io::BufReader};
use path_macro::path;
use rstest::rstest;
use crate::{
client::{response, MapResponse},
@ -133,16 +136,13 @@ mod tests {
serializer::MapResult,
};
use rstest::rstest;
#[rstest]
#[case::default("default")]
#[case::playlists("playlists")]
#[case::empty("empty")]
#[case::ab3_channel_handles("20221121_AB3_channel_handles")]
fn t_map_search(#[case] name: &str) {
let filename = format!("testfiles/search/{}.json", name);
let json_path = Path::new(&filename);
let json_path = path!("testfiles" / "search" / format!("{}.json", name));
let json_file = File::open(json_path).unwrap();
let search: response::Search = serde_json::from_reader(BufReader::new(json_file)).unwrap();