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

Function format

alpm-srcinfo/tests/integration.rs:40–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38 /// Run the `srcinfo format` subcommand to convert a PKGBUILD into a .SRCINFO file.
39 #[test]
40 fn format() -> TestResult {
41 // Write the PKGBUILD to a temporary directory
42 let tempdir = tempdir()?;
43 let path = tempdir.path().join("PKGBUILD");
44 let mut file = File::create_new(&path)?;
45 file.write_all(TEST_PKGBUILD.as_bytes())?;
46
47 // Generate the .SRCINFO file from the that PKGBUILD file.
48 let mut cmd = cargo_bin_cmd!("alpm-srcinfo");
49 cmd.args(vec!["create".into(), path.to_string_lossy().to_string()]);
50
51 // Make sure the command was successful and get the output.
52 let output = cmd.assert().success();
53 let output = String::from_utf8_lossy(&output.get_output().stdout);
54
55 let srcinfo = SourceInfoV1::from_string(&output)?;
56
57 assert_eq!(srcinfo.base.name.inner(), "example");
58
59 Ok(())
60 }
61}
62
63mod validate {

Callers

nothing calls this directly

Calls 3

write_allMethod · 0.80
joinMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected