From 2bd6ebea11b64f47158c3553992943b17a8566f0 Mon Sep 17 00:00:00 2001 From: Alexander Simonov Date: Tue, 17 Sep 2013 20:34:19 +0300 Subject: [PATCH] JRuby support --- .travis.yml | 9 ++++++++- lib/zip/extra_field.rb | 2 +- test/ziptest.rb | 9 ++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e76a4a..3aaf1dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,17 @@ +language: ruby rvm: - 1.9.2 - 1.9.3 - 2.0.0 - ruby-head - rbx-19mode + - jruby-19mode +before_install: + - gem update --system + - gem --version before_script: "sudo apt-get -y install zip unzip" branches: only: - - master + - master +allow_failures: + - rvm: ruby-head diff --git a/lib/zip/extra_field.rb b/lib/zip/extra_field.rb index 4cb26b0..b2b0c23 100755 --- a/lib/zip/extra_field.rb +++ b/lib/zip/extra_field.rb @@ -58,7 +58,7 @@ module Zip end def to_local_bin - self.map { |_, v| v.to_local_bin }.join + self.map { |_, v| v.to_local_bin.force_encoding('BINARY') }.join end alias :to_s :to_local_bin diff --git a/test/ziptest.rb b/test/ziptest.rb index f320225..336d538 100755 --- a/test/ziptest.rb +++ b/test/ziptest.rb @@ -873,13 +873,12 @@ class ZipEntrySetTest < Test::Unit::TestCase end def test_each - # Tested indirectly via each_with_index + # Used each instead each_with_index due the bug in jRuby count = 0 - @zipEntrySet.each_with_index { - |entry, index| + @zipEntrySet.each do |entry| assert(ZIP_ENTRIES.include?(entry)) - count = count.succ - } + count += 1 + end assert_equal(ZIP_ENTRIES.size, count) end