From 37aa93a07c0da2ce8286e337fd137874bdec2e29 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 22 Jan 2024 18:49:20 +0800 Subject: [PATCH] Add test to `rust_i18n::locale`. --- src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 707b324..c2c8dbf 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -173,3 +173,18 @@ macro_rules! available_locales { crate::_rust_i18n_available_locales() }; } + +#[cfg(test)] +mod tests { + use crate::{locale, CURRENT_LOCALE}; + + fn assert_locale_type(s: &str, val: &str) { + assert_eq!(s, val); + } + + #[test] + fn test_locale() { + assert_locale_type(locale().as_str(), CURRENT_LOCALE.as_str()); + assert_locale_type(&locale(), CURRENT_LOCALE.as_str()); + } +}