Skip to content

Commit

Permalink
Test Display implementation for artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
runesoerensen committed Mar 12, 2024
1 parent 8ad4952 commit 663e538
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions common/go-utils/src/inv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,28 @@ pub fn list_upstream_artifacts() -> Result<Vec<Artifact>, ListUpstreamArtifactsE
.map(|file| Artifact::try_from(file).map_err(ListUpstreamArtifactsError::Conversion))
.collect::<Result<Vec<_>, _>>()
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_artifact_display_format() {
let artifact = Artifact {
go_version: "go1.7.2".to_string(),
semantic_version: Version::parse("1.7.2").unwrap(),
os: "linux".to_string(),
arch: "amd64".to_string(),
url: String::new(),
sha_checksum: String::new(),
};

assert_eq!(
format!(
"{} ({}-{})",
artifact.go_version, artifact.os, artifact.arch
),
artifact.to_string()
);
}
}

0 comments on commit 663e538

Please sign in to comment.