Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wren committed Jul 2, 2020
1 parent 698f069 commit 27207b4
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions tests/test_parse_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

import pytest
import shlex
import sys


def cli_as_dict(str):
cli = shlex.split(str, posix="win32" not in sys.platform)
cli = shlex.split(str)
args = parse_args(cli)
return vars(args)

Expand Down Expand Up @@ -50,6 +49,7 @@ def test_contains_alone():

def test_debug_alone():
assert cli_as_dict("--debug") == expected_args(debug=True)
assert cli_as_dict("-d") == expected_args(debug=True)


def test_delete_alone():
Expand Down Expand Up @@ -162,3 +162,23 @@ def test_text_alone():

def test_version_alone():
assert cli_as_dict("--version") == expected_args(version=True)


# @see https://github.com/jrnl-org/jrnl/issues/520
@pytest.mark.xfail
def test_and_ordering():
result = expected_args(strict=True, text=["second", "@oldtag", "@newtag"])
assert result == cli_as_dict("-and second @oldtag @newtag")
assert result == cli_as_dict("second @oldtag @newtag -and")
assert result == cli_as_dict("second -and @oldtag @newtag")
assert result == cli_as_dict("second @oldtag -and @newtag")


# @see https://github.com/jrnl-org/jrnl/issues/520
@pytest.mark.xfail
def test_edit_ordering():
result = expected_args(edit=True, text=["second", "@oldtag", "@newtag"])
assert result == cli_as_dict("--edit second @oldtag @newtag")
assert result == cli_as_dict("second @oldtag @newtag --edit")
assert result == cli_as_dict("second --edit @oldtag @newtag")
assert result == cli_as_dict("second @oldtag --edit @newtag")

0 comments on commit 27207b4

Please sign in to comment.