Skip to content

Commit 20d7520

Browse files
committed
Add comments to all regex test files
1 parent 07b0ca8 commit 20d7520

15 files changed

Lines changed: 34 additions & 10 deletions

tests/test_transcript.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ def test_invalid_syntax(_cmdline_app, capsys):
274274
('multiline_regex.txt', False),
275275
('regex_set.txt', False),
276276
('singleslash.txt', False),
277-
('slashdot.txt', False),
278277
('slashes_escaped.txt', False),
279278
('slashslash.txt', False),
280279
('spaces.txt', False),

tests/transcripts/bol_eol.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# match the text with regular expressions and the newlines as literal text
2+
13
(Cmd) say -r 3 -s yabba dabba do
24
/^Y.*?$/
35
/^Y.*?$/
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1+
# match using character classes and special sequence for digits (\d)
2+
13
(Cmd) say 555-1212
24
/[0-9]{3}-[0-9]{4}/
5+
(Cmd) say 555-1212
6+
/\d{3}-\d{4}/

tests/transcripts/dotstar.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# ensure the old standby .* works. We use the non-greedy flavor
2+
13
(Cmd) say Adopt the pace of nature: her secret is patience.
2-
Adopt the pace of /.*/ is patience.
4+
Adopt the pace of /.*?/ is patience.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# inception: a regular expression that matches itself
2+
13
(Cmd) say (?:fred)
24
/(?:\(\?:fred\))/

tests/transcripts/from_cmdloop.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
# responses with trailing spaces have been matched with a regex
2+
# so you can see where they are.
3+
14
(Cmd) help
25

36
Documented commands (type help <topic>):
47
========================================
58
_relative_load help mumble pyscript save shell speak
69
cmdenvironment history orate quit say shortcuts
7-
edit load py run set show
10+
edit load py run set show/ */
811

912
(Cmd) help say
1013
Repeats what you tell me to.

tests/transcripts/multiline_no_regex.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# cmd2 will skip any lines
2-
# which occur before a valid
3-
# command prompt
1+
# test a multi-line command
42

53
(Cmd) orate This is a test
64
> of the

tests/transcripts/multiline_regex.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# these regular expressions match multiple lines of text
2+
13
(Cmd) say -r 3 -s yabba dabba do
24
/\A(YA.*?DO\n?){3}/
35
(Cmd) say -r 5 -s yabba dabba do

tests/transcripts/regex_set.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Run this transcript with "python example.py -t transcript_regex.txt"
22
# The regex for colors is because no color on Windows.
33
# The regex for editor will match whatever program you use.
4-
# regexes on prompts just make the trailing space obvious
4+
# Regexes on prompts just make the trailing space obvious
5+
56
(Cmd) set
67
abbrev: True
78
autorun_on_edit: False

tests/transcripts/singleslash.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
# even if you only have a single slash, you have
2+
# to escape it
3+
14
(Cmd) say use 2/3 cup of sugar
25
use 2\/3 cup of sugar

0 commit comments

Comments
 (0)