2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-02 06:55:16 +00:00

[65-libyang-generic] Untabify

This commit is contained in:
Francis Dupont
2018-09-12 11:21:22 +02:00
parent edc8057687
commit df15fba97f

View File

@@ -42,14 +42,14 @@ bool schemaInstalled(const std::string& name, bool verbose = false) {
bool found = false; bool found = false;
for (int i = 0; i < schema_cnt; i++) { for (int i = 0; i < schema_cnt; i++) {
string installed_name(schemas->schema(i)->module_name()); string installed_name(schemas->schema(i)->module_name());
if (installed_name == name) { if (installed_name == name) {
found = true; found = true;
} }
if (verbose) { if (verbose) {
std::cout << "Schema " << i << ": " << installed_name << endl; std::cout << "Schema " << i << ": " << installed_name << endl;
} }
} }
return (found); return (found);
@@ -373,13 +373,13 @@ TEST(TranslatorBasicTest, getItem) {
// Check error. // Check error.
xpath = "null"; xpath = "null";
try { try {
elem = t_obj->getItem(xpath); elem = t_obj->getItem(xpath);
ADD_FAILURE() << "expected exception"; ADD_FAILURE() << "expected exception";
} catch (const SysrepoError& ex) { } catch (const SysrepoError& ex) {
EXPECT_EQ("sysrepo error getting item at 'null': Invalid argument", EXPECT_EQ("sysrepo error getting item at 'null': Invalid argument",
string(ex.what())); string(ex.what()));
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
ADD_FAILURE() << "unexpected exception with: " << ex.what(); ADD_FAILURE() << "unexpected exception with: " << ex.what();
} }
} }
@@ -506,7 +506,7 @@ TEST(TranslatorBasicTest, setItem) {
ConstElementPtr elem = Element::createMap(); ConstElementPtr elem = Element::createMap();
EXPECT_THROW(t_obj->setItem(xpath, elem, SR_CONTAINER_T), NotImplemented); EXPECT_THROW(t_obj->setItem(xpath, elem, SR_CONTAINER_T), NotImplemented);
EXPECT_THROW(t_obj->setItem(xpath, elem, SR_CONTAINER_PRESENCE_T), EXPECT_THROW(t_obj->setItem(xpath, elem, SR_CONTAINER_PRESENCE_T),
NotImplemented); NotImplemented);
// List. // List.
xpath = "/keatest-module:container/list"; xpath = "/keatest-module:container/list";
@@ -662,28 +662,28 @@ TEST(TranslatorBasicTest, setItem) {
xpath = "/keatest-module:main/no_such_string"; xpath = "/keatest-module:main/no_such_string";
elem = Element::create(string("str")); elem = Element::create(string("str"));
try { try {
t_obj->setItem(xpath, elem, SR_STRING_T); t_obj->setItem(xpath, elem, SR_STRING_T);
ADD_FAILURE() << "expected exception"; ADD_FAILURE() << "expected exception";
} catch (const SysrepoError& ex) { } catch (const SysrepoError& ex) {
string expected = "sysrepo error setting item '\"str\"' at '" + string expected = "sysrepo error setting item '\"str\"' at '" +
xpath + "': Request contains unknown element"; xpath + "': Request contains unknown element";
EXPECT_EQ(expected, string(ex.what())); EXPECT_EQ(expected, string(ex.what()));
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
ADD_FAILURE() << "unexpected exception with: " << ex.what(); ADD_FAILURE() << "unexpected exception with: " << ex.what();
} }
// Bad type. // Bad type.
xpath = "/keatest-module:main/string"; xpath = "/keatest-module:main/string";
elem = Element::create(true); elem = Element::create(true);
try { try {
t_obj->setItem(xpath, elem, SR_BOOL_T); t_obj->setItem(xpath, elem, SR_BOOL_T);
ADD_FAILURE() << "expected exception"; ADD_FAILURE() << "expected exception";
} catch (const SysrepoError& ex) { } catch (const SysrepoError& ex) {
string expected = "sysrepo error setting item 'true' at '" + string expected = "sysrepo error setting item 'true' at '" +
xpath + "': Invalid argument"; xpath + "': Invalid argument";
EXPECT_EQ(expected, string(ex.what())); EXPECT_EQ(expected, string(ex.what()));
} catch (const std::exception& ex) { } catch (const std::exception& ex) {
ADD_FAILURE() << "unexpected exception with: " << ex.what(); ADD_FAILURE() << "unexpected exception with: " << ex.what();
} }
// Delete (twice). // Delete (twice).