Skip to content

Commit

Permalink
fixup. fix scriptlet string conversion impl
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusl authored and dralley committed Dec 12, 2023
1 parent 6079d08 commit d5f17a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rpm/headers/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,11 @@ impl Scriptlet {
}
}

impl From<&str> for Scriptlet {
fn from(value: &str) -> Self {
impl<T> From<T> for Scriptlet
where
T: Into<String>,
{
fn from(value: T) -> Self {
Scriptlet::new(value)
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ However, it does nothing.",
.flags(ScriptletFlags::EXPAND)
.prog(vec!["/bin/blah/bash", "-c"]),
)
.post_untrans_script(&String::from("echo postuntrans"))
.add_changelog_entry("me", "was awesome, eh?", 1_681_411_811)
.add_changelog_entry("you", "yeah, it was", 850_984_797)
.requires(Dependency::any("wget"))
Expand Down Expand Up @@ -119,6 +120,11 @@ However, it does nothing.",
Some(vec!["/bin/blah/bash".to_string(), "-c".to_string()])
);

let postuntrans = pkg.metadata.get_post_untrans_script()?;
assert_eq!(postuntrans.script.as_str(), "echo postuntrans");
assert!(postuntrans.flags.is_none());
assert!(postuntrans.program.is_none());

assert!(pkg.metadata.get_pre_untrans_script().is_err());

Ok(())
Expand Down

0 comments on commit d5f17a1

Please sign in to comment.