bd-211: Remove deprecated rename functions from import_shared.go
- Removed renameImportedIssuePrefixes (wrapper, 3 LOC) - Removed renameImportedIssuePrefixesOld (deprecated, 61 LOC) - Removed replaceIDReferences (32 LOC) - Removed replaceBoundaryAware (31 LOC) - Removed isBoundary (5 LOC) - Removed TestIsBoundary (37 LOC) - Removed TestReplaceBoundaryAware (54 LOC) - Total: 223 LOC removed (136 LOC code + 91 LOC tests) - Active implementation is in internal/importer/importer.go - All tests pass
This commit is contained in:
@@ -45,59 +45,3 @@ func TestParseLabelArgs(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestReplaceBoundaryAware(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
text string
|
||||
oldID string
|
||||
newID string
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
name: "simple replacement",
|
||||
text: "See bd-1 for details",
|
||||
oldID: "bd-1",
|
||||
newID: "bd-100",
|
||||
expected: "See bd-100 for details",
|
||||
},
|
||||
{
|
||||
name: "multiple occurrences",
|
||||
text: "bd-1 relates to bd-1",
|
||||
oldID: "bd-1",
|
||||
newID: "bd-999",
|
||||
expected: "bd-999 relates to bd-999",
|
||||
},
|
||||
{
|
||||
name: "no match",
|
||||
text: "See bd-2 for details",
|
||||
oldID: "bd-1",
|
||||
newID: "bd-100",
|
||||
expected: "See bd-2 for details",
|
||||
},
|
||||
{
|
||||
name: "boundary awareness - don't replace partial match",
|
||||
text: "bd-1000 is different from bd-100",
|
||||
oldID: "bd-100",
|
||||
newID: "bd-999",
|
||||
expected: "bd-1000 is different from bd-999",
|
||||
},
|
||||
{
|
||||
name: "in parentheses",
|
||||
text: "Related issue (bd-42)",
|
||||
oldID: "bd-42",
|
||||
newID: "bd-1",
|
||||
expected: "Related issue (bd-1)",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result := replaceBoundaryAware(tt.text, tt.oldID, tt.newID)
|
||||
if result != tt.expected {
|
||||
t.Errorf("replaceBoundaryAware(%q, %q, %q) = %q, want %q",
|
||||
tt.text, tt.oldID, tt.newID, result, tt.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user