value = GetStringList(node, propname)
else:
value = []
- lists = [v.split() for v in value]
- args = [x for l in lists for x in l]
+ if not value:
+ args = []
+ elif len(value) == 1:
+ args = value[0].split()
+ else:
+ args = value
return args
def GetBool(node, propname, default=False):
orig-node {
orig = <1 23 4>;
args = "-n first", "second", "-p", "123,456", "-x";
+ args2 = "a space", "there";
+ args3 = "-n first second -p 123,456 -x";
};
};
['multi-word', 'message'],
fdt_util.GetArgs(self.node, 'stringarray'))
self.assertEqual([], fdt_util.GetArgs(self.node, 'boolval'))
- self.assertEqual(['-n', 'first', 'second', '-p', '123,456', '-x'],
+ self.assertEqual(['-n first', 'second', '-p', '123,456', '-x'],
fdt_util.GetArgs(node, 'args'))
+ self.assertEqual(['a space', 'there'],
+ fdt_util.GetArgs(node, 'args2'))
+ self.assertEqual(['-n', 'first', 'second', '-p', '123,456', '-x'],
+ fdt_util.GetArgs(node, 'args3'))
with self.assertRaises(ValueError) as exc:
fdt_util.GetArgs(self.node, 'missing')
self.assertIn(