MCPcopy
hub / github.com/autobrr/qui / TestNormalizeForMatching

Function TestNormalizeForMatching

pkg/stringutils/unicode_test.go:73–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

71}
72
73func TestNormalizeForMatching(t *testing.T) {
74 tests := []struct {
75 name string
76 input string
77 expected string
78 }{
79 // Unicode normalization
80 {"macron", "Shōgun S01", "shogun s01"},
81 {"accent", "Amélie 2001", "amelie 2001"},
82 {"umlaut", "Mötley Crüe The Dirt", "motley crue the dirt"},
83
84 // Apostrophe handling
85 {"straight apostrophe", "Bob's Burgers", "bobs burgers"},
86 {"curly apostrophe right", "Don\u2019t Stop", "dont stop"},
87 {"curly apostrophe left", "\u2018Tis Fine", "tis fine"},
88 {"modifier letter apostrophe", "Haibara\u02bcs Teenage New Game", "haibaras teenage new game"},
89 {"backtick", "Rock`n Roll", "rockn roll"},
90
91 // Colon handling
92 {"colon", "CSI: Miami", "csi miami"},
93 {"colon with space", "City: Downtown", "city downtown"},
94 {"comma", "Signal, Bloom", "signal bloom"},
95 {"comma without space", "Signal,Bloom", "signal bloom"},
96
97 // Hyphen handling
98 {"hyphen", "Spider-Man", "spider man"},
99 {"multiple hyphens", "X-Men: Days of Future Past", "x men days of future past"},
100
101 // Decorative anime title symbols
102 {"star separator", "Classic★Stars", "classic stars"},
103 {"hollow star separator", "Idol☆Time", "idol time"},
104 {"middle dot separator", "Kaguya・Sama", "kaguya sama"},
105 {"music note separator", "Love♪Live", "love live"},
106
107 // Ampersand handling
108 {"ampersand", "His & Hers", "his and hers"},
109 {"ampersand no spaces", "Law&Order", "law and order"},
110 {"ampersand with spaces", "Will & Grace", "will and grace"},
111
112 // Combined
113 {"all punctuation", "Bob's Place: Spider-Man", "bobs place spider man"},
114 {"unicode and punctuation", "Shōgun: The Warrior's Way", "shogun the warriors way"},
115
116 // Whitespace
117 {"extra spaces", "The Show", "the show"},
118 {"trim whitespace", " Trimmed ", "trimmed"},
119 {"tabs and spaces", "Hello\t World", "hello world"},
120
121 // Real-world examples
122 {"shogun full", "Shōgun S01E01 1080p DSNP WEB-DL", "shogun s01e01 1080p dsnp web dl"},
123 {"pokemon", "Pokémon Journeys S01", "pokemon journeys s01"},
124 {"leon", "Léon: The Professional 1994", "leon the professional 1994"},
125 {"naruto", "Naruto Shippūden S01E01", "naruto shippuden s01e01"},
126
127 // Edge cases
128 {"empty string", "", ""},
129 {"only spaces", " ", ""},
130 {"only punctuation", "'-:", ""},

Callers

nothing calls this directly

Calls 2

NormalizeForMatchingFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected