Skip to content

Commit

Permalink
Add a test for checking if tests are run single-threadedly.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajantti authored and huacnlee committed Aug 28, 2023
1 parent 1c37eb9 commit 50f1107
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ mod tests {
rust_i18n::i18n!(fallback = "foo");
}

#[test]
fn check_test_environment() {
assert_eq!(
std::env::var("RUST_TEST_THREADS").unwrap_or_else(|_| "0".to_string()),
"1",
"The tests assume that they are run in single-threaded environment because \
setting the locale is a global state. If using cargo version prior to 1.56, \
You should set RUST_TEST_THREADS instead of running with --test-threads."
);
}

#[test]
fn test_load() {
assert!(load_locales("./tests/locales", |_| false)
Expand Down

0 comments on commit 50f1107

Please sign in to comment.