diff options
author | Jared Crapo <jared@kotfu.net> | 2017-08-22 10:18:06 -0600 |
---|---|---|
committer | Jared Crapo <jared@kotfu.net> | 2017-08-22 10:45:44 -0600 |
commit | 20d752047185214806694bc7a045a8af8e5a240f (patch) | |
tree | 21100d624aa1132b3f4f1b663293b74eb0ae94e6 /tests/transcripts | |
parent | 07b0ca8fc36ca66ad2a2a5887f08064b9e6cb812 (diff) | |
download | cmd2-git-20d752047185214806694bc7a045a8af8e5a240f.tar.gz |
Add comments to all regex test files
Diffstat (limited to 'tests/transcripts')
-rw-r--r-- | tests/transcripts/bol_eol.txt | 2 | ||||
-rw-r--r-- | tests/transcripts/characterclass.txt | 4 | ||||
-rw-r--r-- | tests/transcripts/dotstar.txt | 4 | ||||
-rw-r--r-- | tests/transcripts/extension_notation.txt | 2 | ||||
-rw-r--r-- | tests/transcripts/from_cmdloop.txt | 5 | ||||
-rw-r--r-- | tests/transcripts/multiline_no_regex.txt | 4 | ||||
-rw-r--r-- | tests/transcripts/multiline_regex.txt | 2 | ||||
-rw-r--r-- | tests/transcripts/regex_set.txt | 3 | ||||
-rw-r--r-- | tests/transcripts/singleslash.txt | 3 | ||||
-rw-r--r-- | tests/transcripts/slashdot.txt | 2 | ||||
-rw-r--r-- | tests/transcripts/slashes_escaped.txt | 4 | ||||
-rw-r--r-- | tests/transcripts/slashslash.txt | 2 | ||||
-rw-r--r-- | tests/transcripts/spaces.txt | 4 | ||||
-rw-r--r-- | tests/transcripts/word_boundaries.txt | 2 |
14 files changed, 34 insertions, 9 deletions
diff --git a/tests/transcripts/bol_eol.txt b/tests/transcripts/bol_eol.txt index c80ee54e..da21ac86 100644 --- a/tests/transcripts/bol_eol.txt +++ b/tests/transcripts/bol_eol.txt @@ -1,3 +1,5 @@ +# match the text with regular expressions and the newlines as literal text + (Cmd) say -r 3 -s yabba dabba do /^Y.*?$/ /^Y.*?$/ diff --git a/tests/transcripts/characterclass.txt b/tests/transcripts/characterclass.txt index 89903f3a..756044ea 100644 --- a/tests/transcripts/characterclass.txt +++ b/tests/transcripts/characterclass.txt @@ -1,2 +1,6 @@ +# match using character classes and special sequence for digits (\d) + (Cmd) say 555-1212 /[0-9]{3}-[0-9]{4}/ +(Cmd) say 555-1212 +/\d{3}-\d{4}/ diff --git a/tests/transcripts/dotstar.txt b/tests/transcripts/dotstar.txt index a0e3f181..55c15b75 100644 --- a/tests/transcripts/dotstar.txt +++ b/tests/transcripts/dotstar.txt @@ -1,2 +1,4 @@ +# ensure the old standby .* works. We use the non-greedy flavor + (Cmd) say Adopt the pace of nature: her secret is patience. -Adopt the pace of /.*/ is patience. +Adopt the pace of /.*?/ is patience. diff --git a/tests/transcripts/extension_notation.txt b/tests/transcripts/extension_notation.txt index 3b538790..68e728ca 100644 --- a/tests/transcripts/extension_notation.txt +++ b/tests/transcripts/extension_notation.txt @@ -1,2 +1,4 @@ +# inception: a regular expression that matches itself + (Cmd) say (?:fred) /(?:\(\?:fred\))/ diff --git a/tests/transcripts/from_cmdloop.txt b/tests/transcripts/from_cmdloop.txt index 649c8c4b..5a12ca03 100644 --- a/tests/transcripts/from_cmdloop.txt +++ b/tests/transcripts/from_cmdloop.txt @@ -1,10 +1,13 @@ +# responses with trailing spaces have been matched with a regex +# so you can see where they are. + (Cmd) help Documented commands (type help <topic>): ======================================== _relative_load help mumble pyscript save shell speak cmdenvironment history orate quit say shortcuts -edit load py run set show +edit load py run set show/ */ (Cmd) help say Repeats what you tell me to. diff --git a/tests/transcripts/multiline_no_regex.txt b/tests/transcripts/multiline_no_regex.txt index 72ad453b..490870cf 100644 --- a/tests/transcripts/multiline_no_regex.txt +++ b/tests/transcripts/multiline_no_regex.txt @@ -1,6 +1,4 @@ -# cmd2 will skip any lines -# which occur before a valid -# command prompt +# test a multi-line command (Cmd) orate This is a test > of the diff --git a/tests/transcripts/multiline_regex.txt b/tests/transcripts/multiline_regex.txt index e2a36762..3487335f 100644 --- a/tests/transcripts/multiline_regex.txt +++ b/tests/transcripts/multiline_regex.txt @@ -1,3 +1,5 @@ +# these regular expressions match multiple lines of text + (Cmd) say -r 3 -s yabba dabba do /\A(YA.*?DO\n?){3}/ (Cmd) say -r 5 -s yabba dabba do diff --git a/tests/transcripts/regex_set.txt b/tests/transcripts/regex_set.txt index da515f31..3a4a234d 100644 --- a/tests/transcripts/regex_set.txt +++ b/tests/transcripts/regex_set.txt @@ -1,7 +1,8 @@ # Run this transcript with "python example.py -t transcript_regex.txt" # The regex for colors is because no color on Windows. # The regex for editor will match whatever program you use. -# regexes on prompts just make the trailing space obvious +# Regexes on prompts just make the trailing space obvious + (Cmd) set abbrev: True autorun_on_edit: False diff --git a/tests/transcripts/singleslash.txt b/tests/transcripts/singleslash.txt index dfa06bc1..f3b291f9 100644 --- a/tests/transcripts/singleslash.txt +++ b/tests/transcripts/singleslash.txt @@ -1,2 +1,5 @@ +# even if you only have a single slash, you have +# to escape it + (Cmd) say use 2/3 cup of sugar use 2\/3 cup of sugar diff --git a/tests/transcripts/slashdot.txt b/tests/transcripts/slashdot.txt deleted file mode 100644 index 0c1ec747..00000000 --- a/tests/transcripts/slashdot.txt +++ /dev/null @@ -1,2 +0,0 @@ -(Cmd) say mix 2/3 c. sugar, 1/2 c. butter, and 1/2 tsp. salt -mix 2\/3 c. sugar, 1\/2 c. butter, and 1\/2 tsp. salt diff --git a/tests/transcripts/slashes_escaped.txt b/tests/transcripts/slashes_escaped.txt index f21556fe..09bbe3bb 100644 --- a/tests/transcripts/slashes_escaped.txt +++ b/tests/transcripts/slashes_escaped.txt @@ -1,2 +1,6 @@ +# escape those slashes + (Cmd) say /some/unix/path \/some\/unix\/path +(Cmd) say mix 2/3 c. sugar, 1/2 c. butter, and 1/2 tsp. salt +mix 2\/3 c. sugar, 1\/2 c. butter, and 1\/2 tsp. salt diff --git a/tests/transcripts/slashslash.txt b/tests/transcripts/slashslash.txt index 706f1079..2504b0ba 100644 --- a/tests/transcripts/slashslash.txt +++ b/tests/transcripts/slashslash.txt @@ -1,2 +1,4 @@ +# ensure consecutive slashes are parsed correctly + (Cmd) say // \/\/ diff --git a/tests/transcripts/spaces.txt b/tests/transcripts/spaces.txt index b4cdfa02..615fcbd7 100644 --- a/tests/transcripts/spaces.txt +++ b/tests/transcripts/spaces.txt @@ -1,6 +1,8 @@ +# check spaces in all their forms + (Cmd) say how many spaces how many spaces (Cmd) say how many spaces -how/\s+/many/\s+/spaces +how/\s{1}/many/\s{1}/spaces (Cmd) say "how many spaces" how/\s+/many/\s+/spaces diff --git a/tests/transcripts/word_boundaries.txt b/tests/transcripts/word_boundaries.txt index 0f9f2166..e79cfc4f 100644 --- a/tests/transcripts/word_boundaries.txt +++ b/tests/transcripts/word_boundaries.txt @@ -1,3 +1,5 @@ +# use word boundaries to check for key words in the output + (Cmd) mumble maybe we could go to lunch /.*\bmaybe\b.*\bcould\b.*\blunch\b.*/ (Cmd) mumble maybe we could go to lunch |