From 208fd69238c97a83c373343573e9f19c59124adc Mon Sep 17 00:00:00 2001 From: Jared Crapo Date: Mon, 21 Aug 2017 20:39:21 -0600 Subject: regex implementation complete. Still a few bugs. --- tests/transcripts/from_cmdloop.txt | 10 +++++----- tests/transcripts/multiline_no_regex.txt | 4 +--- tests/transcripts/multiline_regex.txt | 4 +--- tests/transcripts/regex_set.txt | 5 +++-- tests/transcripts/singleslash.txt | 2 +- tests/transcripts/slashdot.txt | 2 +- tests/transcripts/slashes_escaped.txt | 2 ++ tests/transcripts/slashslash.txt | 2 +- tests/transcripts/slashslash_escaped.txt | 5 ----- tests/transcripts/word_boundaries.txt | 4 ++++ 10 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 tests/transcripts/slashes_escaped.txt delete mode 100644 tests/transcripts/slashslash_escaped.txt create mode 100644 tests/transcripts/word_boundaries.txt (limited to 'tests/transcripts') diff --git a/tests/transcripts/from_cmdloop.txt b/tests/transcripts/from_cmdloop.txt index e95b9b39..649c8c4b 100644 --- a/tests/transcripts/from_cmdloop.txt +++ b/tests/transcripts/from_cmdloop.txt @@ -2,8 +2,9 @@ Documented commands (type help ): ======================================== -_relative_load edit history orate pyscript run say shell show -cmdenvironment help load py quit save set shortcuts speak +_relative_load help mumble pyscript save shell speak +cmdenvironment history orate quit say shortcuts +edit load py run set show (Cmd) help say Repeats what you tell me to. @@ -46,12 +47,11 @@ set maxrepeats 5 say -ps --repeat=5 goodnight, Gracie (Cmd) run 4 say -ps --repeat=5 goodnight, Gracie - OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY OODNIGHT, GRACIEGAY (Cmd) set prompt "---> " -prompt - was: (Cmd) -now: ---> +prompt - was: (Cmd)/ / +now: --->/ / diff --git a/tests/transcripts/multiline_no_regex.txt b/tests/transcripts/multiline_no_regex.txt index 5fe9122c..72ad453b 100644 --- a/tests/transcripts/multiline_no_regex.txt +++ b/tests/transcripts/multiline_no_regex.txt @@ -5,6 +5,4 @@ (Cmd) orate This is a test > of the > emergency broadcast system -This is a test -of the -emergency broadcast system +This is a test of the emergency broadcast system diff --git a/tests/transcripts/multiline_regex.txt b/tests/transcripts/multiline_regex.txt index c568bd37..e2a36762 100644 --- a/tests/transcripts/multiline_regex.txt +++ b/tests/transcripts/multiline_regex.txt @@ -1,6 +1,4 @@ (Cmd) say -r 3 -s yabba dabba do /\A(YA.*?DO\n?){3}/ (Cmd) say -r 5 -s yabba dabba do -YABBA DABBA DO -YABBA /[A-Z ]*?/ -DO +/\A([A-Z\s]*$){3}/ diff --git a/tests/transcripts/regex_set.txt b/tests/transcripts/regex_set.txt index a310224b..da515f31 100644 --- a/tests/transcripts/regex_set.txt +++ b/tests/transcripts/regex_set.txt @@ -1,17 +1,18 @@ # 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 (Cmd) set abbrev: True autorun_on_edit: False colors: /(True|False)/ -continuation_prompt: > +continuation_prompt: >/ / debug: False echo: False editor: /.*/ feedback_to_output: False locals_in_py: True maxrepeats: 3 -prompt: (Cmd) +prompt: (Cmd)/ / quiet: False timing: False diff --git a/tests/transcripts/singleslash.txt b/tests/transcripts/singleslash.txt index 00d0ba21..dfa06bc1 100644 --- a/tests/transcripts/singleslash.txt +++ b/tests/transcripts/singleslash.txt @@ -1,2 +1,2 @@ (Cmd) say use 2/3 cup of sugar -use 2/3 cup of sugar +use 2\/3 cup of sugar diff --git a/tests/transcripts/slashdot.txt b/tests/transcripts/slashdot.txt index 83b5870e..0c1ec747 100644 --- a/tests/transcripts/slashdot.txt +++ b/tests/transcripts/slashdot.txt @@ -1,2 +1,2 @@ (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 +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 new file mode 100644 index 00000000..f21556fe --- /dev/null +++ b/tests/transcripts/slashes_escaped.txt @@ -0,0 +1,2 @@ +(Cmd) say /some/unix/path +\/some\/unix\/path diff --git a/tests/transcripts/slashslash.txt b/tests/transcripts/slashslash.txt index a6d37456..706f1079 100644 --- a/tests/transcripts/slashslash.txt +++ b/tests/transcripts/slashslash.txt @@ -1,2 +1,2 @@ (Cmd) say // -// +\/\/ diff --git a/tests/transcripts/slashslash_escaped.txt b/tests/transcripts/slashslash_escaped.txt deleted file mode 100644 index 3bed129d..00000000 --- a/tests/transcripts/slashslash_escaped.txt +++ /dev/null @@ -1,5 +0,0 @@ -(Cmd) say // -\/\/ -(Cmd) say /some/unix/path -\/some\/unix\/path - diff --git a/tests/transcripts/word_boundaries.txt b/tests/transcripts/word_boundaries.txt new file mode 100644 index 00000000..0f9f2166 --- /dev/null +++ b/tests/transcripts/word_boundaries.txt @@ -0,0 +1,4 @@ +(Cmd) mumble maybe we could go to lunch +/.*\bmaybe\b.*\bcould\b.*\blunch\b.*/ +(Cmd) mumble maybe we could go to lunch +/.*\bmaybe\b.*\bcould\b.*\blunch\b.*/ -- cgit v1.2.1