Conversation
It helps to reduce boilerplate code in tests.
The helper utilities getSuggestions() and EXPECT_SUGGESTION_RESULTS in the suggestion unit-test actually return and check only titles. So renamed them as follows, so that the old names can then be used for new helpers for more exhaustive testing of suggestions: getSuggestions() -> getSuggestedTitles() EXPECT_SUGGESTION_RESULTS() -> EXPECT_SUGGESTED_TITLES()
zim::Archive::Entry::offset() is not a state modifier method. The bug was hiding there for almost four years and was not observed as it only applied to paging of suggestions in the absence of Xapian DB. Paging (infinite scrolling) of suggestions in the UI was implemented in kiwix-desktop last year and was (naturally) tested only on ZIM archives with Xapian indexes.
The diff is a little easier to understand if whitespace changes are ignored.
It was used to get rid of the custom copy-constructor and copy-assignment operator in SuggestionIterator::SuggestionInternalData, but probably may be (re)used in other code like that.
Didn't replace `std::unique_ptr` with `ValuePtr` in `mp_rangeIterator` and `mp_internal` data members of `zim::SuggestionIterator` since the latter is part of the libzim public API (and that would require making `smartptr.h` a public header file).
Moved the declaration of SuggestionIterator::SuggestionInternalData
to suggestion_iterator.cpp. As a result, had to move the definition of
SuggestionResultSet::{begin,end}() there, too.
Renamed SuggestionIterator::Impl::{mp_internalDb -> mp_db}
... instead of the full Xapian document
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1006 +/- ##
==========================================
+ Coverage 57.96% 58.13% +0.17%
==========================================
Files 101 101
Lines 5407 5384 -23
Branches 2219 2197 -22
==========================================
- Hits 3134 3130 -4
+ Misses 800 795 -5
+ Partials 1473 1459 -14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Rewrote the Suggestion.indexFullPath unit-test by checking the Xapian data directly.
Having data members conditionally compiled makes the libzim ABI dependent on the build type which can lead to crashes if a wrong build of libzim is used with the client application. This commit doesn't fully solve the problem since LIBZIM_WITH_XAPIAN is still used in include/zim/suggestion.h
cf894d8 to
5d00100
Compare
Contributor
|
@veloman-yunkan Few questions my side:
|
Collaborator
Author
@kelson42 I intended to have it merged right before #1007, but as a refactoring/cleanup effort it makes sense to commit this work regardless of whether any subsequent changes dependent on it follow.
Did you mean no API and behaviour change? If yes, then mostly yes. There is one bug-fix for an exotic scenario.
Yes, this is a purely clean-up PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the clean-up work extracted from #994