kellpossible / cargo-i18n

A Rust Cargo sub-command and libraries to extract and build localization resources to embed in your application/library
MIT License
120 stars 24 forks source link

Intermittent test failures #126

Open fosskers opened 1 month ago

fosskers commented 1 month ago

The following tests within examples/library-fluent fail intermittently on master:

/// Test loading the `en` language.
#[test]
fn test_select_english() {
    localizer().select(&["en".parse().unwrap()]).unwrap();
    assert_eq!("Hello World!", &hello_world())
}

/// Test loading the `fr` language.
#[test]
fn test_select_french() {
    localizer().select(&["fr".parse().unwrap()]).unwrap();
    assert_eq!("Bonjour le monde!", &hello_world())
}

It sometimes takes many runs to see the failure, but it can be seen with:

cargo test --all-features -p library-fluent

The output of which is:

---- test_select_french stdout ----
thread 'test_select_french' panicked at i18n-embed/examples/library-fluent/tests/with_localizer.rs:41:5:
assertion `left == right` failed
  left: "Bonjour le monde!"
 right: "Hello World!"

Sometimes it's the English that fails, sometimes it's the French.

If I had to guess, I'd say something is either:

Neither of which can be done. Perhaps a sort should be done somewhere in the internals?

kellpossible commented 1 month ago

Thanks @fosskers I also noticed this! We should try to fix this soon.