From 22a6e7c0074f852c4015b3f93574d3541bb9e901 Mon Sep 17 00:00:00 2001 From: Greg Tatum Date: Wed, 19 Oct 2022 21:17:29 +0000 Subject: [PATCH] Bug 1773733 - Mark test-only methods as cfg(test); r=nordzilla Differential Revision: https://phabricator.services.mozilla.com/D159439 --- intl/l10n/rust/l10nregistry-rs/src/registry/asynchronous.rs | 2 ++ intl/l10n/rust/l10nregistry-rs/src/registry/mod.rs | 5 +++++ intl/l10n/rust/l10nregistry-rs/src/registry/synchronous.rs | 1 + 3 files changed, 8 insertions(+) diff --git a/intl/l10n/rust/l10nregistry-rs/src/registry/asynchronous.rs b/intl/l10n/rust/l10nregistry-rs/src/registry/asynchronous.rs index b7b7631e0b96..8575c6044f99 100644 --- a/intl/l10n/rust/l10nregistry-rs/src/registry/asynchronous.rs +++ b/intl/l10n/rust/l10nregistry-rs/src/registry/asynchronous.rs @@ -27,6 +27,8 @@ where P: Clone, B: Clone, { + /// This method is useful for testing various configurations. + #[cfg(feature = "test-fluent")] pub fn generate_bundles_for_lang( &self, langid: LanguageIdentifier, diff --git a/intl/l10n/rust/l10nregistry-rs/src/registry/mod.rs b/intl/l10n/rust/l10nregistry-rs/src/registry/mod.rs index 75900648b7a8..adbab9c126e9 100644 --- a/intl/l10n/rust/l10nregistry-rs/src/registry/mod.rs +++ b/intl/l10n/rust/l10nregistry-rs/src/registry/mod.rs @@ -52,6 +52,8 @@ impl<'a, B> L10nRegistryLocked<'a, B> { .expect("Index out-of-range") } + /// Get a [FileSource] by name from a metasource. This is useful for testing. + #[cfg(feature = "test-fluent")] pub fn file_source_by_name(&self, metasource: usize, name: &str) -> Option<&FileSource> { self.lock .get(metasource) @@ -60,6 +62,9 @@ impl<'a, B> L10nRegistryLocked<'a, B> { .find(|&source| source.name == name) } + /// Get an iterator for the [FileSources](FileSource) that match the [LanguageIdentifier] + /// and [ResourceId]. + #[cfg(feature = "test-fluent")] pub fn generate_sources_for_file<'l>( &'l self, metasource: usize, diff --git a/intl/l10n/rust/l10nregistry-rs/src/registry/synchronous.rs b/intl/l10n/rust/l10nregistry-rs/src/registry/synchronous.rs index 27ed1c34f9cb..6a336e8d087c 100644 --- a/intl/l10n/rust/l10nregistry-rs/src/registry/synchronous.rs +++ b/intl/l10n/rust/l10nregistry-rs/src/registry/synchronous.rs @@ -59,6 +59,7 @@ where P: Clone, B: Clone, { + #[cfg(feature = "test-fluent")] pub fn generate_bundles_for_lang_sync( &self, langid: LanguageIdentifier,