Skip to content

Commit

Permalink
add tests to illustrate problem discussed in PR #1645
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasertl committed Dec 26, 2020
1 parent 270ab31 commit 456ac59
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,31 @@ def test_newline_in_echo(lexer_session):
assert list(lexer_session.get_tokens(fragment)) == tokens


def test_newline_in_ls(lexer_session):
fragment = '$ ls \\\nhi\nhi\n'
tokens = [
(Token.Text, ''),
(Token.Generic.Prompt, '$ '),
(Token.Text, 'ls'),
(Token.Text, ' '),
(Token.Literal.String.Escape, '\\\n'),
(Token.Text, 'hi'),
(Token.Text, '\n'),
(Token.Generic.Output, 'hi\n'),
]
assert list(lexer_session.get_tokens(fragment)) == tokens


def test_comment_after_prompt(lexer_session):
fragment = '$# comment'
tokens = [
(Token.Comment.Single, ''),
(Token.Generic.Prompt, '$'),
(Token.Comment.Single, '# comment\n'),
]
assert list(lexer_session.get_tokens(fragment)) == tokens


def test_msdos_gt_only(lexer_msdos):
fragment = '> py\nhi\n'
tokens = [
Expand Down

0 comments on commit 456ac59

Please sign in to comment.