Repository: favonia/cloudflare-ddns
Pull request #1035 (2025-02-27 15:26:07)

refactor: clean up code


Patch:
diff --git a/.golangci.yaml b/.golangci.yaml
index 18f8f82..8267507 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -49,7 +49,7 @@ issues:
 linters:
   enable-all: true
   disable:
-    - exportloopref # deprecated
+    - tenv # deprecated
 
     - goconst # never leads to actual code changes
     - mnd # never leads to actual code changes
diff --git a/internal/api/cloudflare_waf.go b/internal/api/cloudflare_waf.go
index 7d246ef..9cb7736 100644
--- a/internal/api/cloudflare_waf.go
+++ b/internal/api/cloudflare_waf.go
@@ -189,7 +189,7 @@ func readWAFListItems(ppfmt pp.PP, list WAFList, rawItems []cloudflare.ListItem)
 			return nil, false
 		}
 		if rawItem.Comment != "" {
-			ppfmt.Noticef(pp.EmojiWarning, "The IP range/address %q in the list %s has a non-empty comment %q; the comment might be lost during an IP update.", //nolint:lll
+			ppfmt.Noticef(pp.EmojiWarning, "The IP range/address %q in the list %s has a non-empty comment %q. The comment might be lost during an IP update.", //nolint:lll
 				*rawItem.IP, list.Describe(), rawItem.Comment)
 		}
 		items = append(items, WAFListItem{ID: ID(rawItem.ID), Prefix: p})
diff --git a/internal/pp/queued.go b/internal/pp/queued.go
deleted file mode 100644
index a6a6fb2..0000000
--- a/internal/pp/queued.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package pp
-
-// QueuedPP is a pretty printer that queues all printing operations
-// (but executes non-printing operations immediately).
-// [QueuedPP.Flush] will then execute all queued printing operations.
-//
-// QueuePP itself is not goroute-safe, but can be used to queue printing
-// operations from different goroutines to achieve goroutine-safety.
-type QueuedPP struct {
-	upstream PP
-	queue    *[]func()
-}
-
-// NewQueued creates a new pretty printer that queues all printing operations.
-// It is assumed that [PP.IsShowing] and [PP.Indent] do not induce race conditions.
-func NewQueued(pp PP) QueuedPP {
-	var empty []func()
-	return QueuedPP{upstream: pp, queue: &empty}
-}
-
-// IsShowing calls [PP.IsShowing] of the upstream.
-func (b QueuedPP) IsShowing(v Verbosity) bool {
-	return b.upstream.IsShowing(v)
-}
-
-// Indent calls [PP.Indent] and return a new batch printer with a new upstream.
-// The call queue is shared with the original batch printer.
-func (b QueuedPP) Indent() PP {
-	b.upstream = b.upstream.Indent()
-	return b
-}
-
-// BlankLineIfVerbose queues a call to [PP.BlankLineIfVerbose] of the upstream.
-func (b QueuedPP) BlankLineIfVerbose() {
-	// It's important to save the current upstream because [Indent] may change it.
-	upstream := b.upstream
-	*b.queue = append(*b.queue, func() { upstream.BlankLineIfVerbose() })
-}
-
-// Infof queues a call to [PP.Infof] of the upstream.
-func (b QueuedPP) Infof(emoji Emoji, format string, args ...any) {
-	// It's important to save the current upstream because [Indent] may change it.
-	upstream := b.upstream
-	*b.queue = append(*b.queue, func() { upstream.Infof(emoji, format, args...) })
-}
-
-// Noticef queues a call to [PP.Noticef] of the upstream.
-func (b QueuedPP) Noticef(emoji Emoji, format string, args ...any) {
-	// It's important to save the current upstream because [Indent] may change it.
-	upstream := b.upstream
-	*b.queue = append(*b.queue, func() { upstream.Noticef(emoji, format, args...) })
-}
-
-// Suppress queues a call to [PP.Suppress] of the upstream.
-func (b QueuedPP) Suppress(id ID) {
-	// It's important to save the current upstream because [Indent] may change it.
-	upstream := b.upstream
-	*b.queue = append(*b.queue, func() { upstream.Suppress(id) })
-}
-
-// InfoOncef queues a call to [PP.InfoOncef] of the upstream.
-func (b QueuedPP) InfoOncef(id ID, emoji Emoji, format string, args ...any) {
-	// It's important to save the current upstream because [Indent] may change it.
-	upstream := b.upstream
-	*b.queue = append(*b.queue, func() { upstream.InfoOncef(id, emoji, format, args...) })
-}
-
-// NoticeOncef queues a call to [PP.NoticeOncef] of the upstream.
-func (b QueuedPP) NoticeOncef(id ID, emoji Emoji, format string, args ...any) {
-	// It's important to save the current upstream because [Indent] may change it.
-	upstream := b.upstream
-	*b.queue = append(*b.queue, func() { upstream.NoticeOncef(id, emoji, format, args...) })
-}
-
-// Flush executes all queued function calls.
-func (b QueuedPP) Flush() {
-	for _, f := range *b.queue {
-		f()
-	}
-	*b.queue = nil
-}


Test patch:
diff --git a/internal/api/cloudflare_records_test.go b/internal/api/cloudflare_records_test.go
index 5500dae..7167b16 100644
--- a/internal/api/cloudflare_records_test.go
+++ b/internal/api/cloudflare_records_test.go
@@ -115,18 +115,20 @@ func TestListZonesTwo(t *testing.T) {
 			mockPP := mocks.NewMockPP(mockCtrl)
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 			zh := newZonesHandler(t, mux, tc.zones)
 
 			zh.setRequestLimit(tc.requestLimit)
 			mockPP = mocks.NewMockPP(mockCtrl)
-			output, ok := h.(api.CloudflareHandle).ListZones(context.Background(), mockPP, tc.input)
+			output, ok := ch.ListZones(context.Background(), mockPP, tc.input)
 			require.Equal(t, tc.ok, ok)
 			require.Equal(t, tc.output, output)
 			require.True(t, zh.isExhausted())
 
 			zh.setRequestLimit(0)
 			mockPP = mocks.NewMockPP(mockCtrl)
-			output, ok = h.(api.CloudflareHandle).ListZones(context.Background(), mockPP, tc.input)
+			output, ok = ch.ListZones(context.Background(), mockPP, tc.input)
 			require.Equal(t, tc.ok, ok)
 			require.Equal(t, tc.output, output)
 			require.True(t, zh.isExhausted())
@@ -136,7 +138,7 @@ func TestListZonesTwo(t *testing.T) {
 
 				mockPP = mocks.NewMockPP(mockCtrl)
 				mockPP.EXPECT().Noticef(pp.EmojiError, "Failed to check the existence of a zone named %s: %v", "test.org", gomock.Any())
-				output, ok = h.(api.CloudflareHandle).ListZones(context.Background(), mockPP, tc.input)
+				output, ok = ch.ListZones(context.Background(), mockPP, tc.input)
 				require.False(t, ok)
 				require.Zero(t, output)
 				require.True(t, zh.isExhausted())
@@ -242,6 +244,8 @@ func TestZoneIDOfDomain(t *testing.T) {
 			mockPP := mocks.NewMockPP(mockCtrl)
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 			zh := newZonesHandler(t, mux, tc.zoneStatuses)
 
 			zh.setRequestLimit(tc.requestLimit)
@@ -249,7 +253,7 @@ func TestZoneIDOfDomain(t *testing.T) {
 			if tc.prepareMockPP != nil {
 				tc.prepareMockPP(mockPP)
 			}
-			zoneID, ok := h.(api.CloudflareHandle).ZoneIDOfDomain(context.Background(), mockPP, tc.domain)
+			zoneID, ok := ch.ZoneIDOfDomain(context.Background(), mockPP, tc.domain)
 			require.Equal(t, tc.ok, ok)
 			require.Equal(t, tc.expected, zoneID)
 			require.True(t, zh.isExhausted())
@@ -257,7 +261,7 @@ func TestZoneIDOfDomain(t *testing.T) {
 			if tc.ok {
 				zh.setRequestLimit(0)
 				mockPP = mocks.NewMockPP(mockCtrl) // there should be no messages
-				zoneID, ok = h.(api.CloudflareHandle).ZoneIDOfDomain(context.Background(), mockPP, tc.domain)
+				zoneID, ok = ch.ZoneIDOfDomain(context.Background(), mockPP, tc.domain)
 				require.Equal(t, tc.ok, ok)
 				require.Equal(t, tc.expected, zoneID)
 				require.True(t, zh.isExhausted())
@@ -273,9 +277,11 @@ func TestZoneIDOfDomainInvalid(t *testing.T) {
 
 	_, h, ok := newHandle(t, mockPP)
 	require.True(t, ok)
+	ch, ok := h.(api.CloudflareHandle)
+	require.True(t, ok)
 
 	mockPP.EXPECT().Noticef(pp.EmojiError, "Failed to check the existence of a zone named %s: %v", "sub.test.org", gomock.Any())
-	zoneID, ok := h.(api.CloudflareHandle).ZoneIDOfDomain(context.Background(), mockPP, domain.FQDN("sub.test.org"))
+	zoneID, ok := ch.ZoneIDOfDomain(context.Background(), mockPP, domain.FQDN("sub.test.org"))
 	require.False(t, ok)
 	require.Zero(t, zoneID)
 }
diff --git a/internal/api/cloudflare_waf_test.go b/internal/api/cloudflare_waf_test.go
index 9fd7e28..ba6c727 100644
--- a/internal/api/cloudflare_waf_test.go
+++ b/internal/api/cloudflare_waf_test.go
@@ -131,6 +131,8 @@ func TestListWAFLists(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, tc.lists)
 
@@ -139,7 +141,7 @@ func TestListWAFLists(t *testing.T) {
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			lists, ok := h.(api.CloudflareHandle).ListWAFLists(context.Background(), mockPP, mockAccountID)
+			lists, ok := ch.ListWAFLists(context.Background(), mockPP, mockAccountID)
 			require.Equal(t, tc.ok, ok)
 			require.Equal(t, tc.output, lists)
 			require.True(t, lh.isExhausted())
@@ -149,16 +151,16 @@ func TestListWAFLists(t *testing.T) {
 				if tc.prepareMocks != nil {
 					tc.prepareMocks(mockPP)
 				}
-				lists, ok = h.(api.CloudflareHandle).ListWAFLists(context.Background(), mockPP, mockAccountID)
+				lists, ok = ch.ListWAFLists(context.Background(), mockPP, mockAccountID)
 				require.Equal(t, tc.ok, ok)
 				require.Equal(t, tc.output, lists)
 			}
 
-			h.(api.CloudflareHandle).FlushCache() //nolint:forcetypeassert
+			ch.FlushCache()
 
 			mockPP = mocks.NewMockPP(mockCtrl)
 			mockPP.EXPECT().Noticef(pp.EmojiError, "Failed to list existing lists: %v", gomock.Any())
-			lists, ok = h.(api.CloudflareHandle).ListWAFLists(context.Background(), mockPP, mockAccountID)
+			lists, ok = ch.ListWAFLists(context.Background(), mockPP, mockAccountID)
 			require.False(t, ok)
 			require.Zero(t, lists)
 			require.True(t, lh.isExhausted())
@@ -228,6 +230,8 @@ func TestWAFListID(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, tc.lists)
 
@@ -236,8 +240,7 @@ func TestWAFListID(t *testing.T) {
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			//nolint: forcetypeassert
-			id, found, ok := h.(api.CloudflareHandle).WAFListID(context.Background(), mockPP, mockWAFList, tc.description)
+			id, found, ok := ch.WAFListID(context.Background(), mockPP, mockWAFList, tc.description)
 			require.Equal(t, tc.ok, ok)
 			require.Equal(t, tc.found, found)
 			require.Equal(t, tc.output, id)
@@ -245,19 +248,17 @@ func TestWAFListID(t *testing.T) {
 
 			if tc.ok {
 				mockPP = mocks.NewMockPP(mockCtrl)
-				//nolint: forcetypeassert
-				id, found, ok = h.(api.CloudflareHandle).WAFListID(context.Background(), mockPP, mockWAFList, tc.description)
+				id, found, ok = ch.WAFListID(context.Background(), mockPP, mockWAFList, tc.description)
 				require.Equal(t, tc.ok, ok)
 				require.Equal(t, tc.found, found)
 				require.Equal(t, tc.output, id)
 			}
 
-			h.(api.CloudflareHandle).FlushCache() //nolint:forcetypeassert
+			ch.FlushCache()
 
 			mockPP = mocks.NewMockPP(mockCtrl)
 			mockPP.EXPECT().Noticef(pp.EmojiError, "Failed to list existing lists: %v", gomock.Any())
-			//nolint: forcetypeassert
-			id, found, ok = h.(api.CloudflareHandle).WAFListID(context.Background(), mockPP, mockWAFList, tc.description)
+			id, found, ok = ch.WAFListID(context.Background(), mockPP, mockWAFList, tc.description)
 			require.False(t, ok)
 			require.Zero(t, found)
 			require.Zero(t, id)
@@ -274,6 +275,8 @@ func TestListWAFListsHint(t *testing.T) {
 
 	mux, h, ok := newHandle(t, mockPP)
 	require.True(t, ok)
+	ch, ok := h.(api.CloudflareHandle)
+	require.True(t, ok)
 
 	mux.HandleFunc(fmt.Sprintf("GET /accounts/%s/rules/lists", mockAccountID),
 		func(w http.ResponseWriter, _ *http.Request) {
@@ -288,7 +291,7 @@ func TestListWAFListsHint(t *testing.T) {
 		mockPP.EXPECT().Noticef(pp.EmojiError, "Failed to list existing lists: %v", gomock.Any()),
 		mockPP.EXPECT().NoticeOncef(pp.MessageWAFListPermission, pp.EmojiHint, `Double check your API token and account ID. Make sure you granted the "Edit" permission of "Account - Account Filter Lists"`),
 	)
-	lists, ok := h.(api.CloudflareHandle).ListWAFLists(context.Background(), mockPP, mockAccountID)
+	lists, ok := ch.ListWAFLists(context.Background(), mockPP, mockAccountID)
 	require.False(t, ok)
 	require.Zero(t, lists)
 }
@@ -355,6 +358,8 @@ func TestFindWAFList(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, tc.lists)
 			lh.setRequestLimit(tc.listRequestLimit)
@@ -362,7 +367,7 @@ func TestFindWAFList(t *testing.T) {
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			list, ok := h.(api.CloudflareHandle).FindWAFList(context.Background(), mockPP, mockWAFList, "description")
+			list, ok := ch.FindWAFList(context.Background(), mockPP, mockWAFList, "description")
 			require.Equal(t, tc.ok, ok)
 			require.Equal(t, tc.output, list)
 			require.True(t, lh.isExhausted())
@@ -372,7 +377,7 @@ func TestFindWAFList(t *testing.T) {
 				if tc.prepareMocks != nil {
 					tc.prepareMocks(mockPP)
 				}
-				list, ok = h.(api.CloudflareHandle).FindWAFList(context.Background(), mockPP, mockWAFList, "description")
+				list, ok = ch.FindWAFList(context.Background(), mockPP, mockWAFList, "description")
 				require.Equal(t, tc.ok, ok)
 				require.Equal(t, tc.output, list)
 			}
@@ -509,6 +514,8 @@ func TestFinalClearWAFListAsync(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, []listMeta{{name: "list", size: 5, kind: cloudflare.ListTypeIP}})
 			dh := newDeleteListHandler(t, mux, mockID("list", 0))
@@ -521,7 +528,7 @@ func TestFinalClearWAFListAsync(t *testing.T) {
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			deleted, ok := h.(api.CloudflareHandle).FinalClearWAFListAsync(context.Background(), mockPP,
+			deleted, ok := ch.FinalClearWAFListAsync(context.Background(), mockPP,
 				mockWAFList, "description")
 			require.Equal(t, tc.deleted, deleted)
 			require.Equal(t, tc.ok, ok)
@@ -719,7 +726,7 @@ func TestListWAFListItems(t *testing.T) {
 			},
 			func(ppfmt *mocks.MockPP) {
 				ppfmt.EXPECT().Noticef(pp.EmojiWarning,
-					"The IP range/address %q in the list %s has a non-empty comment %q; the comment might be lost during an IP update.",
+					"The IP range/address %q in the list %s has a non-empty comment %q. The comment might be lost during an IP update.",
 					"10.0.0.1", "account456/list", "hello")
 			},
 		},
@@ -732,34 +739,32 @@ func TestListWAFListItems(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, tc.lists)
-			ch := newCreateListHandler(t, mux, tc.newList)
+			clh := newCreateListHandler(t, mux, tc.newList)
 			lih := newListListItemsHandler(t, mux, mockID("list", 0), tc.items)
 
 			lh.setRequestLimit(tc.listRequestLimit)
-			ch.setRequestLimit(tc.createRequestLimit)
+			clh.setRequestLimit(tc.createRequestLimit)
 			lih.setRequestLimit(tc.listItemsRequestLimit)
 			mockPP = mocks.NewMockPP(mockCtrl)
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			//nolint:forcetypeassert
-			output, alreadyExisting, cached, ok := h.(api.CloudflareHandle).
-				ListWAFListItems(context.Background(), mockPP, mockWAFList, "description")
+			output, alreadyExisting, cached, ok := ch.ListWAFListItems(context.Background(), mockPP, mockWAFList, "description")
 			require.Equal(t, tc.ok, ok)
 			require.False(t, cached)
 			require.Equal(t, tc.alreadyExisting, alreadyExisting)
 			require.Equal(t, tc.output, output)
 			require.True(t, lh.isExhausted())
-			require.True(t, ch.isExhausted())
+			require.True(t, clh.isExhausted())
 			require.True(t, lih.isExhausted())
 
 			if tc.ok {
 				mockPP = mocks.NewMockPP(mockCtrl)
-				//nolint:forcetypeassert
-				output, alreadyExisting, cached, ok := h.(api.CloudflareHandle).
-					ListWAFListItems(context.Background(), mockPP, mockWAFList, "description")
+				output, alreadyExisting, cached, ok := ch.ListWAFListItems(context.Background(), mockPP, mockWAFList, "description")
 				require.Equal(t, tc.ok, ok)
 				require.True(t, cached)
 				require.True(t, alreadyExisting)
@@ -907,6 +912,8 @@ func TestDeleteWAFListItems(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, []listMeta{{name: "list", size: 5, kind: cloudflare.ListTypeIP}})
 			dih := newDeleteListItemsHandler(t, mux, mockID("list", 0), mockID("op", 0))
@@ -919,9 +926,7 @@ func TestDeleteWAFListItems(t *testing.T) {
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			//nolint:forcetypeassert
-			ok = h.(api.CloudflareHandle).
-				DeleteWAFListItems(context.Background(), mockPP, mockWAFList, "description", tc.idsToDelete)
+			ok = ch.DeleteWAFListItems(context.Background(), mockPP, mockWAFList, "description", tc.idsToDelete)
 			require.Equal(t, tc.ok, ok)
 			require.True(t, lh.isExhausted())
 			require.True(t, dih.isExhausted())
@@ -931,9 +936,7 @@ func TestDeleteWAFListItems(t *testing.T) {
 				dih.setRequestLimit(tc.deleteRequestLimit)
 				lih.setRequestLimit(tc.listItemsRequestLimit)
 				mockPP = mocks.NewMockPP(mockCtrl)
-				//nolint:forcetypeassert
-				ok := h.(api.CloudflareHandle).
-					DeleteWAFListItems(context.Background(), mockPP, mockWAFList, "description", tc.idsToDelete)
+				ok := ch.DeleteWAFListItems(context.Background(), mockPP, mockWAFList, "description", tc.idsToDelete)
 				require.Equal(t, tc.ok, ok)
 				require.True(t, lh.isExhausted())
 				require.True(t, dih.isExhausted())
@@ -1081,6 +1084,8 @@ func TestCreateWAFListItems(t *testing.T) {
 
 			mux, h, ok := newHandle(t, mockPP)
 			require.True(t, ok)
+			ch, ok := h.(api.CloudflareHandle)
+			require.True(t, ok)
 
 			lh := newListListsHandler(t, mux, []listMeta{{name: "list", size: 5, kind: cloudflare.ListTypeIP}})
 			cih := newCreateListItemsHandler(t, mux, mockID("list", 0), mockID("op", 0))
@@ -1093,9 +1098,7 @@ func TestCreateWAFListItems(t *testing.T) {
 			if tc.prepareMocks != nil {
 				tc.prepareMocks(mockPP)
 			}
-			//nolint:forcetypeassert
-			ok = h.(api.CloudflareHandle).CreateWAFListItems(context.Background(), mockPP,
-				mockWAFList, "description", tc.itemsToCreate, itemComment)
+			ok = ch.CreateWAFListItems(context.Background(), mockPP, mockWAFList, "description", tc.itemsToCreate, itemComment)
 			require.Equal(t, tc.ok, ok)
 			require.True(t, lh.isExhausted())
 			require.True(t, cih.isExhausted())
@@ -1105,8 +1108,7 @@ func TestCreateWAFListItems(t *testing.T) {
 				cih.setRequestLimit(tc.createRequestLimit)
 				lih.setRequestLimit(tc.listItemsRequestLimit)
 				mockPP = mocks.NewMockPP(mockCtrl)
-				//nolint:forcetypeassert
-				ok = h.(api.CloudflareHandle).CreateWAFListItems(context.Background(), mockPP,
+				ok = ch.CreateWAFListItems(context.Background(), mockPP,
 					mockWAFList, "description", tc.itemsToCreate, itemComment)
 				require.Equal(t, tc.ok, ok)
 				require.True(t, lh.isExhausted())
diff --git a/internal/pp/queued_test.go b/internal/pp/queued_test.go
deleted file mode 100644
index cac635e..0000000
--- a/internal/pp/queued_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package pp_test
-
-import (
-	"testing"
-
-	"go.uber.org/mock/gomock"
-
-	"github.com/favonia/cloudflare-ddns/internal/mocks"
-	"github.com/favonia/cloudflare-ddns/internal/pp"
-)
-
-func TestQueued(t *testing.T) {
-	t.Parallel()
-
-	for name, tc := range map[string]struct {
-		run          func(pp.QueuedPP)
-		prepareMocks func(ppfmt *mocks.MockPP, inner *mocks.MockPP)
-	}{
-		"flushed": {
-			func(queued pp.QueuedPP) {
-				var ppfmt pp.PP = queued
-				if ppfmt.IsShowing(pp.Info) {
-					ppfmt.Infof(pp.EmojiBullet, "Test")
-					ppfmt = ppfmt.Indent()
-				}
-				ppfmt.Noticef(pp.EmojiNotify, "some message")
-				ppfmt.Suppress(pp.MessageDetectionTimeouts)
-				ppfmt.BlankLineIfVerbose()
-				ppfmt.InfoOncef(pp.MessageIP6DetectionFails, pp.EmojiHint, "cannot do IPv6")
-				ppfmt.NoticeOncef(pp.MessageIP4DetectionFails, pp.EmojiHint, "cannot do IPv4")
-
-				queued.Flush()
-			},
-			func(ppfmt, inner *mocks.MockPP) {
-				ppfmt.EXPECT().Indent().Return(inner)
-				ppfmt.EXPECT().IsShowing(gomock.Any()).Return(true)
-				gomock.InOrder(
-					ppfmt.EXPECT().Infof(pp.EmojiBullet, "Test"),
-					inner.EXPECT().Noticef(pp.EmojiNotify, "some message"),
-					inner.EXPECT().Suppress(pp.MessageDetectionTimeouts),
-					inner.EXPECT().BlankLineIfVerbose(),
-					inner.EXPECT().InfoOncef(pp.MessageIP6DetectionFails, pp.EmojiHint, "cannot do IPv6"),
-					inner.EXPECT().NoticeOncef(pp.MessageIP4DetectionFails, pp.EmojiHint, "cannot do IPv4"),
-				)
-			},
-		},
-	} {
-		t.Run(name, func(t *testing.T) {
-			t.Parallel()
-
-			mockCtrl := gomock.NewController(t)
-			mockPP := mocks.NewMockPP(mockCtrl)
-			mockPPInner := mocks.NewMockPP(mockCtrl)
-			if tc.prepareMocks != nil {
-				tc.prepareMocks(mockPP, mockPPInner)
-			}
-
-			tc.run(pp.NewQueued(mockPP))
-		})
-	}
-}