From 4fcaea438981db1857a8b5de179b2b7e44a4dd9c Mon Sep 17 00:00:00 2001 From: James Hugman Date: Tue, 26 Sep 2023 13:19:12 +0100 Subject: [PATCH] Remove channel from the generate-experimenter command of nimbus-fml --- .../nimbus-cli/src/sources/manifest.rs | 2 +- .../src/backends/frontend_manifest.rs | 3 +- .../support/nimbus-fml/src/client/mod.rs | 2 +- .../nimbus-fml/src/command_line/cli.yaml | 4 +- .../nimbus-fml/src/command_line/commands.rs | 1 - .../nimbus-fml/src/command_line/mod.rs | 10 +-- .../nimbus-fml/src/command_line/workflows.rs | 29 +++--- .../support/nimbus-fml/src/defaults_merger.rs | 90 ++++++++++++++----- components/support/nimbus-fml/src/frontend.rs | 5 +- .../src/intermediate_representation.rs | 15 ++-- components/support/nimbus-fml/src/parser.rs | 20 ++--- 11 files changed, 112 insertions(+), 69 deletions(-) diff --git a/components/support/nimbus-cli/src/sources/manifest.rs b/components/support/nimbus-cli/src/sources/manifest.rs index cdd8c3b4c2..f42e2c7d7f 100644 --- a/components/support/nimbus-cli/src/sources/manifest.rs +++ b/components/support/nimbus-cli/src/sources/manifest.rs @@ -90,7 +90,7 @@ impl TryFrom<&ManifestSource> for FeatureManifest { let files = value.manifest_loader()?; let path = files.file_path(value.manifest_file())?; let parser: Parser = Parser::new(files, path)?; - let manifest = parser.get_intermediate_representation(value.channel())?; + let manifest = parser.get_intermediate_representation(Some(value.channel()))?; manifest.validate_manifest()?; Ok(manifest) } diff --git a/components/support/nimbus-fml/src/backends/frontend_manifest.rs b/components/support/nimbus-fml/src/backends/frontend_manifest.rs index be8cdd21b8..fd06b43ead 100644 --- a/components/support/nimbus-fml/src/backends/frontend_manifest.rs +++ b/components/support/nimbus-fml/src/backends/frontend_manifest.rs @@ -18,11 +18,12 @@ impl From for ManifestFrontEnd { let enums = merge(&value, |fm| fm.iter_enum_defs().collect(), |e| &e.name); let about = value.about.description_only(); + let channels = value.channel.into_iter().collect(); ManifestFrontEnd { about: Some(about), version: "1.0.0".to_string(), - channels: vec![value.channel], + channels, includes: Default::default(), imports: Default::default(), features, diff --git a/components/support/nimbus-fml/src/client/mod.rs b/components/support/nimbus-fml/src/client/mod.rs index 3341d442fe..c87f342922 100644 --- a/components/support/nimbus-fml/src/client/mod.rs +++ b/components/support/nimbus-fml/src/client/mod.rs @@ -71,7 +71,7 @@ impl FmlClient { let files = FileLoader::try_from(&config)?; let path = files.file_path(&manifest_path)?; let parser: Parser = Parser::new(files, path)?; - let ir = parser.get_intermediate_representation(&channel)?; + let ir = parser.get_intermediate_representation(Some(&channel))?; ir.validate_manifest()?; Ok(FmlClient { diff --git a/components/support/nimbus-fml/src/command_line/cli.yaml b/components/support/nimbus-fml/src/command_line/cli.yaml index 882b4de79b..73d7752a59 100644 --- a/components/support/nimbus-fml/src/command_line/cli.yaml +++ b/components/support/nimbus-fml/src/command_line/cli.yaml @@ -51,7 +51,9 @@ subcommands: required: true index: 2 - channel: - help: The channel to generate the defaults for + # This is no longer needed, but we keep it for backward compatibility. + required: false + help: "Deprecated: The channel to generate the defaults for. This can be omitted." long: channel takes_value: true - cache-dir: diff --git a/components/support/nimbus-fml/src/command_line/commands.rs b/components/support/nimbus-fml/src/command_line/commands.rs index 08cd892484..070fb898c4 100644 --- a/components/support/nimbus-fml/src/command_line/commands.rs +++ b/components/support/nimbus-fml/src/command_line/commands.rs @@ -32,7 +32,6 @@ pub(crate) struct GenerateExperimenterManifestCmd { pub(crate) output: PathBuf, pub(crate) language: TargetLanguage, pub(crate) load_from_ir: bool, - pub(crate) channel: String, pub(crate) loader: LoaderConfig, } diff --git a/components/support/nimbus-fml/src/command_line/mod.rs b/components/support/nimbus-fml/src/command_line/mod.rs index 288cec8c02..e95ce0def0 100644 --- a/components/support/nimbus-fml/src/command_line/mod.rs +++ b/components/support/nimbus-fml/src/command_line/mod.rs @@ -106,17 +106,13 @@ fn create_generate_command_experimenter_from_cli( let output = file_path("output", matches, cwd).or_else(|_| file_path("OUTPUT", matches, cwd))?; let language = output.as_path().try_into()?; - let channel = matches - .value_of("channel") - .map(str::to_string) - .unwrap_or_else(|| RELEASE_CHANNEL.into()); + let _channel = matches.value_of("channel").map(str::to_string); let loader = create_loader(matches, cwd)?; let cmd = GenerateExperimenterManifestCmd { manifest, output, language, load_from_ir, - channel, loader, }; Ok(cmd) @@ -400,7 +396,6 @@ mod cli_tests { assert!(matches!(cmd, CliCmd::GenerateExperimenter(_))); if let CliCmd::GenerateExperimenter(cmd) = cmd { - assert_eq!(cmd.channel, "release"); assert_eq!(cmd.language, TargetLanguage::ExperimenterYAML); assert!(!cmd.load_from_ir); assert!(cmd.output.ends_with(".experimenter.yaml")); @@ -427,7 +422,6 @@ mod cli_tests { assert!(matches!(cmd, CliCmd::GenerateExperimenter(_))); if let CliCmd::GenerateExperimenter(cmd) = cmd { - assert_eq!(cmd.channel, "test-channel"); assert_eq!(cmd.language, TargetLanguage::ExperimenterYAML); assert!(!cmd.load_from_ir); assert!(cmd.output.ends_with(".experimenter.yaml")); @@ -452,7 +446,6 @@ mod cli_tests { assert!(matches!(cmd, CliCmd::GenerateExperimenter(_))); if let CliCmd::GenerateExperimenter(cmd) = cmd { - assert_eq!(cmd.channel, "release"); assert_eq!(cmd.language, TargetLanguage::ExperimenterJSON); assert!(!cmd.load_from_ir); assert!(cmd.output.ends_with(".experimenter.json")); @@ -483,7 +476,6 @@ mod cli_tests { assert!(matches!(cmd, CliCmd::GenerateExperimenter(_))); if let CliCmd::GenerateExperimenter(cmd) = cmd { - assert_eq!(cmd.channel, "release"); assert_eq!(cmd.language, TargetLanguage::ExperimenterJSON); assert!(!cmd.load_from_ir); assert!(cmd.output.ends_with(".experimenter.json")); diff --git a/components/support/nimbus-fml/src/command_line/workflows.rs b/components/support/nimbus-fml/src/command_line/workflows.rs index c66d4be11b..adb2a48fc1 100644 --- a/components/support/nimbus-fml/src/command_line/workflows.rs +++ b/components/support/nimbus-fml/src/command_line/workflows.rs @@ -76,7 +76,12 @@ fn generate_struct_single( manifest_path: FilePath, cmd: &GenerateStructCmd, ) -> Result<()> { - let ir = load_feature_manifest(files.clone(), manifest_path, cmd.load_from_ir, &cmd.channel)?; + let ir = load_feature_manifest( + files.clone(), + manifest_path, + cmd.load_from_ir, + Some(&cmd.channel), + )?; generate_struct_from_ir(&ir, cmd) } @@ -101,7 +106,7 @@ fn generate_struct_from_ir(ir: &FeatureManifest, cmd: &GenerateStructCmd) -> Res pub(crate) fn generate_experimenter_manifest(cmd: &GenerateExperimenterManifestCmd) -> Result<()> { let files: FileLoader = TryFrom::try_from(&cmd.loader)?; let path = files.file_path(&cmd.manifest)?; - let ir = load_feature_manifest(files, path, cmd.load_from_ir, &cmd.channel)?; + let ir = load_feature_manifest(files, path, cmd.load_from_ir, None)?; backends::experimenter_manifest::generate_manifest(ir, cmd)?; Ok(()) } @@ -109,7 +114,7 @@ pub(crate) fn generate_experimenter_manifest(cmd: &GenerateExperimenterManifestC pub(crate) fn generate_single_file_manifest(cmd: &GenerateSingleFileManifestCmd) -> Result<()> { let files: FileLoader = TryFrom::try_from(&cmd.loader)?; let path = files.file_path(&cmd.manifest)?; - let fm = load_feature_manifest(files, path, false, &cmd.channel)?; + let fm = load_feature_manifest(files, path, false, Some(&cmd.channel))?; let frontend: ManifestFrontEnd = fm.into(); std::fs::write(&cmd.output, serde_yaml::to_string(&frontend)?)?; Ok(()) @@ -119,7 +124,7 @@ fn load_feature_manifest( files: FileLoader, path: FilePath, load_from_ir: bool, - channel: &str, + channel: Option<&str>, ) -> Result { let ir = if !load_from_ir { let parser: Parser = Parser::new(files, path)?; @@ -190,9 +195,8 @@ pub(crate) fn validate(cmd: &ValidateCmd) -> Result<()> { ))?; return Ok(()); } - let intermediate_representation = parser - .get_intermediate_representation(&channels[0]) - .map_err(|e| { + let intermediate_representation = + parser.get_intermediate_representation(None).map_err(|e| { output_err(&term, "Manifest is invalid", &e.to_string()).unwrap(); e })?; @@ -218,7 +222,7 @@ pub(crate) fn validate(cmd: &ValidateCmd) -> Result<()> { let results = channels .iter() .map(|c| { - let intermediate_representation = parser.get_intermediate_representation(c); + let intermediate_representation = parser.get_intermediate_representation(Some(c)); match intermediate_representation { Ok(ir) => (c, ir.validate_manifest()), Err(e) => (c, Err(e)), @@ -305,7 +309,7 @@ mod test { fn generate_struct_cli_overrides(from_cli: AboutBlock, cmd: &GenerateStructCmd) -> Result<()> { let files: FileLoader = TryFrom::try_from(&cmd.loader)?; let path = files.file_path(&cmd.manifest)?; - let mut ir = load_feature_manifest(files, path, cmd.load_from_ir, &cmd.channel)?; + let mut ir = load_feature_manifest(files, path, cmd.load_from_ir, Some(&cmd.channel))?; // We do a dance here to make sure that we can override class names and package names during tests, // and while we still have to support setting those options from the commmand line. @@ -762,7 +766,7 @@ mod test { let cmd = create_experimenter_manifest_cmd("fixtures/fe/importing/simple/app.yaml")?; let files = FileLoader::default()?; let path = files.file_path(&cmd.manifest)?; - let fm = load_feature_manifest(files, path, cmd.load_from_ir, &cmd.channel)?; + let fm = load_feature_manifest(files, path, cmd.load_from_ir, None)?; let m: ExperimenterManifest = fm.try_into()?; assert!(m.contains_key("homescreen")); @@ -893,7 +897,6 @@ mod test { output, language: TargetLanguage::ExperimenterYAML, load_from_ir, - channel: "release".into(), loader, }) } @@ -916,7 +919,7 @@ mod test { // Load the source file, and get the default_json() let files: FileLoader = TryFrom::try_from(&loader)?; let src = files.file_path(&manifest)?; - let fm = load_feature_manifest(files, src, false, channel)?; + let fm = load_feature_manifest(files, src, false, Some(channel))?; let expected = fm.default_json(); // Generate the merged file @@ -931,7 +934,7 @@ mod test { // Reload the generated file, and get the default_json() let dest = FilePath::Local(output); let files: FileLoader = TryFrom::try_from(&loader)?; - let fm = load_feature_manifest(files, dest, false, channel)?; + let fm = load_feature_manifest(files, dest, false, Some(channel))?; let observed = fm.default_json(); // They should be the same. diff --git a/components/support/nimbus-fml/src/defaults_merger.rs b/components/support/nimbus-fml/src/defaults_merger.rs index 25b6ba33be..ccfd3deae2 100644 --- a/components/support/nimbus-fml/src/defaults_merger.rs +++ b/components/support/nimbus-fml/src/defaults_merger.rs @@ -16,14 +16,14 @@ pub struct DefaultsMerger<'object> { objects: &'object BTreeMap, supported_channels: Vec, - channel: String, + channel: Option, } impl<'object> DefaultsMerger<'object> { pub fn new( objects: &'object BTreeMap, supported_channels: Vec, - channel: String, + channel: Option, ) -> Self { Self { objects, @@ -32,6 +32,15 @@ impl<'object> DefaultsMerger<'object> { } } + #[cfg(test)] + pub fn new_with_channel( + objects: &'object BTreeMap, + supported_channels: Vec, + channel: String, + ) -> Self { + Self::new(objects, supported_channels, Some(channel.to_string())) + } + fn collect_feature_defaults(&self, feature: &FeatureDef) -> Result { let mut res = serde_json::value::Map::new(); @@ -167,17 +176,23 @@ impl<'object> DefaultsMerger<'object> { ) -> Result<(), FMLError> { let supported_channels = self.supported_channels.as_slice(); let channel = &self.channel; - if !supported_channels.iter().any(|c| c == channel) { - return Err(FMLError::InvalidChannelError( - channel.into(), - supported_channels.into(), - )); + if let Some(channel) = channel { + if !supported_channels.iter().any(|c| c == channel) { + return Err(FMLError::InvalidChannelError( + channel.into(), + supported_channels.into(), + )); + } } let variable_defaults = self.collect_feature_defaults(feature_def)?; let res = feature_def; if let Some(defaults) = defaults { - let merged_defaults = collect_channel_defaults(defaults, supported_channels)?; + // No channel is represented by an unlikely string. + let no_channel = "NO CHANNEL SPECIFIED".to_string(); + let merged_defaults = + collect_channel_defaults(defaults, supported_channels, &no_channel)?; + let channel = self.channel.as_ref().unwrap_or(&no_channel); if let Some(default_to_merged) = merged_defaults.get(channel) { let merged = merge_two_defaults(&variable_defaults, default_to_merged); let map = merged.as_object().ok_or(FMLError::InternalError( @@ -263,12 +278,14 @@ fn merge_two_defaults( fn collect_channel_defaults( defaults: &[DefaultBlock], channels: &[String], + no_channel: &str, ) -> Result> { // We initialize the map to have an entry for every valid channel let mut channel_map = channels .iter() .map(|channel_name| (channel_name.clone(), json!({}))) .collect::>(); + channel_map.insert(no_channel.to_string(), json!({})); for default in defaults { if let Some(channels_for_default) = &default.merge_channels() { for channel in channels_for_default { @@ -475,6 +492,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", )?; assert_eq!( vec![ @@ -495,7 +513,8 @@ mod unit_tests { json!({ "button-color": "light-green" }) - ) + ), + ("".to_string(), json!({}),), ] .into_iter() .collect::>(), @@ -547,6 +566,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", )?; assert_eq!( vec![ @@ -570,7 +590,8 @@ mod unit_tests { "button-color": "light-green", "title": "hello there" }) - ) + ), + ("".to_string(), json!({}),), ] .into_iter() .collect::>(), @@ -613,6 +634,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", )?; assert_eq!( vec![ @@ -636,6 +658,12 @@ mod unit_tests { "button-color": "light-green", "title": "heya" }) + ), + ( + "".to_string(), + json!({ + "title": "heya", + }), ) ] .into_iter() @@ -679,6 +707,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", )?; assert_eq!( vec![ @@ -699,6 +728,12 @@ mod unit_tests { json!({ "button-color": "red" }) + ), + ( + "".to_string(), + json!({ + "button-color": "red", + }), ) ] .into_iter() @@ -748,6 +783,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", )?; assert_eq!( vec![ @@ -768,6 +804,12 @@ mod unit_tests { json!({ "button-color": "red" }) + ), + ( + "".to_string(), + json!({ + "button-color": "red", + }), ) ] .into_iter() @@ -787,7 +829,8 @@ mod unit_tests { } }, ]))?; - let res = collect_channel_defaults(&input, &["release".to_string(), "beta".to_string()])?; + let res = + collect_channel_defaults(&input, &["release".to_string(), "beta".to_string()], "")?; assert_eq!( vec![ ( @@ -801,7 +844,8 @@ mod unit_tests { json!({ "button-color": "green" }) - ) + ), + ("".to_string(), json!({}),) ] .into_iter() .collect::>(), @@ -829,6 +873,7 @@ mod unit_tests { "nightly".to_string(), "debug".to_string(), ], + "", )?; assert_eq!( vec![ @@ -855,7 +900,8 @@ mod unit_tests { json!({ "button-color": "green" }) - ) + ), + ("".to_string(), json!({}),) ] .into_iter() .collect::>(), @@ -899,6 +945,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", ) .expect_err("Should return error"); if let FMLError::InvalidChannelError(channel, _supported) = res { @@ -937,6 +984,7 @@ mod unit_tests { "nightly".to_string(), "beta".to_string(), ], + "", )?; assert_eq!( vec![ @@ -952,7 +1000,8 @@ mod unit_tests { "button-color": "dark-green" }) ), - ("beta".to_string(), json!({})) + ("beta".to_string(), json!({})), + ("".to_string(), json!({}),) ] .into_iter() .collect::>(), @@ -965,7 +1014,7 @@ mod unit_tests { fn test_merge_feature_default_unsupported_channel() -> Result<()> { let mut feature_def: FeatureDef = Default::default(); let objects = Default::default(); - let merger = DefaultsMerger::new( + let merger = DefaultsMerger::new_with_channel( &objects, vec!["release".into(), "beta".into()], "nightly".into(), @@ -1016,7 +1065,7 @@ mod unit_tests { }, ]))?; let objects = Default::default(); - let merger = DefaultsMerger::new( + let merger = DefaultsMerger::new_with_channel( &objects, vec!["release".into(), "beta".into(), "nightly".into()], "nightly".into(), @@ -1059,7 +1108,7 @@ mod unit_tests { } }]))?; let objects = Default::default(); - let merger = DefaultsMerger::new( + let merger = DefaultsMerger::new_with_channel( &objects, vec!["release".into(), "beta".into(), "nightly".into()], "nightly".into(), @@ -1133,7 +1182,7 @@ mod unit_tests { }, ]))?; let objects = Default::default(); - let merger = DefaultsMerger::new( + let merger = DefaultsMerger::new_with_channel( &objects, vec!["release".into(), "beta".into(), "nightly".into()], "release".into(), @@ -1193,7 +1242,7 @@ mod unit_tests { }, ]))?; let objects = Default::default(); - let merger = DefaultsMerger::new( + let merger = DefaultsMerger::new_with_channel( &objects, vec!["release".into(), "beta".into(), "nightly".into()], "nightly".into(), @@ -1231,7 +1280,8 @@ mod unit_tests { } ]))?; let objects = Default::default(); - let merger = DefaultsMerger::new(&objects, vec!["nightly".into()], "nightly".into()); + let merger = + DefaultsMerger::new_with_channel(&objects, vec!["nightly".into()], "nightly".into()); let result = merger.merge_feature_defaults(&mut feature_def, &default_blocks); assert!(result.is_err()); diff --git a/components/support/nimbus-fml/src/frontend.rs b/components/support/nimbus-fml/src/frontend.rs index 34a7f5acd5..4bb0d65e5b 100644 --- a/components/support/nimbus-fml/src/frontend.rs +++ b/components/support/nimbus-fml/src/frontend.rs @@ -313,11 +313,12 @@ impl ManifestFrontEnd { pub(crate) fn get_intermediate_representation( &self, id: &ModuleId, - channel: &str, + channel: Option<&str>, ) -> Result { let enums = self.get_enums(); let objects = self.get_objects(); - let merger = DefaultsMerger::new(&objects, self.channels.clone(), channel.to_owned()); + let merger = + DefaultsMerger::new(&objects, self.channels.clone(), channel.map(str::to_string)); let features = self.get_feature_defs(&merger)?; diff --git a/components/support/nimbus-fml/src/intermediate_representation.rs b/components/support/nimbus-fml/src/intermediate_representation.rs index d818db78b5..5f7ddcce65 100644 --- a/components/support/nimbus-fml/src/intermediate_representation.rs +++ b/components/support/nimbus-fml/src/intermediate_representation.rs @@ -194,9 +194,9 @@ pub struct FeatureManifest { #[serde(skip)] pub(crate) id: ModuleId, - #[serde(skip_serializing_if = "String::is_empty")] + #[serde(skip_serializing_if = "Option::is_none")] #[serde(default)] - pub(crate) channel: String, + pub(crate) channel: Option, #[serde(rename = "enums")] #[serde(default)] @@ -240,7 +240,7 @@ impl FeatureManifest { impl FeatureManifest { pub(crate) fn new( id: ModuleId, - channel: &str, + channel: Option<&str>, features: BTreeMap, enums: BTreeMap, objects: BTreeMap, @@ -248,7 +248,7 @@ impl FeatureManifest { ) -> Self { Self { id, - channel: channel.to_string(), + channel: channel.map(str::to_string), about, enum_defs: enums, obj_defs: objects, @@ -750,12 +750,7 @@ impl FeatureManifest { .find_feature(feature_name) .ok_or_else(|| InvalidFeatureError(feature_name.to_string()))?; - let dummy_channel = "dummy".to_string(); - let merger = DefaultsMerger::new( - &manifest.obj_defs, - vec![dummy_channel.clone()], - dummy_channel, - ); + let merger = DefaultsMerger::new(&manifest.obj_defs, Default::default(), None); let mut feature_def = feature_def.clone(); merger.merge_feature_defaults(&mut feature_def, &Some(vec![feature_value.into()]))?; diff --git a/components/support/nimbus-fml/src/parser.rs b/components/support/nimbus-fml/src/parser.rs index 828107bf20..830a214f0b 100644 --- a/components/support/nimbus-fml/src/parser.rs +++ b/components/support/nimbus-fml/src/parser.rs @@ -208,7 +208,7 @@ impl Parser { fn load_imports( &self, current: &FilePath, - channel: &str, + channel: Option<&str>, imports: &mut HashMap, // includes: &mut HashSet, ) -> Result { @@ -227,7 +227,7 @@ impl Parser { // we use it. This helps with globbing directories where the app wants to keep the feature definition // away from the feature configuration. let channel = if frontend.channels.len() == 1 { - frontend.channels.first().unwrap() + frontend.channels.first().map(String::as_str) } else { channel }; @@ -245,7 +245,7 @@ impl Parser { // 1. Load the imported manifests in to the hash map. let path = self.files.join(current, &block.path)?; // The channel comes from the importer, rather than the command or the imported file. - let child_id = self.load_imports(&path, &block.channel, imports)?; + let child_id = self.load_imports(&path, Some(&block.channel), imports)?; let child_manifest = imports.get_mut(&child_id).expect("just loaded this file"); // We detect that there are no name collisions after the loading has finished, with `check_can_import_manifest`. @@ -266,7 +266,7 @@ impl Parser { let merger = DefaultsMerger::new( &child_manifest.obj_defs, frontend.channels.clone(), - channel.into(), + channel.map(str::to_string), ); // b. Prepare a feature map that we'll alter in place. @@ -306,7 +306,7 @@ impl Parser { pub fn get_intermediate_representation( &self, - channel: &str, + channel: Option<&str>, ) -> Result { let mut manifests = HashMap::new(); let id = self.load_imports(&self.source, channel, &mut manifests)?; @@ -537,7 +537,7 @@ mod unit_tests { let path = Path::new(&path); let files = FileLoader::default()?; let parser = Parser::new(files, path.into())?; - let ir = parser.get_intermediate_representation("release")?; + let ir = parser.get_intermediate_representation(Some("release"))?; // Validate parsed enums assert!(ir.enum_defs.len() == 1); @@ -644,7 +644,7 @@ mod unit_tests { let path = Path::new(&path); let files = FileLoader::default()?; let parser = Parser::new(files, path.into())?; - let ir = parser.get_intermediate_representation("release")?; + let ir = parser.get_intermediate_representation(Some("release"))?; let feature_def = ir.get_feature("dialog-appearance").unwrap(); let positive_button = feature_def .props @@ -686,7 +686,7 @@ mod unit_tests { // We now re-run this, but merge back the nightly channel instead let files = FileLoader::default()?; let parser = Parser::new(files, path.into())?; - let ir = parser.get_intermediate_representation("nightly")?; + let ir = parser.get_intermediate_representation(Some("nightly"))?; let feature_def = ir.get_feature("dialog-appearance").unwrap(); let positive_button = feature_def .props @@ -1084,7 +1084,7 @@ mod unit_tests { let files = FileLoader::default()?; let parser = Parser::new(files, path.as_path().into())?; - let ir = parser.get_intermediate_representation("release"); + let ir = parser.get_intermediate_representation(Some("release")); assert!(ir.is_ok()); Ok(()) @@ -1100,7 +1100,7 @@ mod unit_tests { let files = FileLoader::default()?; let parser = Parser::new(files, path_buf.as_path().into())?; - let ir = parser.get_intermediate_representation("release")?; + let ir = parser.get_intermediate_representation(Some("release"))?; assert_eq!(ir.feature_defs.len(), 1); Ok(())