Namespace plugin instances when attaching.

Fixes #2112.

PiperOrigin-RevId: 681045462
Change-Id: I2c945c5405fcb91e0f9a1b0b1e94f68d174c84ee
This commit is contained in:
Alessio Quaglino
2024-10-01 09:13:43 -07:00
committed by Copybara-Service
parent 89aea5e217
commit dfe8e45101
5 changed files with 36 additions and 3 deletions
+9 -3
View File
@@ -243,10 +243,16 @@ TEST_F(PluginTest, AttachPlugin) {
EXPECT_THAT(attachment_frame, NotNull());
mjs_attachBody(attachment_frame, mjs_findBody(spec_2, "body"), "child-", "");
mjModel* model = mj_compile(spec_1, nullptr);
EXPECT_THAT(model, NotNull());
mjModel* model_1 = mj_compile(spec_1, nullptr);
EXPECT_THAT(model_1, NotNull());
mj_deleteModel(model);
// attach it a second time to test namespacing
mjs_attachBody(attachment_frame, mjs_findBody(spec_2, "body"), "copy-", "");
mjModel* model_2 = mj_compile(spec_1, nullptr);
EXPECT_THAT(model_2, NotNull());
mj_deleteModel(model_1);
mj_deleteModel(model_2);
mj_deleteSpec(spec_1);
mj_deleteSpec(spec_2);
}