Support bool and float constants in msg files
This commit is contained in:
+8
-1
@@ -17,7 +17,9 @@ from rosbags.typesys.types import FIELDDEFS
|
||||
MSG = """
|
||||
# comment
|
||||
|
||||
bool b=true
|
||||
int32 global=42
|
||||
float32 f=1.33
|
||||
string str= foo bar\t
|
||||
|
||||
std_msgs/Header header
|
||||
@@ -195,7 +197,12 @@ def test_parse_msg() -> None:
|
||||
ret = get_types_from_msg(MSG, 'test_msgs/msg/Foo')
|
||||
assert 'test_msgs/msg/Foo' in ret
|
||||
consts, fields = ret['test_msgs/msg/Foo']
|
||||
assert consts == [('global', 'int32', 42), ('str', 'string', 'foo bar')]
|
||||
assert consts == [
|
||||
('b', 'bool', True),
|
||||
('global', 'int32', 42),
|
||||
('f', 'float32', 1.33),
|
||||
('str', 'string', 'foo bar'),
|
||||
]
|
||||
assert fields[0][0] == 'header'
|
||||
assert fields[0][1][1] == 'std_msgs/msg/Header'
|
||||
assert fields[1][0] == 'bool'
|
||||
|
||||
Reference in New Issue
Block a user