diff --git a/src/parser.cc b/src/parser.cc index 8ea625cc0..2442f4831 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -1119,17 +1119,10 @@ void addNestedModel(ElementPtr _sdf, ElementPtr _includeSDF) std::string(">") + name_with_nested_prefix + "<"); // Deal with nested model inside other nested model and already with // ::namespace:: entries in the name - // Case A. ::namespace1::iter.first::namespace2 - replace_all(str, std::string("::") + old_name + "::", - std::string("::") + name_with_nested_prefix + "::"); - // Case B. >iter.first::component replace_all(str, std::string(">") + old_name + "::", std::string(">") + name_with_nested_prefix + "::"); - // Case C.::component::iter.first< - replace_all(str, std::string("::") + old_name + "<", - std::string("::") + name_with_nested_prefix + "<"); - // remove duplicate prefixes introduced by the logic above (cases - // A,B,C) if the full name (iter.second) was used in the original SDF: (i.e + // remove duplicate prefixes introduced by the logic above + // if the full name (iter.second) was used in the original SDF: (i.e // iter.second::component) std::string::size_type found = name_with_nested_prefix.find(old_name); if (found != std::string::npos) diff --git a/test/integration/model/nested_names_test/submodel_test.sdf b/test/integration/model/nested_names_test/submodel_test.sdf index 3c4347800..2bd5d5294 100644 --- a/test/integration/model/nested_names_test/submodel_test.sdf +++ b/test/integration/model/nested_names_test/submodel_test.sdf @@ -15,7 +15,7 @@ main_model_prefix::subnested_model::link1 - other_prefix::subnested_model + joint1 diff --git a/test/integration/nested_model.cc b/test/integration/nested_model.cc index 69f9702ff..098d2cb2f 100644 --- a/test/integration/nested_model.cc +++ b/test/integration/nested_model.cc @@ -278,15 +278,11 @@ TEST(NestedModel, IncludeFlatteningNames) "main_model_prefix::subnested_model"); EXPECT_EQ(jointElem->Get("child"), "main_model_prefix::subnested_model::link1") << - "Flattening logic for nested models failed for case B (check parser.cc)"; + "Flattening logic for nested models failed (check parser.cc)"; sdf::ElementPtr joint2Elem = jointElem->GetNextElement("joint"); EXPECT_EQ(joint2Elem->Get("name"), "main_model_prefix::joint2"); EXPECT_EQ(joint2Elem->Get("parent"), "main_model_prefix::subnested_model::link1") << - "Flattening logic for nested models failed for case A" << - "(check parser.cc) + duplicates"; - EXPECT_EQ(joint2Elem->Get("child"), - "other_prefix::main_model_prefix::subnested_model") << - "Flattening logic for nested models failed for case C (check parser.cc)"; + "Flattening logic for nested models failed (check parser.cc)"; }