Skip to content

Commit

Permalink
Create tests for underscores in distro/family
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLocehiliosan committed Sep 13, 2022
1 parent 67c6844 commit 0f8538d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions test/test_unit_score_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,37 @@ def test_template_recording(runner, yadm, cmd_generated):
assert run.success
assert run.err == ''
assert run.out.rstrip() == expected


def test_underscores_in_distro_and_family(runner, yadm):
"""Test replacing spaces in distro / distro_family with underscores"""
local_distro = 'test distro'
local_distro_family = 'test family'
filenames = {
'filename##distro.test distro': 1004,
'filename##distro.test-distro': 0,
'filename##distro.test_distro': 1004,
'filename##distro_family.test family': 1008,
'filename##distro_family.test-family': 0,
'filename##distro_family.test_family': 1008,
}

script = f"""
YADM_TEST=1 source {yadm}
score=0
local_distro="{local_distro}"
local_distro_family="{local_distro_family}"
"""
expected = ''
for filename in filenames:
script += f"""
score_file "{filename}"
echo "{filename}"
echo "$score"
"""
expected += filename + '\n'
expected += str(filenames[filename]) + '\n'
run = runner(command=['bash'], inp=script)
assert run.success
assert run.err == ''
assert run.out == expected

0 comments on commit 0f8538d

Please sign in to comment.