Skip to content

Commit

Permalink
[conf] Add test for shell-like variable expansion
Browse files Browse the repository at this point in the history
Requires rpm-software-management/libdnf#1622

This is the same test case used by the DNF 5 implementation: rpm-software-management/dnf5#800
  • Loading branch information
evan-goode committed Sep 20, 2023
1 parent 2d2047e commit 5367f13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/conf/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ def test_substitute(self):
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')
Expand Down

0 comments on commit 5367f13

Please sign in to comment.