From 23f779f73afb4ef9be9f50774bfb6da03f38c0ec Mon Sep 17 00:00:00 2001 From: SHIBATA Hiroshi Date: Tue, 20 Jun 2017 10:19:07 +0900 Subject: [PATCH] Fixed broken test with frozen objects --- lib/rake/ext/string.rb | 2 +- lib/rake/task.rb | 2 +- test/test_rake_application.rb | 2 +- test/test_rake_path_map_partial.rb | 2 +- test/test_trace_output.rb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/rake/ext/string.rb b/lib/rake/ext/string.rb index 7bd5064f9..c70236ae9 100644 --- a/lib/rake/ext/string.rb +++ b/lib/rake/ext/string.rb @@ -137,7 +137,7 @@ def pathmap_replace(patterns, &block) # This String extension comes from Rake def pathmap(spec=nil, &block) return self if spec.nil? - result = "" + result = "".dup spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag| case frag when "%f" diff --git a/lib/rake/task.rb b/lib/rake/task.rb index 077f37f4a..256571112 100644 --- a/lib/rake/task.rb +++ b/lib/rake/task.rb @@ -321,7 +321,7 @@ def set_arg_names(args) # Return a string describing the internal state of a task. Useful for # debugging. def investigation - result = "------------------------------\n" + result = "------------------------------\n".dup result << "Investigating #{name}\n" result << "class: #{self.class}\n" result << "task needed: #{needed?}\n" diff --git a/test/test_rake_application.rb b/test/test_rake_application.rb index b52c484dc..141dd576f 100644 --- a/test/test_rake_application.rb +++ b/test/test_rake_application.rb @@ -37,7 +37,7 @@ def test_display_exception_details def test_display_exception_details_bad_encoding begin - raise "El Niño is coming!".force_encoding("US-ASCII") + raise "El Niño is coming!".dup.force_encoding("US-ASCII") rescue => ex end diff --git a/test/test_rake_path_map_partial.rb b/test/test_rake_path_map_partial.rb index f65428d71..9daf44ca5 100644 --- a/test/test_rake_path_map_partial.rb +++ b/test/test_rake_path_map_partial.rb @@ -3,7 +3,7 @@ class TestRakePathMapPartial < Rake::TestCase def test_pathmap_partial - @path = "1/2/file" + @path = "1/2/file".dup def @path.call(n) pathmap_partial(n) end diff --git a/test/test_trace_output.rb b/test/test_trace_output.rb index 92de3058b..34dab6162 100644 --- a/test/test_trace_output.rb +++ b/test/test_trace_output.rb @@ -9,7 +9,7 @@ class PrintSpy attr_reader :result, :calls def initialize - @result = "" + @result = "".dup @calls = 0 end