Martchus
3c769fa242
Add greedy-flag for argument parser
...
This is useful if one needs to pass subsequent arguments as-is to another
nested argument parser.
2022-06-26 11:24:36 +02:00
Martchus
3444e4bbb1
Improve argument parser tests
...
* Use auto
* Use `CPPUNIT_ASSERT_EQUAL` with `std::string_view` instead of `strcmp`
for better error messages in case of a failure
* Avoid instantiating an `std::string` in checks using `std::string_view`
instead
2022-06-26 11:18:36 +02:00
Martchus
c931e2d928
Fix missing `#pragma GCC diagnostic push`
2022-05-21 12:13:01 +02:00
Martchus
7555e6854b
Add test helper to use std::optional via CPPUNIT_ASSERT_EQUAL
2022-05-15 02:18:07 +02:00
Martchus
c1152ca062
Ignore warning about possible null pointer dereferences appearing with GCC 12
...
Not sure why this warning is occurring but it is likely incorrect
2022-05-12 20:31:05 +02:00
Martchus
f88ca7d16d
Silence warning about type conversion in test helper
...
It is a possibly lossy conversion but good enough for a test helper.
2022-03-20 16:56:11 +01:00
Martchus
052f8d2bd2
Add helper to make native path from internal representaton
2022-03-17 22:31:11 +01:00
Martchus
77c353fb6c
Add `TickType` and integer overloads to chrono utilities
2022-02-15 23:01:25 +01:00
Martchus
a8fddad804
Add WorkingCopyMode::Cleanup
2022-01-08 23:35:01 +01:00
Martchus
f81607be82
Possibly avoid ambiguous function call in conversion tests
...
This might avoid
```
/Users/oldfaithful/Local/tageditor/cpp-utilities/tests/conversiontests.cpp:29:15: error: call to 'swapOrder' is ambiguous static_assert(swapOrder(0xABCDEF1234567890ul) == 0x9078563412EFCDABul, "swapOrder(uint64)");
```
reported by https://github.com/Martchus/cpp-utilities/issues/22
2021-12-12 22:58:01 +01:00
Martchus
3b0ed313bc
Avoid warning about using uninitialized variable
2021-12-11 23:58:51 +01:00
Martchus
15fddad46d
Log error when "srcdirref" cannot be opened
2021-08-03 14:05:33 +02:00
Martchus
b16fff4b0a
Test splitString*() with an empty input
2021-07-24 23:38:44 +02:00
Martchus
6558ff487a
Add BufferSearch (from arch-repo-manager) to use it in syncthingtray as well
2021-07-15 02:24:28 +02:00
Martchus
b3ebe5ce38
Fix typos found via `codespell --skip .git -w`
2021-07-03 19:07:49 +02:00
Martchus
95202d059a
Fix typo
2021-06-04 16:04:26 +02:00
Martchus
a116c9e790
Avoid possibility of overflow in DateTime parsing functions
...
* This is strictly undefined behavior so let's avoid it
* As a side-effect it is now possible to omit the separators in
DateTime::fromIsoString()
2021-05-24 21:27:18 +02:00
Martchus
2e93882882
Reduce redundant code in stringconversion.h
2021-05-24 19:51:49 +02:00
Martchus
3afed30760
Detect overflow in functions to convert strings to numbers
...
Otherwise these functions can strictly run into undefined behavior which
should be prevented.
2021-05-24 19:51:49 +02:00
Martchus
546b1fecb7
Fix parsing ISO timestamp with negative timezone offset and no seconds fraction
...
See https://github.com/Martchus/syncthingtray/issues/93
2021-05-21 19:40:37 +02:00
Martchus
f549285fde
Fix splitString()/splitStringSimple() for case of empty trailing part
2021-05-11 16:42:28 +02:00
Martchus
0fb533ffc5
Format attempted test file/dir lookups more nicely in the error case
2021-04-06 17:46:15 +02:00
Martchus
f30947cc75
Fix plural of parameter
2021-03-30 20:48:05 +02:00
Martchus
8c033ca243
Fix warnings
2021-03-20 21:56:45 +01:00
Martchus
1f4fabcd9f
Add operators '*' and '/' to TimeSpan
2020-10-24 22:10:25 +02:00
Martchus
dd41762b70
Add testDirPath() for finding directories with test files
...
The same as testFilePath(), just for directories.
2020-09-23 22:49:33 +02:00
Martchus
9d59ab5c29
Fix Traits::IsSpecializationOf for references
...
This check is also supposed to work for references so use the same approach
as for ignoring cv qualifiers.
2020-06-17 21:41:00 +02:00
Martchus
940593429a
Allow ArgumentParserTests to pass when working dir present within testfiles dir
2020-06-16 01:03:39 +02:00
Martchus
52722be407
Add test helper execHelperAppInSearchPath()
2020-06-10 18:42:50 +02:00
Martchus
26b0d2d97c
Avoid some test classes to show up in the documentation
2020-05-01 13:47:06 +02:00
Martchus
43550b6d55
Add AdvancedIniFile for better preserving certain aspects like comments
2020-05-01 13:47:06 +02:00
Martchus
32780ed6a6
Support formatting ISO timestamps via DateTime::toString() with option to omit defaults
...
Omitting components are also allowed when parsing ISO timestamps so it makes sense to
have something similar in the other direction as well.
Note that the idea comes from ID3v2.4.0 which stores timestamps in a subset of ISO 8601
similarily to what this library supports and it allows to omit default components as
well.
2020-04-26 21:38:02 +02:00
Martchus
c834f8923d
Allow omitting month and day when parsing ISO date
...
This leaves only the year as mandatory component (other components
can already be omitted).
2020-04-24 22:15:49 +02:00
Martchus
73470d0b65
Fix DateTime::fromDateAndTime() for the day 0001-01-01
2020-04-24 21:55:45 +02:00
Martchus
3fe1ea64cf
Improve documentation of some test utilities
2020-04-13 23:35:22 +02:00
Martchus
06e29dd751
test utils: Use /proc/self/exe to find srcdirref, at least where supported
...
So it also works if e.g. chdir() is called before instantiating
the TestApplication.
2020-04-11 22:12:49 +02:00
Martchus
9fe7053869
Print "Executing test" via cppunit.h
...
Otherwise it is a bit annoying if one just wants to instantiate
a TestApplication for looking up test files.
2020-04-11 21:50:55 +02:00
Martchus
e1313c77a0
Add test for fileName() without parent directories
2020-04-11 21:44:07 +02:00
Martchus
a7564b8dde
Add TESTUTILS_ASSERT_LIKE_FLAGS to pass regex flags
2020-03-02 18:24:06 +01:00
Martchus
8744cf95ef
Ensure no copy is made when using argsToString()
...
It seems that std::make_tuple() is using __decay_and_strip so
the arguments get copied. Using the std::tuple c'tor directly
instead.
When using the %-operator it is already taken care that strings
are stored as pointers and not by value.
2020-02-18 19:29:23 +01:00
Martchus
c7c5352325
Use a universal reference to implement dereferenceMaybe()
2020-02-18 19:20:24 +01:00
Martchus
561f298567
Fix string builder tests for Windows
2020-02-14 17:14:06 +01:00
Martchus
1154ed4d1c
Improve exception messages of NativeFileStream
...
So one gets e.g. "open failed: Permission denied" instead of
just "open failed: iostream error".
2020-02-14 17:13:05 +01:00
Martchus
7204bc6f06
Support using string builder with types convertible to target string type
...
So e.g. std::filesystem::path can be used to build an std::string.
2020-02-13 17:05:46 +01:00
Martchus
a5283535cc
Support nested tuples in string builder
...
This is useful to concatenate previously constructed sub
strings passed around as tuples.
2020-01-26 19:02:22 +01:00
Martchus
0cdf2c3492
Use const where possible in code dealing with profiling data
2020-01-12 21:02:43 +01:00
Martchus
1bdc088b54
Close workingCopy in workingCopyPathAs() for correct error handling
2019-12-15 19:01:04 +01:00
Martchus
07ae1588fa
Add writeFile()
...
Due to the required `file.close()` at then end this is easy
to get wrong. So let's add a helper.
2019-12-15 19:00:15 +01:00
Martchus
b8a60a0cd4
Support string builder operator '%' for std::string_view
2019-11-28 23:05:55 +01:00
Martchus
8e3aa84780
Support std::string_view in stringbuilder.h
2019-11-28 22:34:10 +01:00