From e59b5d6584d580830a3ac3fe7c33e358b76faf62 Mon Sep 17 00:00:00 2001 From: Guilherme Affonso Date: Tue, 2 Apr 2019 16:40:18 +0900 Subject: [PATCH] Add test for #609 --- roseus/msg/TestName.msg | 1 + roseus/test/test-name-pub.l | 19 +++++++++++++------ roseus/test/test-name-sub.l | 5 ++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/roseus/msg/TestName.msg b/roseus/msg/TestName.msg index dce4ea5d0..5f66d96d4 100644 --- a/roseus/msg/TestName.msg +++ b/roseus/msg/TestName.msg @@ -1 +1,2 @@ roseus/StringStamped name +roseus/String string diff --git a/roseus/test/test-name-pub.l b/roseus/test/test-name-pub.l index c0367dbb4..4ef4a6925 100755 --- a/roseus/test/test-name-pub.l +++ b/roseus/test/test-name-pub.l @@ -6,11 +6,18 @@ (ros::advertise "test_name" roseus::TestName) (ros::rate 1) (setq i 0) + +;; Test for name clashing in ROS messages +;; `name' tests for name clashing in slot names +;; `string' tests for name clashing in message names + (while (ros::ok) - (setq ss (instance roseus::StringStamped :init :data (format nil "test ~A" (incf i)))) - (setq msg (instance roseus::TestName :init :name ss)) - (ros::ros-info "pub ~A" msg) - (ros::publish "test_name" msg) - (ros::sleep) - (ros::spin-once)) + (let* ((str (format nil "test ~A" (incf i))) + (s (instance roseus::String :init :data str)) + (ss (instance roseus::StringStamped :init :data str)) + (msg (instance roseus::TestName :init :name ss :string s))) + (ros::ros-info "pub ~A" msg) + (ros::publish "test_name" msg) + (ros::sleep) + (ros::spin-once))) diff --git a/roseus/test/test-name-sub.l b/roseus/test/test-name-sub.l index b7d300a22..c512bb13d 100755 --- a/roseus/test/test-name-sub.l +++ b/roseus/test/test-name-sub.l @@ -1,6 +1,9 @@ #!/usr/bin/env roseus -(ros::load-ros-manifest "roseus") +;; It is important to load `TestName.l' before `String.l' to test for name clashing +;; between roseus::String and lisp::string +(flet ((directory (dir) (list "TestName.l" "StringStamped.l" "String.l"))) + (ros::roseus-add-files "roseus" "msg")) (ros::roseus "test_name_sub") (ros::subscribe "test_name" roseus::TestName #'(lambda (msg) (ros::ros-info "sub ~A" msg)))