diff options
author | Kyrylo Silin <silin@kyrylo.org> | 2021-04-11 00:54:01 +0300 |
---|---|---|
committer | Kyrylo Silin <silin@kyrylo.org> | 2021-04-11 01:02:59 +0300 |
commit | 54617a7de471e009eadd0189d88913c205c2c365 (patch) | |
tree | 51e833efde32201dceb2d037303aa6ae1f6db90c /spec | |
parent | 033f69b3afcce57ed8d8b68f297457d1a80b1e6c (diff) | |
download | pry-54617a7de471e009eadd0189d88913c205c2c365.tar.gz |
helpers/documentation: don't colorize twice
Fixes #2181 (Bad formatting)
One of the regexps matches against string that were already colored. To prevent
that I used a negative look-ahead and rejected color sequences.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/documentation_helper_spec.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/documentation_helper_spec.rb b/spec/documentation_helper_spec.rb index 8da62a29..715e101d 100644 --- a/spec/documentation_helper_spec.rb +++ b/spec/documentation_helper_spec.rb @@ -72,5 +72,9 @@ describe Pry::Helpers::DocumentationHelpers do it "should not remove ++" do expect(@helper.process_rdoc("--\n comment in a bubble\n++")).to match(/\+\+/) end + + it "should not syntax highlight already highlighted code" do + expect(@helper.process_rdoc(" \e\[31mFOO\e\[0m")).to match(/ \e\[31mFOO\e\[0m/) + end end end |