| 1 | package control |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | // TestStripComposePrefixesOrdering pins the #7804 regression: the plan marker |
| 6 | // is prepended after the transient blocks, so blocks only become leading once |
| 7 | // the marker strips — a single pass left the whole notice chain in the rewind |
| 8 | // picker's turn label. |
| 9 | func TestStripComposePrefixesOrdering(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | input string |
| 13 | want string |
| 14 | }{ |
| 15 | { |
| 16 | name: "marker before transient blocks strips both", |
| 17 | input: PlanModeMarker + "\n\n<reasoning-language>zh</reasoning-language>\n\n<memory-update>\nsaved\n</memory-update>\n\nfix login", |
| 18 | want: "fix login", |
| 19 | }, |
| 20 | { |
| 21 | name: "marker between transient blocks strips all", |
| 22 | input: "<background-jobs>\n1 running\n</background-jobs>\n\n" + PlanModeMarker + "\n\n<active-goal>ship it</active-goal>\n\nkeep going", |
| 23 | want: "keep going", |
| 24 | }, |
| 25 | } |
| 26 | for _, tt := range tests { |
| 27 | t.Run(tt.name, func(t *testing.T) { |
| 28 | if got := StripComposePrefixes(tt.input); got != tt.want { |
| 29 | t.Fatalf("StripComposePrefixes() = %q, want %q", got, tt.want) |
| 30 | } |
| 31 | }) |
| 32 | } |
| 33 | } |
| 34 |