mirror of
https://github.com/znc/znc.git
synced 2026-06-12 09:45:00 +02:00
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'.
This commit is contained in:
+7
-3
@@ -14,9 +14,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <znc/ZNCString.h>
|
||||
|
||||
using ::testing::ElementsAre;
|
||||
using ::testing::IsEmpty;
|
||||
|
||||
class EscapeTest : public ::testing::Test {
|
||||
protected:
|
||||
void testEncode(const CString& in, const CString& expectedOut,
|
||||
@@ -190,11 +194,11 @@ TEST(StringTest, Split) {
|
||||
// element (or zero elements if the input itself is empty).
|
||||
VCString vempty;
|
||||
EXPECT_EQ(CS("abc").Split("", vempty, false), 1u);
|
||||
EXPECT_EQ(vempty, VCString({"abc"}));
|
||||
EXPECT_THAT(vempty, ElementsAre("abc"));
|
||||
EXPECT_EQ(CS("abc").Split("", vempty, true), 1u);
|
||||
EXPECT_EQ(vempty, VCString({"abc"}));
|
||||
EXPECT_THAT(vempty, ElementsAre("abc"));
|
||||
EXPECT_EQ(CS("").Split("", vempty, false), 0u);
|
||||
EXPECT_TRUE(vempty.empty());
|
||||
EXPECT_THAT(vempty, IsEmpty());
|
||||
}
|
||||
|
||||
TEST(StringTest, NamedFormat) {
|
||||
|
||||
Reference in New Issue
Block a user