Skip to content

Commit

Permalink
Merge pull request #33254 from vespa-engine/toregge/rewrite-config-co…
Browse files Browse the repository at this point in the history
…nfigformat-unit-test-to-gtest

Rewrite config configformat unit test to gtest.
  • Loading branch information
vekterli authored Feb 4, 2025
2 parents aab3a09 + fab5b7b commit d2abf51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion config/src/tests/configformat/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_executable(config_configformat_test_app TEST
SOURCES
configformat.cpp
configformat_test.cpp
DEPENDS
vespa_config
GTest::gtest
)
vespa_add_test(NAME config_configformat_test_app COMMAND config_configformat_test_app)
vespa_generate_config(config_configformat_test_app ../../test/resources/configdefinitions/my.def)
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/vespalib/testkit/test_kit.h>
#include <vespa/config/print/fileconfigformatter.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/gtest/gtest.h>

using namespace config;
using namespace vespalib::slime::convenience;

TEST("requireThatConfigIsFormatted") {
TEST(ConfigFormatTest, requireThatConfigIsFormatted)
{
ConfigDataBuffer buffer;
vespalib::Slime & slime(buffer.slimeObject());
Cursor &c = slime.setObject().setObject("configPayload").setObject("myField");
Expand All @@ -15,7 +16,7 @@ TEST("requireThatConfigIsFormatted") {

FileConfigFormatter formatter;
formatter.encode(buffer);
EXPECT_EQUAL(std::string("myField \"foo\"\n"), buffer.getEncodedString());
EXPECT_EQ(std::string("myField \"foo\"\n"), buffer.getEncodedString());
}

TEST_MAIN() { TEST_RUN_ALL(); }
GTEST_MAIN_RUN_ALL_TESTS()

0 comments on commit d2abf51

Please sign in to comment.