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

@ -469,14 +469,15 @@ impl<'de> DeserializeAs<'de, String> for AccessibilityText {
#[cfg(test)]
mod tests {
use std::{fs::File, io::BufReader, path::Path};
use super::*;
use std::{fs::File, io::BufReader};
use path_macro::path;
use rstest::rstest;
use serde::Deserialize;
use serde_with::serde_as;
use super::*;
#[rstest]
#[case(
r#"{
@ -783,8 +784,7 @@ mod tests {
#[test]
fn t_attributed_description() {
let filename = format!("testfiles/text/attributed_description.json");
let json_path = Path::new(&filename);
let json_path = path!("testfiles" / "text" / "attributed_description.json");
let json_file = File::open(json_path).unwrap();
let res: SAttributed = serde_json::from_reader(BufReader::new(json_file)).unwrap();
insta::assert_debug_snapshot!(res);