projectfluent / fluent-rs

Rust implementation of Project Fluent
https://projectfluent.org
Apache License 2.0
1.08k stars 97 forks source link

randomly panic on tests #210

Closed Miezhiko closed 3 years ago

Miezhiko commented 3 years ago
#[cfg(test)]
mod translation_tests {
  use super::*;
  fn help_test_with_lang(lang: &LanguageIdentifier) -> usize {
    let strings = &[
      LOCALES.lookup(lang, "help-description"),
      LOCALES.lookup(lang, "age"),
      LOCALES.lookup(lang, "birthdate"),
      LOCALES.lookup(lang, "amadeus-birthdate"),
      LOCALES.lookup(lang, "blood-type"),
      LOCALES.lookup(lang, "height"),
      LOCALES.lookup(lang, "amadeus-height"),
      LOCALES.lookup(lang, "weight"),
      LOCALES.lookup(lang, "amadeus-weight"),
      LOCALES.lookup(lang, "version"),
      LOCALES.lookup(lang, "user-commands-title")
    ];
  }
}

that test will just panic in test but works fine outside test

I can't debug it, no idea what's happening but if there will be lower count of elements in strings it will pass, that's just very random.

alerque commented 3 years ago

Why did you close this? Did you figure out what the issue was?

Miezhiko commented 3 years ago

@alerque yes, sorry... it was in assert and I just didn't knew that assert panics on fault >_<

alerque commented 3 years ago

Thanks no problem. It's just helpful to have a brief explanation along with issue closed issues.