Skip to content

Commit

Permalink
Add test to rust_i18n::locale.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Jan 22, 2024
1 parent fe72199 commit 37aa93a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

0 comments on commit 37aa93a

Please sign in to comment.