From 9699118e345e5507b4f64878781301bdf76fbe43 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 14 May 2024 15:29:08 +0200 Subject: [PATCH] Add tests for (un)escaping when resolving templates --- test/framework/easyconfig.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/framework/easyconfig.py b/test/framework/easyconfig.py index 9801e467dd..be780a811b 100644 --- a/test/framework/easyconfig.py +++ b/test/framework/easyconfig.py @@ -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('')