diff options
Diffstat (limited to 'third_party/rust/fluent-testing/src/scenarios/missing_optional_one_locale.rs')
-rw-r--r-- | third_party/rust/fluent-testing/src/scenarios/missing_optional_one_locale.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/third_party/rust/fluent-testing/src/scenarios/missing_optional_one_locale.rs b/third_party/rust/fluent-testing/src/scenarios/missing_optional_one_locale.rs new file mode 100644 index 0000000000..3afcec7529 --- /dev/null +++ b/third_party/rust/fluent-testing/src/scenarios/missing_optional_one_locale.rs @@ -0,0 +1,30 @@ +use fluent_fallback::types::{ResourceType, ToResourceId}; + +use super::structs::*; +use crate::queries; + +/// Tests bundle generation with an optional resource that is missing from only the primary locale. +/// Since the resource is optional, we should only fallback to another locale for values in the missing +/// optional resource. We should still be able to use the primary locale for other present values/resources. +pub fn get_scenario() -> Scenario { + Scenario::new( + "missing_optional_one_locale", + vec![ + FileSource::new("browser", "browser/{locale}/", vec!["en-US", "pl"]), + FileSource::new("missing", "missing-resource/{locale}/", vec!["en-US", "pl"]), + ], + vec!["en-US", "pl"], + vec![ + "browser/sanitize.ftl".into(), + "missing/missing-one.ftl".to_resource_id(ResourceType::Optional), + ], + queries![ + ("history-section-label", "History", ExceptionalContext::None), + ( + "missing-one", + "zaginiony", + ExceptionalContext::OptionalResourceMissingFromLocale, + ) + ], + ) +} |