summaryrefslogtreecommitdiffstats
path: root/tests/snippets/console
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 11:33:32 +0000
commit1f403ad2197fc7442409f434ee574f3e6b46fb73 (patch)
tree0299c6dd11d5edfa918a29b6456bc1875f1d288c /tests/snippets/console
parentInitial commit. (diff)
downloadpygments-upstream.tar.xz
pygments-upstream.zip
Adding upstream version 2.14.0+dfsg.upstream/2.14.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/snippets/console/fake_ps2_prompt.txt14
-rw-r--r--tests/snippets/console/prompt_in_output.txt21
-rw-r--r--tests/snippets/console/ps2_prompt.txt15
-rw-r--r--tests/snippets/console/test_comment_after_prompt.txt6
-rw-r--r--tests/snippets/console/test_newline_in_echo_no_ps2.txt16
-rw-r--r--tests/snippets/console/test_newline_in_echo_ps2.txt16
-rw-r--r--tests/snippets/console/test_newline_in_ls_no_ps2.txt16
-rw-r--r--tests/snippets/console/test_newline_in_ls_ps2.txt16
-rw-r--r--tests/snippets/console/test_virtualenv.txt11
9 files changed, 131 insertions, 0 deletions
diff --git a/tests/snippets/console/fake_ps2_prompt.txt b/tests/snippets/console/fake_ps2_prompt.txt
new file mode 100644
index 0000000..683b36d
--- /dev/null
+++ b/tests/snippets/console/fake_ps2_prompt.txt
@@ -0,0 +1,14 @@
+# Test that missing backslash means it's no prompt.
+
+---input---
+$ echo "> not a prompt"
+> not a prompt
+
+---tokens---
+'$ ' Generic.Prompt
+'echo' Name.Builtin
+' ' Text.Whitespace
+'"> not a prompt"' Literal.String.Double
+'\n' Text.Whitespace
+
+'> not a prompt\n' Generic.Output
diff --git a/tests/snippets/console/prompt_in_output.txt b/tests/snippets/console/prompt_in_output.txt
new file mode 100644
index 0000000..993bc75
--- /dev/null
+++ b/tests/snippets/console/prompt_in_output.txt
@@ -0,0 +1,21 @@
+# Test that output that looks like a prompt is not detected as such.
+
+---input---
+$ cat \
+> test.txt
+line1
+> file content, not prompt!
+
+---tokens---
+'$ ' Generic.Prompt
+'cat' Text
+' ' Text.Whitespace
+'\\\n' Literal.String.Escape
+
+'> ' Generic.Prompt
+'test.txt' Text
+'\n' Text.Whitespace
+
+'line1\n' Generic.Output
+
+'> file content, not prompt!\n' Generic.Output
diff --git a/tests/snippets/console/ps2_prompt.txt b/tests/snippets/console/ps2_prompt.txt
new file mode 100644
index 0000000..175a473
--- /dev/null
+++ b/tests/snippets/console/ps2_prompt.txt
@@ -0,0 +1,15 @@
+---input---
+$ ls\
+> /does/not/exist
+ls: cannot access ...
+
+---tokens---
+'$ ' Generic.Prompt
+'ls' Text
+'\\\n' Literal.String.Escape
+
+'> ' Generic.Prompt
+'/does/not/exist' Text
+'\n' Text.Whitespace
+
+'ls: cannot access ...\n' Generic.Output
diff --git a/tests/snippets/console/test_comment_after_prompt.txt b/tests/snippets/console/test_comment_after_prompt.txt
new file mode 100644
index 0000000..f115715
--- /dev/null
+++ b/tests/snippets/console/test_comment_after_prompt.txt
@@ -0,0 +1,6 @@
+---input---
+$# comment
+
+---tokens---
+'$' Generic.Prompt
+'# comment\n' Comment.Single
diff --git a/tests/snippets/console/test_newline_in_echo_no_ps2.txt b/tests/snippets/console/test_newline_in_echo_no_ps2.txt
new file mode 100644
index 0000000..57a1190
--- /dev/null
+++ b/tests/snippets/console/test_newline_in_echo_no_ps2.txt
@@ -0,0 +1,16 @@
+---input---
+$ echo \
+ hi
+hi
+
+---tokens---
+'$ ' Generic.Prompt
+'echo' Name.Builtin
+' ' Text.Whitespace
+'\\\n' Literal.String.Escape
+
+' ' Text.Whitespace
+'hi' Text
+'\n' Text.Whitespace
+
+'hi\n' Generic.Output
diff --git a/tests/snippets/console/test_newline_in_echo_ps2.txt b/tests/snippets/console/test_newline_in_echo_ps2.txt
new file mode 100644
index 0000000..b90eead
--- /dev/null
+++ b/tests/snippets/console/test_newline_in_echo_ps2.txt
@@ -0,0 +1,16 @@
+---input---
+$ echo \
+> hi
+hi
+
+---tokens---
+'$ ' Generic.Prompt
+'echo' Name.Builtin
+' ' Text.Whitespace
+'\\\n' Literal.String.Escape
+
+'> ' Generic.Prompt
+'hi' Text
+'\n' Text.Whitespace
+
+'hi\n' Generic.Output
diff --git a/tests/snippets/console/test_newline_in_ls_no_ps2.txt b/tests/snippets/console/test_newline_in_ls_no_ps2.txt
new file mode 100644
index 0000000..3366bc0
--- /dev/null
+++ b/tests/snippets/console/test_newline_in_ls_no_ps2.txt
@@ -0,0 +1,16 @@
+---input---
+$ ls \
+ hi
+hi
+
+---tokens---
+'$ ' Generic.Prompt
+'ls' Text
+' ' Text.Whitespace
+'\\\n' Literal.String.Escape
+
+' ' Text.Whitespace
+'hi' Text
+'\n' Text.Whitespace
+
+'hi\n' Generic.Output
diff --git a/tests/snippets/console/test_newline_in_ls_ps2.txt b/tests/snippets/console/test_newline_in_ls_ps2.txt
new file mode 100644
index 0000000..bf1bae5
--- /dev/null
+++ b/tests/snippets/console/test_newline_in_ls_ps2.txt
@@ -0,0 +1,16 @@
+---input---
+$ ls \
+> hi
+hi
+
+---tokens---
+'$ ' Generic.Prompt
+'ls' Text
+' ' Text.Whitespace
+'\\\n' Literal.String.Escape
+
+'> ' Generic.Prompt
+'hi' Text
+'\n' Text.Whitespace
+
+'hi\n' Generic.Output
diff --git a/tests/snippets/console/test_virtualenv.txt b/tests/snippets/console/test_virtualenv.txt
new file mode 100644
index 0000000..420b07a
--- /dev/null
+++ b/tests/snippets/console/test_virtualenv.txt
@@ -0,0 +1,11 @@
+---input---
+(env) [~/project]$ foo -h
+
+---tokens---
+'(env)' Generic.Prompt.VirtualEnv
+' ' Text
+'[~/project]$ ' Generic.Prompt
+'foo' Text
+' ' Text.Whitespace
+'-h' Text
+'\n' Text.Whitespace