summaryrefslogtreecommitdiff
path: root/tests/test_shell.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_shell.py')
-rw-r--r--tests/test_shell.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/test_shell.py b/tests/test_shell.py
index 64918a2e..753a37e3 100644
--- a/tests/test_shell.py
+++ b/tests/test_shell.py
@@ -10,7 +10,7 @@
import pytest
from pygments.token import Token
-from pygments.lexers import BashLexer, BashSessionLexer, MSDOSSessionLexer
+from pygments.lexers import BashLexer, BashSessionLexer, MSDOSSessionLexer, PowerShellSessionLexer
@pytest.fixture(scope='module')
@@ -28,6 +28,11 @@ def lexer_msdos():
yield MSDOSSessionLexer()
+@pytest.fixture(scope='module')
+def lexer_powershell_session():
+ yield PowerShellSessionLexer()
+
+
def test_curly_no_escape_and_quotes(lexer_bash):
fragment = u'echo "${a//["b"]/}"\n'
tokens = [
@@ -163,6 +168,29 @@ def test_msdos_gt_only(lexer_msdos):
]
assert list(lexer_msdos.get_tokens(fragment)) == tokens
+
+def test_powershell_session(lexer_powershell_session):
+ fragment = u'PS C:\\> Get-ChildItem\n'
+ tokens = [
+ (Token.Name.Builtin, u''),
+ (Token.Generic.Prompt, u'PS C:\\> '),
+ (Token.Name.Builtin, u'Get-ChildItem'),
+ (Token.Text, u'\n')
+ ]
+ assert list(lexer_powershell_session.get_tokens(fragment)) == tokens
+
+
+def test_powershell_remoting_session(lexer_powershell_session):
+ fragment = u'[Long-NetBIOS-Hostname]: PS C:\\> Get-ChildItem\n'
+ tokens = [
+ (Token.Name.Builtin, u''),
+ (Token.Generic.Prompt, u'[Long-NetBIOS-Hostname]: PS C:\\> '),
+ (Token.Name.Builtin, u'Get-ChildItem'),
+ (Token.Text, u'\n')
+ ]
+ assert list(lexer_powershell_session.get_tokens(fragment)) == tokens
+
+
def test_virtualenv(lexer_session):
fragment = u'(env) [~/project]$ foo -h\n'
tokens = [