32 lines
1.3 KiB
Diff
32 lines
1.3 KiB
Diff
From 2478a55ac8af31f426f2d6bb5adf8fd2b3ac5eff Mon Sep 17 00:00:00 2001
|
|
From: Evan Goode <mail@evangoo.de>
|
|
Date: Wed, 20 Sep 2023 20:36:49 +0000
|
|
Subject: [PATCH 01/11] [conf] Add test for shell-like variable expansion
|
|
|
|
Requires https://github.com/rpm-software-management/libdnf/pull/1622
|
|
|
|
This is the same test case used by the DNF 5 implementation: https://github.com/rpm-software-management/dnf5/pull/800
|
|
---
|
|
tests/conf/test_parser.py | 5 +++++
|
|
1 file changed, 5 insertions(+)
|
|
|
|
diff --git a/tests/conf/test_parser.py b/tests/conf/test_parser.py
|
|
index a9e50460f..ad0d61e31 100644
|
|
--- a/tests/conf/test_parser.py
|
|
+++ b/tests/conf/test_parser.py
|
|
@@ -54,6 +54,11 @@ class ParserTest(tests.support.TestCase):
|
|
result = '$Substitute some fact}withoutspace.'
|
|
self.assertEqual(substitute(rawstr, substs), result)
|
|
|
|
+ # Test ${variable:-word} and ${variable:+word} shell-like expansion
|
|
+ rawstr = '${lies:+alternate}-${unset:-default}-${nn:+n${nn:-${nnn:}'
|
|
+ result = 'alternate-default-${nn:+n${nn:-${nnn:}'
|
|
+ self.assertEqual(substitute(rawstr, substs), result)
|
|
+
|
|
def test_empty_option(self):
|
|
# Parser is able to read config file with option without value
|
|
FN = tests.support.resource_path('etc/empty_option.conf')
|
|
--
|
|
2.49.0
|
|
|