@@ -55,7 +55,7 @@ impl DockerImageUrl {
5555 pub fn to_edf ( & self ) -> String {
5656 format ! (
5757 "{}{}{}{}" ,
58- self . registry. clone( ) . map( |r| format!( "{r}/ " ) ) . unwrap_or_default( ) ,
58+ self . registry. clone( ) . map( |r| format!( "{r}# " ) ) . unwrap_or_default( ) ,
5959 self . image,
6060 self . tag. clone( ) . map( |t| format!( ":{}" , t) ) . unwrap_or_default( ) ,
6161 self . digest
@@ -213,4 +213,17 @@ mod tests {
213213 assert_eq ! ( image. tag, expected. 2 . map( |s| s. to_owned( ) ) ) ;
214214 assert_eq ! ( image. digest, expected. 3 . map( |s| s. to_owned( ) ) ) ;
215215 }
216+
217+ #[ rstest]
218+ #[ case( ( None , "ubuntu" , None , None ) , "ubuntu" ) ]
219+ #[ case( ( Some ( "ghcr.io" ) , "test/ubuntu" , Some ( "latest" ) , Some ( "deadbeef" ) ) , "ghcr.io#test/ubuntu:latest@sha256:deadbeef" ) ]
220+ fn test_edf ( #[ case] values : ( Option < & str > , & str , Option < & str > , Option < & str > ) , #[ case] expected_edf : & str ) {
221+ let image = DockerImageUrl {
222+ registry : values. 0 . map ( |s| s. to_owned ( ) ) ,
223+ image : values. 1 . to_owned ( ) ,
224+ tag : values. 2 . map ( |s| s. to_owned ( ) ) ,
225+ digest : values. 3 . map ( |s| s. to_owned ( ) ) ,
226+ } ;
227+ assert_eq ! ( image. to_edf( ) , expected_edf) ;
228+ }
216229}
0 commit comments