@@ -292,8 +292,8 @@ func TestDetectNoRelease(t *testing.T) {
292292 t .Fatal ("exit status is non-zero:" , status )
293293 }
294294 out := stdout .String ()
295- if out != "" {
296- t .Fatalf ("stdout is not empty : %q" , out )
295+ if out != "No new release was found \n " {
296+ t .Fatalf ("stdout is unexpected : %q" , out )
297297 }
298298 })
299299 }
@@ -373,11 +373,10 @@ func TestWriteError(t *testing.T) {
373373}
374374
375375func TestCouldNotFetch (t * testing.T ) {
376- stdout := testErrorWriter {}
377376 stderr := & bytes.Buffer {}
378377 f := filepath .Join ("testdata" , "registry" , "repo_not_found.json" )
379378
380- status := newGen (stdout , stderr , io .Discard ).run ([]string {"test" , "-r" , f })
379+ status := newGen (io . Discard , stderr , io .Discard ).run ([]string {"test" , "-r" , f })
381380 if status == 0 {
382381 t .Fatal ("exit status is unexpectedly zero" )
383382 }
@@ -400,10 +399,9 @@ func TestInvalidCommandArgs(t *testing.T) {
400399
401400 for _ , tc := range testCases {
402401 t .Run (strings .Join (tc .args , " " ), func (t * testing.T ) {
403- stdout := testErrorWriter {}
404402 stderr := & bytes.Buffer {}
405403
406- status := newGen (stdout , stderr , io .Discard ).run (tc .args )
404+ status := newGen (io . Discard , stderr , io .Discard ).run (tc .args )
407405 if status == 0 {
408406 t .Fatal ("exit status is unexpectedly zero" )
409407 }
@@ -430,6 +428,38 @@ func TestDetectErrorBadRequest(t *testing.T) {
430428 }
431429}
432430
431+ func TestReadActionRegistryError (t * testing.T ) {
432+ tests := []struct {
433+ file string
434+ want string
435+ }{
436+ {
437+ file : "broken.json" ,
438+ want : "could not parse the local action registry file as JSON:" ,
439+ },
440+ {
441+ file : "oops-this-file-doesnt-exist.json" ,
442+ want : "could not read the file for actions registry:" ,
443+ },
444+ }
445+
446+ for _ , tc := range tests {
447+ t .Run (tc .file , func (t * testing.T ) {
448+ stdout := io .Discard
449+ stderr := & bytes.Buffer {}
450+ f := filepath .Join ("testdata" , "registry" , tc .file )
451+ status := newGen (stdout , stderr , io .Discard ).run ([]string {"test" , "-d" , "-r" , f })
452+ if status != 1 {
453+ t .Fatal ("exit status is not 1:" , status )
454+ }
455+ out := stderr .String ()
456+ if ! strings .Contains (out , tc .want ) {
457+ t .Fatalf ("wanted %q in stderr: %q" , tc .want , out )
458+ }
459+ })
460+ }
461+ }
462+
433463func TestActionBuildRawURL (t * testing.T ) {
434464 a := & registry {Slug : "foo/bar" }
435465 have := a .rawURL ("v1" )
0 commit comments