@@ -722,6 +722,16 @@ TEST(Suggestion, titleEdgeCases) {
722722 { " toolongsingleword1" , w64 },
723723 { " toolongsingleword2" , w65 },
724724
725+ // Handling of pseudo-words consisting exclusively of punctuation
726+ { " winknsmilewithouttext" , " ;-)" }, // A punctuation-only title
727+ { " winknsmilebothways" , " ;-) wink'n'smile" },
728+ { " winknsmiletheotherwayaround" , " wink'n'smile ;-)" },
729+ { " smilinglongword" , " ;-) " + w65 },
730+
731+ // Handling of stopwords
732+ { " hasisastopword" , " Kiwix has our support" },
733+ { " titlemadeofonlystopwords" , " He who has nothing" },
734+
725735 // Non edge cases
726736 { " Stout" , " About Rex Stout" },
727737 { " Hangout" , " Without a trout" },
@@ -758,6 +768,26 @@ TEST(Suggestion, titleEdgeCases) {
758768 // w65 and "Is " + w65 + " too long?" aren't included because w65 has
759769 // been ignored during indexing
760770 );
771+
772+ EXPECT_SUGGESTED_TITLES (archive, " ;-" ,
773+ " ;-)" ,
774+ // ";-) wink'n'smile" and "wink'n'smile ;-)" are not included because
775+ // ";-)" isn't treated as a term in the presence of more serious text
776+ );
777+
778+ EXPECT_SUGGESTED_TITLES (archive, " win" ,
779+ " ;-) wink'n'smile" ,
780+ " wink'n'smile ;-)"
781+ );
782+
783+ EXPECT_SUGGESTED_TITLES (archive, " smile" ,
784+ /* nothing */ // smile in "wink'n'smile" isn't a separate term
785+ );
786+
787+ EXPECT_SUGGESTED_TITLES (archive, " has" ,
788+ " He who has nothing" , // XXX: "has" should've been ignored as a term
789+ " Kiwix has our support" , // XXX: "has" should've been ignored as a term
790+ );
761791}
762792
763793zim::Entry getTitleIndexEntry (const zim::Archive& a)
0 commit comments