tests: put repeated code in function

This commit is contained in:
Simon Gardling
2022-03-09 11:06:15 -05:00
parent aff500202c
commit 7f0c3f95ae
2 changed files with 88 additions and 115 deletions

View File

@@ -183,19 +183,42 @@ lazy_static::lazy_static! {
};
}
// Tests to make sure archived (and compressed) assets match expected data
#[test]
fn test_file_data() {
assert_eq!(FILE_DATA.font_ubuntu_light, FontData::from_owned(include_bytes!("../assets/Ubuntu-Light.ttf").to_vec()));
assert_eq!(FILE_DATA.font_notoemoji, FontData::from_owned(include_bytes!("../assets/NotoEmoji-Regular.ttf").to_vec()));
assert_eq!(FILE_DATA.font_hack, FontData::from_owned(include_bytes!("../assets/Hack-Regular.ttf").to_vec()));
assert_eq!(FILE_DATA.text_help_expr, include_str!("../assets/text_help_expr.txt"));
assert_eq!(FILE_DATA.text_help_vars, include_str!("../assets/text_help_vars.txt"));
assert_eq!(FILE_DATA.text_help_panel, include_str!("../assets/text_help_panel.txt"));
assert_eq!(FILE_DATA.text_help_function, include_str!("../assets/text_help_function.txt"));
assert_eq!(FILE_DATA.text_help_other, include_str!("../assets/text_help_other.txt"));
assert_eq!(
FILE_DATA.font_ubuntu_light,
FontData::from_owned(include_bytes!("../assets/Ubuntu-Light.ttf").to_vec())
);
assert_eq!(
FILE_DATA.font_notoemoji,
FontData::from_owned(include_bytes!("../assets/NotoEmoji-Regular.ttf").to_vec())
);
assert_eq!(
FILE_DATA.font_hack,
FontData::from_owned(include_bytes!("../assets/Hack-Regular.ttf").to_vec())
);
assert_eq!(
FILE_DATA.text_help_expr,
include_str!("../assets/text_help_expr.txt")
);
assert_eq!(
FILE_DATA.text_help_vars,
include_str!("../assets/text_help_vars.txt")
);
assert_eq!(
FILE_DATA.text_help_panel,
include_str!("../assets/text_help_panel.txt")
);
assert_eq!(
FILE_DATA.text_help_function,
include_str!("../assets/text_help_function.txt")
);
assert_eq!(
FILE_DATA.text_help_other,
include_str!("../assets/text_help_other.txt")
);
}
cfg_if::cfg_if! {