Skip to content

Commit ed789e7

Browse files
committed
Add test for faulty version handling
1 parent 83e9aa9 commit ed789e7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/framework/ebconfigobj.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,23 @@ def test_squash_simple(self):
116116
res = cov.squash(version, tc['name'], tc['version'])
117117
self.assertEqual(res, {}) # very simple
118118

119+
# Ensure that a version of '0' with trailing '.0's is matched against '0.0' but not anything higher
120+
# This is for testing the DEFAULT_UNDEFINED_VERSION detection
121+
for num_zeroes in range(1, 6):
122+
tc = tc_first
123+
zero_version = '.'.join(['0'] * num_zeroes)
124+
txt = [
125+
'[SUPPORTED]',
126+
'versions = ' + zero_version,
127+
'toolchains = ' + tc_tmpl % tc,
128+
'[DEFAULT]',
129+
'y=a',
130+
]
131+
co = ConfigObj(txt)
132+
cov = EBConfigObj(co)
133+
self.assertEqual(cov.squash('0.0', tc['name'], tc['version']), {'y': 'a'})
134+
self.assertEqual(cov.squash('0.1', tc['name'], tc['version']), {})
135+
119136
def test_squash_invalid(self):
120137
"""Try to squash invalid files. Should trigger error"""
121138
tc_first = {'version': '10', 'name': self.tc_first}

0 commit comments

Comments
 (0)