@@ -442,6 +442,70 @@ func TestConvertToModel(t *testing.T) {
442442 },
443443 },
444444 },
445+ {
446+ name : "Error/InvalidReleaseVersion" ,
447+ assertion : hasError (`error parsing bundle "foo.v0.1.0" release version "!!!": Invalid character(s) found in prerelease "!!!"` ),
448+ cfg : DeclarativeConfig {
449+ Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
450+ Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : testBundleName ("foo" , "0.1.0" )})},
451+ Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b * Bundle ) {
452+ b .Properties = []property.Property {
453+ property .MustBuildPackageRelease ("foo" , "0.1.0" , "!!!" ),
454+ }
455+ })},
456+ },
457+ },
458+ {
459+ name : "Error/InvalidBundleNormalizedName" ,
460+ assertion : hasError (`invalid index:
461+ └── invalid package "foo":
462+ └── invalid channel "alpha":
463+ └── invalid bundle "foo.v0.1.0-alpha.1.0.0":
464+ └── name "foo.v0.1.0-alpha.1.0.0" does not match normalized name "foo-v0.1.0-alpha.1.0.0"` ),
465+ cfg : DeclarativeConfig {
466+ Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
467+ Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : "foo.v0.1.0-alpha.1.0.0" })},
468+ Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b * Bundle ) {
469+ b .Properties = []property.Property {
470+ property .MustBuildPackageRelease ("foo" , "0.1.0" , "alpha.1.0.0" ),
471+ }
472+ b .Name = "foo.v0.1.0-alpha.1.0.0"
473+ })},
474+ },
475+ },
476+ {
477+ name : "Success/ValidBundleReleaseVersion" ,
478+ assertion : require .NoError ,
479+ cfg : DeclarativeConfig {
480+ Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
481+ Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : "foo-v0.1.0-alpha.1.0.0" })},
482+ Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b * Bundle ) {
483+ b .Properties = []property.Property {
484+ property .MustBuildPackageRelease ("foo" , "0.1.0" , "alpha.1.0.0" ),
485+ }
486+ b .Name = "foo-v0.1.0-alpha.1.0.0"
487+ })},
488+ },
489+ },
490+ {
491+ name : "Error/BundleReleaseWithBuildMetadata" ,
492+ assertion : hasError (`invalid index:
493+ └── invalid package "foo":
494+ └── invalid channel "alpha":
495+ └── invalid bundle "foo.v0.1.0+alpha.1.0.0-0.0.1":
496+ ├── name "foo.v0.1.0+alpha.1.0.0-0.0.1" does not match normalized name "foo-v0.1.0+alpha.1.0.0-0.0.1"
497+ └── cannot use build metadata in version with a release version` ),
498+ cfg : DeclarativeConfig {
499+ Packages : []Package {newTestPackage ("foo" , "alpha" , svgSmallCircle )},
500+ Channels : []Channel {newTestChannel ("foo" , "alpha" , ChannelEntry {Name : "foo.v0.1.0+alpha.1.0.0-0.0.1" })},
501+ Bundles : []Bundle {newTestBundle ("foo" , "0.1.0" , func (b * Bundle ) {
502+ b .Properties = []property.Property {
503+ property .MustBuildPackageRelease ("foo" , "0.1.0+alpha.1.0.0" , "0.0.1" ),
504+ }
505+ b .Name = "foo.v0.1.0+alpha.1.0.0-0.0.1"
506+ })},
507+ },
508+ },
445509 }
446510
447511 for _ , s := range specs {
0 commit comments