198 Commits

Author SHA1 Message Date
bdf2c8b6b1 tests: avoid build warning
Check all the functions that return a Result.
2026-08-20 15:05:32 -07:00
ac52584562 build: modernize meson usage
Since we require meson 1.3(.2), we can modernize the usage a bit,
as well as improve some logic

- use / instead of join_paths
- use option.allowed() instead of !option.disable()
- use cxx.get_supported_arguments
- use fs.copyfile instead of configure_file
- show a summary at the end of the configuration
2026-08-20 15:05:32 -07:00
54786e2e97 message: fall-back to received for dateless
For the (rare) messages without a Date: header, attempt to guess a date
from the top (most-recent) Received: header. Not perfect, of course, but
better than nothing.

Requires re-indexing to apply to already indexed messages.

Should help for #1083.
2026-08-20 15:05:31 -07:00
4489d513be migrate to std::ranges
Move the various seq_ functions, as well as std::(stable_)sort,
std::accumulate, std::transform, std::find, std::find_if to their C++20
std::ranges counterparts.
2026-08-20 15:05:31 -07:00
7e83f5e4b0 mu-regex: add match_groups, use everywhere
Add match_groups to Mu::Regex, and update old "raw" GRegex users.
2026-08-20 15:05:31 -07:00
91ad1c4478 cld2: fix HAVE_CLD2 test
It _is_ defined (as 0) when there is no CLD2.
2026-08-20 15:05:30 -07:00
a347d3ada0 properties: support system-properties
Support "system" properties, i.e., library versions, whether
language-detection, scm is supported.

Make these more generic (with display strings), so we can handle them
more automatic int mu-cmd-info.
2026-08-20 15:05:30 -07:00
7d60d2728a index: generalize pre-fetch paths
We already pre-fetched db file paths for the cleanup-case (since
cdb619e4f), now let's generalize this to all indexing.

For now this is mostly performance-neutral (lazy-rescan is slightly
faster); however, this simplifies the code.
2026-08-20 15:05:30 -07:00
86464cd083 modernization: tweaks for c++20
Update various places for what we can do with C++20:

- ends_with / starts_with
- std::to_array
- using instead of typedef
- designated initializers
- "[[maybe_unused]]" instead of G_GNUC_UNUSED

Also remove some unnecessary 'static'
2026-08-20 15:05:30 -07:00
b0d5dc545e bench: update benchmark runner
Modernize code a bit; and use a temporary dir for the working set.
Typically, this makes the tests run faster (since the temporary dir is
often in-memory), which allows focusing on the part we can most easily
influence.
2026-08-20 15:05:30 -07:00
5fd639b5f3 mu: add keywords unit-test 2026-08-20 15:05:30 -07:00
341585ad66 test-store: disable bad test
The "expected-to-fail" test actually passes when root.
2026-08-20 15:05:28 -07:00
410ff46881 improve invoking external commands
- don't make assumptions on where programs live (i.e., /bin/sh, /bin/rm,
/bin/mv) are not universal
- dont invoke shell when unnecessary
- improve error-handling
2026-08-20 15:04:27 -07:00
9f69055ef9 test-mu-store: bump timeout in test
Seems some systems are quite slow, so bump the time-out.

Fixes #2886.
2026-08-20 15:04:27 -07:00
461e4f83fe store-test: add more label tests
Ensure removal affects the labels cache.
2026-08-20 15:04:26 -07:00
76b9000588 mu-document: improve sexp updating
Ensure the cached message sexp gets updated in all cases where it's necessary.
2026-08-20 15:04:26 -07:00
34d3bf2e28 tests: only build when needed
Build the tests lazily, i.e., not before `meson test`. This helps with
build-times.
2025-08-15 21:01:05 +03:00
cc1112d342 tests: skip some slow tests when valgrinding 2025-05-24 21:04:49 +03:00
a7778fc333 test-store: don't break on slow systems
The 'circular-symlink' test.
2025-04-13 20:34:44 +03:00
17b85e8390 test-circular-symlink: loosen test a bit
Work-around some weirdness. No energy to do a root-cause analysis ;)

Fixes #2832.
2025-04-12 00:56:43 +07:00
7baf1bf5e5 mu: remove empty refs + unit-test
Some message can have an _empty_ message-id, e.g. with:
  In-Reply-To: <>
which we weren't filter out.

This would yield and _empty_ Thread-Id, in mu-message.cc

And this would make mu-query believe it had no matches in the first
query, in Query::Private::run_related, and effectively throw away the
results. (Xapian using empty string both for a "not found" result, and
"found an empty string doesn't help either).

So, avoid having an empty reference. Also add a unit-test.

Fixes #2812.
2025-02-13 22:48:03 +02:00
09965b2d09 test: add unit-tests for related/new/skip-dups
Test the interaction between related/new/skipped-duplicates. Seems to
work as expected.
2025-02-02 11:38:32 +02:00
8fefc52eee query: add related: combi-field + test
Add a new combination (pseudo) field "related:", which combines
"message-id" and "references"
2024-12-02 11:43:14 +02:00
ed4d0f5e9d tests: add tests for ref: searching 2024-12-01 23:27:32 +02:00
d5d57b4327 remove non-single-threaded option
Single-threaded is the build-default, and seems to work well enough for
1.12.7, so remove the option to turn it off.

This is because build-options that influence such low-level/core
behavior are a pain to maintain.
2024-11-26 10:27:52 +02:00
c28bfe04e1 message: detect top-level smime parts + test
Fixes #2745
2024-08-22 22:34:34 +03:00
c6e8f894c1 test_index_move: extend unit test
Double-check the changed values are seen in a newly opened store.
2024-07-27 09:36:15 +03:00
bb5c36c658 tests: add some very basic CLD2_TEST
just to check if it works at all; no need to check cld2 at all.
2024-03-01 23:05:33 +02:00
30b8238522 tests: move to tests/, make optional
While not recommended, sometimes it can be useful to disable building
the unit tests. This can be done now with
    meson -Dtests=disabled build
2024-01-06 18:35:22 +02:00
146b80113f lib: move transaction handling to mu-xapian
Instead of handling transactions in the store, handle it in xapian-db.
Make the code a bit more natural / cleaner-out

Handle transaction automatically (with a batch-size) and add some RAII
Transaction object, which makes all database interaction transactable
for the duration. So, no more need for explicit parameters to
add_message while indexing.
2023-12-22 21:24:41 +02:00
de302e7609 lib/tests: add one more foo-bar regexp test 2023-10-29 17:16:05 +02:00
ee18c02762 maildir: improve unit tests
And get some more info from run_command.
2023-09-24 21:33:18 +03:00
4a0eba8ddf improve unit tests 2023-09-24 20:21:57 +03:00
2d20074b99 mu-move: add new move sub command
Add sub-command to move messages; add tests and docs.

Fixes #157
2023-09-24 17:29:08 +03:00
1a3dc46866 lib: maildir/store: more tests 2023-09-23 09:28:45 +03:00
5bda8c321b query: move phrasification to mu-query-parser
Do the "phrasification" for matching fields later during query parsing;
this allows for handling combination fields correctly.

Also match both the normal term and the "phrase term", so we catch more
cases. Update/extend unit tests.

This fixes the "kata-container" issue also for body test.

Fixes #2167.
2023-09-17 18:11:21 +03:00
9dcbe1d96c lib: unit tests: improve / better coverage 2023-09-13 23:02:53 +03:00
2f5602b938 unit tests: improve
and add a new one for the indexer
2023-09-12 21:38:57 +03:00
af9eb36ca0 unit-tests: modernize
Use TempDir, join_paths etc.
2023-09-11 23:51:37 +03:00
53c7381929 lib: move index/ into main lib/
simplify things a bit
2023-09-10 08:55:25 +03:00
3e5cec0d05 tests: update for new query parser / ngrams 2023-09-09 17:57:42 +03:00
a9bd6e69d3 lib: implement new query parser
Implement a new query parser; the results should be very similar to the
old one, but it adds an Sexp middle-representation, so users can see how
a query is interpreted.
2023-09-09 11:59:59 +03:00
3f8381134e test: move test messages to testdata/ 2023-09-05 08:34:27 +03:00
15f08488d3 remove Mu::format, use mu_format
Use the new fmt-based formatting.
2023-08-19 20:04:50 +03:00
8caf504381 store: update "move" and some related APIs
Update test cases as well.
2023-08-17 22:42:25 +03:00
da290c21a9 benchmark: improve setup
Add some useful make targets, and separate (optimized) build.
2023-07-25 23:56:19 +03:00
4c0b7db3d8 store: add 'add_document' optimization, use it
*Usually* we need Xapian's replace_document() API, but when we know a
document (message) is completely new, we can use the faster
add_document(). That is the case with the initial (re)indexing, when
start with an empty database.

Also a few smaller cleanups.
2023-07-25 23:56:19 +03:00
6ad5cccc53 store/index: and unit test for circular symlink
Check that we bail out early
2023-07-18 23:18:21 +03:00
4171fe14c3 store: removing trailing / for root_maildir
Other code depends on that.
2023-07-06 21:49:50 +03:00
4920b56671 update to use fmt-based apis
Not complete, but a first big stab converting users of Mu::Error and
various g_warning & friends, format to the new libfmt-based APIs.
2023-07-05 23:10:13 +03:00