Blob Blame History Raw
From 82d85b70f66de8c8c6f6ecb52f6536711c1de591 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 21 Jan 2015 16:46:45 +0100
Subject: [PATCH] Add support for Ruby 2.2.
---
test/test-main.rb | 4 ++--
test/test-users-guide.rb | 2 +-
test/testutil.rb | 4 ++++
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/test/test-main.rb b/test/test-main.rb
index 9dbe12e..eca7b21 100644
--- a/test/test-main.rb
+++ b/test/test-main.rb
@@ -216,7 +216,7 @@ END
begin
ENV['PATH'] = bindir + File::PATH_SEPARATOR + ENV['PATH']
ENV['_'] = 'erubis'
- Tempfile.open(self.name.gsub(/[^\w]/,'_')) do |f|
+ Tempfile.open(self.method_name.gsub(/[^\w]/,'_')) do |f|
f.write(INPUT)
f.flush
yield(f.path)
@@ -273,7 +273,7 @@ END
errmsgs << <<'END'
7: syntax error, unexpected $end, expecting keyword_end
END
- elsif ruby20? || ruby21?
+ elsif ruby20? || ruby21? || ruby22?
errmsgs << <<'END'
3: syntax error, unexpected ']', expecting ')'
_buf << ' <li>'; _buf << ( item[:name]] ).to_s; _buf << '</li>
diff --git a/test/test-users-guide.rb b/test/test-users-guide.rb
index fee5435..af6c006 100644
--- a/test/test-users-guide.rb
+++ b/test/test-users-guide.rb
@@ -28,7 +28,7 @@ class KwarkUsersGuideTest < Test::Unit::TestCase
s =~ /\A\$ (.*?)\n/
command = $1
expected = $'
- if ruby19? || ruby20? || ruby21?
+ if ruby19? || ruby20? || ruby21? || ruby22?
case @name
when 'test_main_program1_result'
expected.sub!('["eruby", "items", "x", "_buf"]', '[:_buf, :eruby, :items, :x]')
diff --git a/test/testutil.rb b/test/testutil.rb
index 1b841c3..e9130b7 100644
--- a/test/testutil.rb
+++ b/test/testutil.rb
@@ -25,6 +25,10 @@ def ruby21? # :nodoc:
RUBY_VERSION =~ /\A2.1/
end
+def ruby22? # :nodoc:
+ RUBY_VERSION =~ /\A2.2/
+end
+
def rubinius? # :nodoc:
defined?(RUBY_ENGINE) && RUBY_ENGINE == "rbx"
end
--
2.1.0