@@ -338,16 +338,47 @@ func testWithoutSpecificBuilderRequirement(
338338 })
339339
340340 when ("--format file" , func () {
341- it ("creates the package" , func () {
342- packageTomlPath := generatePackageTomlWithOS (t , assert , pack , tmpDir , simplePackageConfigFixtureName , imageManager .HostOS ())
343- destinationFile := filepath .Join (tmpDir , "package.cnb" )
344- output := pack .RunSuccessfully (
345- "buildpack" , "package" , destinationFile ,
346- "--format" , "file" ,
347- "-c" , packageTomlPath ,
348- )
349- assertions .NewOutputAssertionManager (t , output ).ReportsPackageCreation (destinationFile )
350- h .AssertTarball (t , destinationFile )
341+ when ("the file extension is .cnb" , func () {
342+ it ("creates the package with the same extension" , func () {
343+ packageTomlPath := generatePackageTomlWithOS (t , assert , pack , tmpDir , simplePackageConfigFixtureName , imageManager .HostOS ())
344+ destinationFile := filepath .Join (tmpDir , "package.cnb" )
345+ output := pack .RunSuccessfully (
346+ "buildpack" , "package" , destinationFile ,
347+ "--format" , "file" ,
348+ "-c" , packageTomlPath ,
349+ )
350+ assertions .NewOutputAssertionManager (t , output ).ReportsPackageCreation (destinationFile )
351+ h .AssertTarball (t , destinationFile )
352+ })
353+ })
354+ when ("the file extension is empty" , func () {
355+ it ("creates the package with a .cnb extension" , func () {
356+ packageTomlPath := generatePackageTomlWithOS (t , assert , pack , tmpDir , simplePackageConfigFixtureName , imageManager .HostOS ())
357+ destinationFile := filepath .Join (tmpDir , "package" )
358+ expectedFile := filepath .Join (tmpDir , "package.cnb" )
359+ output := pack .RunSuccessfully (
360+ "buildpack" , "package" , destinationFile ,
361+ "--format" , "file" ,
362+ "-c" , packageTomlPath ,
363+ )
364+ assertions .NewOutputAssertionManager (t , output ).ReportsPackageCreation (expectedFile )
365+ h .AssertTarball (t , expectedFile )
366+ })
367+ })
368+ when ("the file extension is not .cnb" , func () {
369+ it ("creates the package with the given extension but shows a warning" , func () {
370+ packageTomlPath := generatePackageTomlWithOS (t , assert , pack , tmpDir , simplePackageConfigFixtureName , imageManager .HostOS ())
371+ destinationFile := filepath .Join (tmpDir , "package.tar.gz" )
372+ output := pack .RunSuccessfully (
373+ "buildpack" , "package" , destinationFile ,
374+ "--format" , "file" ,
375+ "-c" , packageTomlPath ,
376+ )
377+ assertOutput := assertions .NewOutputAssertionManager (t , output )
378+ assertOutput .ReportsPackageCreation (destinationFile )
379+ assertOutput .ReportsInvalidExtension (".gz" )
380+ h .AssertTarball (t , destinationFile )
381+ })
351382 })
352383 })
353384
0 commit comments