@@ -483,6 +483,8 @@ TEST_F(PrimaryClientTest, test_send_script_blocking_throw_on_malformed_scripts)
483483 " end" ;
484484 EXPECT_THROW (client_->sendScriptBlocking (script_bad_name), urcl::ScriptCodeSyntaxException);
485485 EXPECT_THROW (client_->sendScriptBlocking (" textmsg(\" testing\" )" , " 0_errors" ), urcl::ScriptCodeSyntaxException);
486+ const std::string comments_only = " #only\n #comments\n\n\n #and\n #whitespace" ;
487+ EXPECT_THROW (client_->sendScriptBlocking (comments_only), urcl::ScriptCodeSyntaxException);
486488}
487489
488490TEST_F (PrimaryClientTest, test_send_script_blocking_fail_on_runtime_exception)
@@ -527,12 +529,28 @@ TEST_F(PrimaryClientTest, test_send_script_blocking_ignore_warnings)
527529 EXPECT_NO_THROW (client_->commandPowerOff ());
528530 EXPECT_NO_THROW (client_->commandBrakeRelease ());
529531 // Impossible movement, will trigger an error and protective stop
530- EXPECT_TRUE (client_->sendScriptBlocking (" movel(p[10,0,0,0,0,0])" , " " , std::chrono::seconds ( 1 ), false ));
532+ EXPECT_TRUE (client_->sendScriptBlocking (" movel(p[10,0,0,0,0,0])" , " " , std::chrono::milliseconds ( 1000 ), false ));
531533 // reset the robot
532534 ASSERT_NO_THROW (client_->commandUnlockProtectiveStop ());
533535 EXPECT_TRUE (client_->sendScriptBlocking (" movej([0.5,-0.5,0.5,0,0,0])" ));
534536}
535537
538+ TEST_F (PrimaryClientTest, test_send_script_blocking_replace_long_names)
539+ {
540+ EXPECT_NO_THROW (client_->start ());
541+ EXPECT_NO_THROW (client_->commandPowerOff ());
542+ EXPECT_NO_THROW (client_->commandBrakeRelease ());
543+ const std::string name = " this_is_a_very_long_script_name_that_should_be_truncated" ;
544+ EXPECT_TRUE (client_->sendScriptBlocking (" textmsg(\" Still running\" )" , name));
545+ const std::string long_name_script = " def " + name +
546+ " ():\n "
547+ " textmsg(\" still running\" )\n "
548+ " sleep(0.1)\n "
549+ " sync()\n "
550+ " end" ;
551+ EXPECT_TRUE (client_->sendScriptBlocking (long_name_script));
552+ }
553+
536554int main (int argc, char * argv[])
537555{
538556 ::testing::InitGoogleTest (&argc, argv);
0 commit comments