Commit Graph

43 Commits

Author SHA1 Message Date
Alexey Sokolov 663699b617 Merge pull request #2015 from MarkLee131/fix/cstring-empty-input-guards
ZNCString: guard Replace/Split against empty-width arguments
2026-05-04 22:05:49 +01:00
MarkLee131 80699c4178 test: use EXPECT_THAT matchers for Split assertions
Pull in gmock so the empty-delimiter Split assertions can keep using
EXPECT_THAT(..., ElementsAre(...)) and IsEmpty(). On failure the matcher
prints the actual vector contents, which EXPECT_TRUE(vempty.empty())
hides behind a bare 'not true'.
2026-05-04 20:51:56 +08:00
MarkLee131 c3f1b0c00e test: replace gmock matchers in Split test with gtest equivalents
StringTest.cpp does not include gmock, so EXPECT_THAT/ElementsAre/IsEmpty
do not compile and the unittest target fails on every CI configuration.
Use EXPECT_EQ against a VCString and EXPECT_TRUE(empty()) instead, which
keeps the test scope identical without dragging gmock into this file.
2026-05-04 19:31:29 +08:00
MarkLee131 099895b1f0 test: fix \xff hex escape parsing in Base64 test for stricter compilers
GCC parses "AA\xffA" greedily as \xffA (next character is a hex digit),
which is out of range for char and breaks the Linux CI build. Split the
literal into "AA\xff" "A" so the escape resolves before the next string,
yielding the intended four bytes (A, A, 0xff, A).
2026-04-29 19:33:30 +08:00
MarkLee131 8d92fe7933 Update test/StringTest.cpp
Co-authored-by: Alexey Sokolov <alexey+github@asokolov.org>
2026-04-28 22:11:13 +08:00
MarkLee131 bee6d9443c Update test/StringTest.cpp
Co-authored-by: Alexey Sokolov <alexey+github@asokolov.org>
2026-04-28 22:11:02 +08:00
MarkLee131 d60f489c27 test: cover Base64Decode round-trip and out-of-alphabet bytes (#2013) 2026-04-25 17:34:11 +08:00
MarkLee131 c94df21130 test: cover empty-needle Replace and empty-delim Split (#2009) 2026-04-25 17:26:04 +08:00
Falk Rund ad6a397ca4 Welcome to 2026
[skip ci]
2026-01-01 13:44:32 +01:00
Peter 44e4b95a20 Welcome to 2025 (#1929) 2025-02-07 23:23:45 +00:00
Falk Rund 17a004aa0b Welcome to 2024
[skip ci]
2023-12-31 21:09:25 +01:00
Falk Rund f9fd05c307 Welcome to 2023 2023-01-01 06:49:00 +01:00
Falk Rund 6402d241ac Welcome to 2022
The same procedure as last year, Miss Sophie?
Same procedure as every year, James.
2022-01-01 14:05:32 +01:00
MAGIC 99687b0f24 Welcome to 2021 2021-01-01 19:37:07 +01:00
Alexey Sokolov e801c49740 Test #1715 2020-04-20 20:51:07 +01:00
MAGIC 9081aa971d Welcome to 2020 2020-01-02 00:36:05 +01:00
dgw 8d5427cf9b Welcome to 2019
What are we going to do today, Brain?

The same thing we do every year, Pinky: Update all the copyright
headers!

[Skip CI]
2019-01-01 17:05:05 -06:00
Alexey Sokolov 1e08e5c702 Move gtest's printer for CString to a place visible to all tests 2018-04-02 12:17:14 +01:00
Alexey Sokolov e3a1308a04 Make order of EXPECT_EQ more natural, after upgrade to new GTest. 2018-02-13 08:41:53 +00:00
Falk Seidel d647eaabc0 Welcome to 2018
The same procedure as last year, Miss Sophie?
The same procedure as every year, James.

[skip ci]
2018-01-19 19:38:58 +00:00
Phansa 3189ce7f8a Welcome to 2017
Welcome to 2017

temp

temp2
2017-03-12 20:34:26 -04:00
Kyle Fuller cc674b28e8 [CString.StripControls] Improve test coverage formatting 2016-04-11 22:09:46 +01:00
Kyle Fuller 032f00732a [CString.StripControls] Srip bg colours when we reset fg 2016-04-11 22:09:40 +01:00
Falk Seidel 8f73840e74 Welcome to 2016
🎆  Happy 2016 🎆
2016-01-01 20:11:21 +01:00
Alexey Sokolov d185d6f22d clang-format: switch tabs to spaces
I like tabs, but I have to admit that spaces make source code more
consistent, because every editor/viewer tends to render tabs differently :(
2015-12-07 00:53:30 +00:00
Alexey Sokolov 33b0627d75 Add clang-format configuration.
For now, it uses tabs like before, to make the diff easier to read/check.
One of following commits will switch it to spaces.
2015-12-07 00:53:01 +00:00
Alexey Sokolov 02f8749a8b Protect some parts of code from clang-format 2015-12-07 00:48:58 +00:00
J-P Nurmi 565d04a8ef Resolve 'make test' warnings
Fix our own, and hide csocket, gtest & gmock related.
2015-09-21 15:41:20 +02:00
J-P Nurmi 87ae630046 Merge pull request #991 from jpnurmi/initializer_list
Add initializer_list ctors for CString & MCString
2015-07-31 22:08:43 +02:00
J-P Nurmi d5cefbfb71 Fix StringTest
- EXPECT_EQ() takes the expected value first
2015-07-13 20:22:03 +02:00
J-P Nurmi 1aba508298 Add initializer_list ctors for CString & MCString 2015-07-13 19:04:14 +02:00
J-P Nurmi afaf255246 CString::WildCmp(): add an optional case-sensitivity argument
It's getting a common pattern to call AsLower() or MakeLower() on
the arguments passed to WildCmp(), we might as well add this for
convenience. It's tempting to make it case-insensitive by default,
since pretty much any IRC related comparison should be, but that
could potentially break some existing code.
2015-02-23 08:45:52 +01:00
Falk Seidel 2e29d49a53 Welcome to 2015 2014-12-31 11:28:38 +01:00
Alexey Sokolov 213c3839a8 Merge pull request #693 from jpnurmi/tags
Valueless & escaped message tags
2014-09-29 23:53:55 +01:00
J-P Nurmi e20ac1a31e Add CString::Contains() for convenience
This is more convenient and readable than comparing Find() to npos,
which is a common task:

$ git grep "find(" | grep "npos" | wc -l
49
2014-09-30 00:15:34 +02:00
J-P Nurmi 5507e9a290 Add CString::Find() with case sensitivity support 2014-09-30 00:15:22 +02:00
J-P Nurmi 92c9a2e6ae Escape message tag values (ref #684) 2014-09-30 00:02:22 +02:00
J-P Nurmi 65f739980d CString::Starts/EndsWith(): allow specifying case sensitivity 2014-09-29 16:41:07 +02:00
J-P Nurmi e86f43d841 Introduce CaseSensitivity enum class
The enum is a bit more verbose, but leads to more readable code:

str.Equals("foo", true)
// vs.
str.Equals("foo", CString::CaseSensitive)

Deprecate the old Equals() and leave out the length parameter
from the new version => use StartsWith() or StrCmp() instead.
2014-09-29 16:30:45 +02:00
Uli Schlachter d4fefd1888 StringTest: Make a local function static
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-06 14:50:58 +02:00
Falk Seidel f19b4caa43 Welcome to 2014 - year 10 with ZNC 2013-12-31 10:10:55 +01:00
Alexey Sokolov 91e5330db5 More string tests. 2013-10-13 21:00:43 +04:00
Alexey Sokolov 257e681036 Rename EscapeTest to StringTest 2013-10-13 21:00:43 +04:00