From 0b9fbf9340ae87b0a561d2bdb1b9b3a441351127 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Thu, 22 Jun 2017 01:29:31 +1000 Subject: [PATCH 1/4] Get tests passing with frozen-string-literals enabled. Though this does require patches for test-unit, as covered in https://github.com/test-unit/test-unit/pull/149. --- lib/redis/connection/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/redis/connection/ruby.rb b/lib/redis/connection/ruby.rb index 96f1d6a59..c01edd913 100644 --- a/lib/redis/connection/ruby.rb +++ b/lib/redis/connection/ruby.rb @@ -39,7 +39,7 @@ def initialize(*args) super(*args) @timeout = @write_timeout = nil - @buffer = "" + @buffer = "".dup end def timeout=(timeout) From 5922e0acf6fe6d728005773e9623ee4845fc3907 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Sun, 25 Jun 2017 00:01:01 +1000 Subject: [PATCH 2/4] Upgrade to latest test-unit for 1.9+. --- Gemfile | 6 ++++++ redis.gemspec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 73d38bc2e..b14f14cdd 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,9 @@ source 'https://rubygems.org' gemspec + +if RUBY_VERSION.to_f < 1.9 + gem 'test-unit', '3.1.5' +else + gem 'test-unit', '>= 3.2.5' +end diff --git a/redis.gemspec b/redis.gemspec index 3099b6d9b..a661410dd 100644 --- a/redis.gemspec +++ b/redis.gemspec @@ -40,5 +40,5 @@ Gem::Specification.new do |s| s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.add_development_dependency("rake", "<11.0.0") - s.add_development_dependency("test-unit", "3.1.5") + s.add_development_dependency("test-unit", ">= 3.1.5") end From 8ff919bbc7e8b10e8c3255ab036b387730f63db6 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Sun, 25 Jun 2017 00:35:33 +1000 Subject: [PATCH 3/4] Add MRI 2.4 plus frozen string literal check to .travis.yml --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 438d89596..dcfd6e5c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ rvm: - 2.1 - 2.2 - 2.3.0 + - 2.4.1 - jruby-18mode - jruby-19mode - jruby-9.0.5.0 @@ -16,6 +17,9 @@ gemfile: ".travis/Gemfile" sudo: false +before_script: +- if (ruby -e "exit RUBY_VERSION.to_f >= 2.4"); then export RUBYOPT="--enable-frozen-string-literal"; fi; echo $RUBYOPT + env: global: - VERBOSE=true From 8033911a500a2d33e472e3b8da86b73979ed4111 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Sun, 25 Jun 2017 12:06:53 +1000 Subject: [PATCH 4/4] Add test-unit constraints to the Travis Gemfile. --- .travis/Gemfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis/Gemfile b/.travis/Gemfile index 3fd116321..9e4a237cf 100644 --- a/.travis/Gemfile +++ b/.travis/Gemfile @@ -9,3 +9,9 @@ when "synchrony" gem "hiredis" gem "em-synchrony" end + +if RUBY_VERSION.to_f < 1.9 + gem 'test-unit', '3.1.5' +else + gem 'test-unit', '>= 3.2.5' +end