summaryrefslogtreecommitdiff
path: root/test/lib/minitest
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-22 09:29:33 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-22 09:29:33 +0900
commit4d650bc25737a4d2c0dcc9d4c845688cb5dc85ce (patch)
tree397e2d27fcd2d4d647c1698f59e73d2ea175aca7 /test/lib/minitest
parentd01fd821875b989affc36e54e98f5dd67f47062e (diff)
Fix over-expansion
* test/lib/minitest/unit.rb (MiniTest::Assertions#mu_pp_for_diff): do not expand escaped backslash followed by 'n'.
Diffstat (limited to 'test/lib/minitest')
-rw-r--r--test/lib/minitest/unit.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index 25fd15d0937..6ba1c707e6e 100644
--- a/test/lib/minitest/unit.rb
+++ b/test/lib/minitest/unit.rb
@@ -179,7 +179,7 @@ module MiniTest
# uses mu_pp to do the first pass and then cleans it up.
def mu_pp_for_diff obj
- mu_pp(obj).gsub(/\\n/, "\n").gsub(/:0x[a-fA-F0-9]{4,}/m, ':0xXXXXXX')
+ mu_pp(obj).gsub(/(?<!\\)(?:\\\\)*\K\\n/, "\n").gsub(/:0x[a-fA-F0-9]{4,}/m, ':0xXXXXXX')
end
def _assertions= n # :nodoc: