Skip to content

Commit

Permalink
Merge branch 'main' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee authored Jan 22, 2024
2 parents 6e67287 + 22e0609 commit eb2bb9e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/support/src/atomic_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,18 @@ impl fmt::Display for AtomicStr {
f.write_str(&self.as_str())
}
}

#[cfg(test)]
mod tests {
use super::*;

fn test_str(s: &str) {
assert_eq!(s, "hello");
}

#[test]
fn test_atomic_str() {
let s = AtomicStr::from("hello");
test_str(&s.as_str());
}
}
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,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(), &CURRENT_LOCALE.as_str());
assert_eq!(locale().deref(), "en");
}
}

0 comments on commit eb2bb9e

Please sign in to comment.