diff --git a/crates/spk-cli/cmd-make-binary/src/cmd_make_binary_test.rs b/crates/spk-cli/cmd-make-binary/src/cmd_make_binary_test.rs index a8bfe8a0e9..a7fe64c5cc 100644 --- a/crates/spk-cli/cmd-make-binary/src/cmd_make_binary_test.rs +++ b/crates/spk-cli/cmd-make-binary/src/cmd_make_binary_test.rs @@ -81,3 +81,42 @@ build: .await .expect("With override, build script should succeed."); } + +#[rstest] +#[case::v0("v0/platform")] +#[case::v1("v1/platform")] +#[tokio::test] +async fn build_a_platform(tmpdir: tempfile::TempDir, #[case] api: &str) { + let _rt = spfs_runtime().await; + + let filename = tmpdir.path().join("simple.spk.yaml"); + { + let mut file = File::create(&filename).unwrap(); + file.write_all( + format!( + r#" +platform: demo-platform/1.0.0 +api: {api} +requirements: [] +"# + ) + .as_bytes(), + ) + .unwrap(); + } + + let filename_str = filename.as_os_str().to_str().unwrap(); + + // First, don't override the variable on the command line (test the test). + let mut opt = Opt::try_parse_from([ + "make-binary", + // Don't exec a new process to move into a new runtime, this confuses + // coverage testing. + "--no-runtime", + "--disable-repo=origin", + "--here", + filename_str, + ]) + .unwrap(); + opt.mkb.run().await.expect("Build should succeed."); +}