Skip to content

Commit

Permalink
Add empty attributes to cause test failure
Browse files Browse the repository at this point in the history
This demonstrates the bug reported in #725.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Apr 30, 2024
1 parent 6f1c365 commit 0637c21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/integration/custom_elems_attrs.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<mysim:description>Description of this world</mysim:description>
<model name="M1">
<link name="L1" mysim:custom_attr_str="A" mysim:custom_attr_int="5" />
<link name="L2" />
<link name="L2" mysim:empty_attr="" />
<joint name="J1" type="revolute">
<parent>L1</parent>
<child>L2</child>
Expand Down
4 changes: 3 additions & 1 deletion test/integration/plugin_attribute.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ std::string get_sdf_string()
<< "<model name='model'>"
<< " <link name='link'/>"
<< " <plugin name='example' filename='libexample.so'>"
<< " <user attribute='attribute' />"
<< " <user attribute='attribute' empty_attribute='' />"
<< " <value attribute='attribute'>value</value>"
<< " </plugin>"
<< "</model>"
Expand All @@ -54,6 +54,8 @@ TEST(PluginAttribute, ParseAttributes)
EXPECT_TRUE(user->HasAttribute("attribute"));
EXPECT_EQ(user->GetAttribute("attribute")->GetAsString(),
std::string("attribute"));
EXPECT_TRUE(user->HasAttribute("empty_attribute"));
EXPECT_EQ(user->GetAttribute("empty_attribute")->GetAsString(), "");
}
{
sdf::ElementPtr value = plugin->GetElement("value");
Expand Down

0 comments on commit 0637c21

Please sign in to comment.