fn test_cli_print_info_command()

in components/support/nimbus-fml/src/command_line/mod.rs [568:607]


    fn test_cli_print_info_command() -> Result<()> {
        let cwd = package_dir()?;
        let cmd = get_command_from_cli([FML_BIN, "info", TEST_FILE, "--channel", "release"], &cwd)?;

        assert!(matches!(&cmd, CliCmd::PrintInfo(_)));
        assert!(matches!(&cmd, CliCmd::PrintInfo(c) if c.manifest.ends_with(TEST_FILE)));
        assert!(
            matches!(&cmd, CliCmd::PrintInfo(PrintInfoCmd { channel: Some(channel), as_json, .. }) if channel.as_str() == "release" && !as_json )
        );

        let cmd = get_command_from_cli(
            [FML_BIN, "info", TEST_FILE, "--channel", "beta", "--json"],
            &cwd,
        )?;

        assert!(matches!(&cmd, CliCmd::PrintInfo(_)));
        assert!(matches!(&cmd, CliCmd::PrintInfo(c) if c.manifest.ends_with(TEST_FILE)));
        assert!(
            matches!(&cmd, CliCmd::PrintInfo(PrintInfoCmd { channel: Some(channel), as_json, .. }) if channel.as_str() == "beta" && *as_json )
        );

        let cmd = get_command_from_cli(
            [
                FML_BIN,
                "info",
                TEST_FILE,
                "--feature",
                "my-feature",
                "--json",
            ],
            &cwd,
        )?;

        assert!(matches!(&cmd, CliCmd::PrintInfo(_)));
        assert!(matches!(&cmd, CliCmd::PrintInfo(c) if c.manifest.ends_with(TEST_FILE)));
        assert!(
            matches!(&cmd, CliCmd::PrintInfo(PrintInfoCmd { feature: Some(feature), as_json, .. }) if feature.as_str() == "my-feature" && *as_json )
        );
        Ok(())
    }