Skip to content

Commit

Permalink
Add tests for (un)escaping when resolving templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed May 14, 2024
1 parent e501e39 commit 9699118
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3654,6 +3654,23 @@ def test_resolve_template(self):
# '%(name)' is not a correct template spec (missing trailing 's')
self.assertEqual(resolve_template('%(name)', tmpl_dict), '%(name)')

# Correct (un)escaping
values = (
('10%', '10%'),
('%of', '%of'),
('10%of', '10%of'),
('%s', '%s'),
('%%(name)s', '%(name)s'),
('%%%(name)s', '%FooBar'),
('%%%%(name)s', '%%(name)s'),
)
for value, expected in values:
self.assertEqual(resolve_template(value, tmpl_dict), expected)
# Templates are resolved
value += ' %(name)s'
expected += ' FooBar'
self.assertEqual(resolve_template(value, tmpl_dict), expected)

def test_det_subtoolchain_version(self):
"""Test det_subtoolchain_version function"""
_, all_tc_classes = search_toolchain('')
Expand Down

0 comments on commit 9699118

Please sign in to comment.