summaryrefslogtreecommitdiff
path: root/tests/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-05-07 09:10:31 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-05-07 09:10:31 (GMT)
commit9e4480706b28abc41618bd598c00a194beb14c4f (patch)
tree15fc4fc623407863f0ecdec5ca97a4cac63f8ad2 /tests/plugins
parent25bac01127581767639a5bd9024c41eb803388fa (diff)
Aggregate YAML values from sequences when requested and possible.
Diffstat (limited to 'tests/plugins')
-rw-r--r--tests/plugins/yaml.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/plugins/yaml.py b/tests/plugins/yaml.py
index 2fbb0bd..4d2680c 100644
--- a/tests/plugins/yaml.py
+++ b/tests/plugins/yaml.py
@@ -146,3 +146,30 @@ root:
found = root.find_first_by_path('/root/d')
self.assertEqual(found.value, "'xx::xx'")
+
+
+ def testArrayAsSeq(self):
+ """Handle array as YAML block sequence."""
+
+ definitions = '''
+root:
+ a: [ a, 'b', 0xcc, "\td\n\\"'" ]
+'''
+
+ root = yaml.parse_from_text(definitions)
+
+ found = root.find_first_by_path('/root/a')
+
+ self.assertIsNone(found.value)
+
+ self.assertEqual(len(found.children.nodes), 4)
+
+ self.assertEqual(found.children.nodes[0].key, 'a')
+
+ self.assertEqual(found.children.nodes[1].key, 'b')
+
+ self.assertEqual(found.children.nodes[2].key, '0xcc')
+
+ self.assertEqual(found.children.nodes[3].key, "\td \"'")
+
+ self.assertEqual(found.aggregate_value(), '[ a, \'b\', 0xcc, " d \"\'" ]')