MCPcopy Create free account
hub / github.com/archlinux/alpm / json_compact

Function json_compact

alpm-db/tests/desc_cli.rs:551–570  ·  view source on GitHub ↗
(#[case] schema: DbDescSchema)

Source from the content-addressed store, hash-verified

549 #[case(DbDescSchema::V1(SchemaVersion::new(Version::new(1, 0, 0))))]
550 #[case(DbDescSchema::V2(SchemaVersion::new(Version::new(2, 0, 0))))]
551 fn json_compact(#[case] schema: DbDescSchema) -> TestResult {
552 let (_, data) = super::schema_fixture(&schema);
553
554 let mut cmd = cargo_bin_cmd!("alpm-db-desc");
555 cmd.args(["format", "--output-format", "json"]);
556 cmd.write_stdin(data);
557 let output = cmd.assert().success().get_output().clone();
558
559 match schema {
560 DbDescSchema::V1(_) => {
561 let parsed: DbDescFileV1 = serde_json::from_slice(&output.stdout)?;
562 assert_eq!(parsed.name.to_string(), "foo");
563 }
564 DbDescSchema::V2(_) => {
565 let parsed: DbDescFileV2 = serde_json::from_slice(&output.stdout)?;
566 assert_eq!(parsed.name.to_string(), "foo");
567 }
568 }
569 Ok(())
570 }
571
572 #[rstest]
573 #[case(DbDescSchema::V1(SchemaVersion::new(Version::new(1, 0, 0))))]

Callers

nothing calls this directly

Calls 1

schema_fixtureFunction · 0.70

Tested by

no test coverage detected