mirror of
https://github.com/chubin/cheat.sh
synced 2024-11-10 05:24:13 +00:00
Add test for section splitting (for #312)
This commit is contained in:
parent
cbf001cede
commit
3d1e4ec2f9
3 changed files with 29 additions and 1 deletions
4
.github/workflows/tests-ubuntu.yml
vendored
4
.github/workflows/tests-ubuntu.yml
vendored
|
@ -17,8 +17,10 @@ jobs:
|
|||
run: pip install --upgrade -r requirements.txt
|
||||
- name: fetch upstream cheat sheets
|
||||
run: python lib/fetch.py fetch-all
|
||||
- name: run tests
|
||||
- name: run bash tests
|
||||
run: bash tests/run-tests.sh
|
||||
- name: run pytest
|
||||
run: pytest lib/
|
||||
|
||||
docker:
|
||||
runs-on: ubuntu-20.04
|
||||
|
|
25
lib/cheat_wrapper_test.py
Normal file
25
lib/cheat_wrapper_test.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from cheat_wrapper import _add_section_name
|
||||
|
||||
unchanged = """
|
||||
python/:list
|
||||
ls
|
||||
btrfs~volume
|
||||
:intro
|
||||
:cht.sh
|
||||
python/copy+file
|
||||
python/rosetta/:list
|
||||
emacs:go-mode/:list
|
||||
"""
|
||||
|
||||
split = """
|
||||
python copy file
|
||||
python/copy file
|
||||
"""
|
||||
|
||||
def test_header_split():
|
||||
for inp in unchanged.strip().splitlines():
|
||||
assert inp == _add_section_name(inp)
|
||||
|
||||
for test in split.strip().split('\n\n'):
|
||||
inp, outp = test.split('\n')
|
||||
assert outp == _add_section_name(inp)
|
|
@ -15,3 +15,4 @@ pycld2
|
|||
colorama
|
||||
pyyaml
|
||||
python-Levenshtein
|
||||
pytest
|
||||
|
|
Loading…
Reference in a new issue