Skip to content

Commit

Permalink
add tests and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Granitosaurus committed Sep 27, 2020
1 parent 9617cb9 commit 165d87d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion convcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def xcompose(files, keep_comments):
except ValueError:
echo(f'malformed line:\n{row}', err=True)
continue
from_ = re.split('\s+', from_)
from_ = re.split(r'\s+', from_)
try:
from_ = ''.join(remap_keys(from_))
except ValueError as e:
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "gen-compose"
version = "1.0.1"
version = "1.1.0"
description = "Key generator for macos keybinding system"
authors = ["Granitosaurus <[email protected]>"]
license = "GPL-3.0-or-later"
Expand All @@ -25,6 +25,7 @@ click = "^7.1.2"
pyyaml = "^5.3.1"

[tool.poetry.dev-dependencies]
pytest = "^6.1.0"

[tool.poetry.scripts]
gen-compose = "gencompose:main"
Expand Down
Empty file added tests/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions tests/test.compose
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# some leading comments
# that should be ignored
<Multi_key> <period> <period> : "…" U2026 # HORIZONTAL ELLIPSIS

# spaces and line breaking comments should be ignored too
15 changes: 15 additions & 0 deletions tests/test_convcompose.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path

from click.testing import CliRunner
from convcompose import main


def test_xcompose_convert():
runner = CliRunner()
file = Path(__file__).parent / 'test.compose'
result = runner.invoke(main, args=['xcompose', str(file)])
assert result.exit_code == 0
assert result.output == '"..": "…"\n'
result = runner.invoke(main, args=['xcompose', str(file), '--keep-comments'])
assert result.exit_code == 0
assert result.output == '"..": "…" # HORIZONTAL ELLIPSIS\n'

0 comments on commit 165d87d

Please sign in to comment.