summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml5
-rw-r--r--appveyor.yml3
-rw-r--r--test/ruby/test_time_tz.rb38
3 files changed, 45 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml
index 6762dc245a..1d54453439 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -76,6 +76,8 @@ env:
# JOBS and SETARCH are overridden when necessary; see below.
- JOBS=-j$((1+${NPROC}))
- SETARCH=
+ - RUBY_PREFIX=/tmp/ruby-prefix
+ - GEMS_FOR_TEST='timezone tzinfo'
.org.ruby-lang.ci.matrix-definitions:
@@ -343,7 +345,7 @@ before_script:
[ ! -f config.cache ] ||
[ "$CC" = "`sed -n s/^ac_cv_prog_CC=//p config.cache`" ] ||
(set -x; exec rm config.cache)
- - $SETARCH ../configure -C --disable-install-doc --prefix=/tmp/ruby-prefix $CONFIG_FLAG
+ - $SETARCH ../configure -C --disable-install-doc --prefix=$RUBY_PREFIX $CONFIG_FLAG
- cp -pr config.cache config.status .ext/include ../config_1st
- $SETARCH make reconfig
- cp -pr config.cache config.status .ext/include ../config_2nd
@@ -354,6 +356,7 @@ before_script:
- chmod u-w ..
- $SETARCH make -s $JOBS && make install
- ccache --show-stats
+ - [ -z "${GEMS_FOR_TEST}" ] || $RUBY_PREFIX/bin/gem install --no-document $GEMS_FOR_TEST
script:
- $SETARCH make -s test TESTOPTS="${TESTOPTS=$JOBS -q --tty=no}"
diff --git a/appveyor.yml b/appveyor.yml
index 542699ce0d..3bf1568cd9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -16,6 +16,7 @@ environment:
- build: vs
vs: 140
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
+ GEMS_FOR_TEST: "timezone tzinfo"
notifications:
- provider: Webhook
url:
@@ -89,6 +90,7 @@ for:
- nmake -l
- nmake install-nodoc
- \usr\bin\ruby -v -e "p :locale => Encoding.find('locale'), :filesystem => Encoding.find('filesystem')"
+ - if not "%GEMS_FOR_TEST%" == "" \usr\bin\gem install --no-document %GEMS_FOR_TEST%
test_script:
- set /a JOBS=%NUMBER_OF_PROCESSORS%
- nmake -l "TESTOPTS=-v -q" btest
@@ -134,6 +136,7 @@ for:
- mingw32-make -j%JOBS% up
- mingw32-make -j%JOBS%
- mingw32-make DESTDIR=../install install-nodoc
+ - if not "%GEMS_FOR_TEST%" == "" ..\install\bin\gem install --no-document %GEMS_FOR_TEST%
test_script:
- mingw32-make test
- mingw32-make test-all TESTOPTS="--retry --job-status=normal --show-skip --subprocess-timeout-scale=1.5 --excludes=../ruby/test/excludes/_appveyor -j %JOBS% --exclude win32ole --exclude test_open-uri"
diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb
index 379f2f65f3..ae655d98c0 100644
--- a/test/ruby/test_time_tz.rb
+++ b/test/ruby/test_time_tz.rb
@@ -603,3 +603,41 @@ class TestTimeTZ::DummyTZ < Test::Unit::TestCase
TestTimeTZ::TZ.new(tzname, abbr, utc_offset)
end
end
+
+begin
+ require "tzinfo"
+rescue LoadError
+else
+ class TestTimeTZ::GemTZInfo < Test::Unit::TestCase
+ include TestTimeTZ::WithTZ
+
+ class TIME_CLASS < ::Time
+ def self.find_timezone(tzname)
+ TZInfo::Timezone.get(tzname)
+ end
+ end
+
+ def tz
+ @tz ||= TZInfo::Timezone.get(tzname)
+ end
+ end
+end
+
+begin
+ require "timezone"
+rescue LoadError
+else
+ class TestTimeTZ::GemTimezone < Test::Unit::TestCase
+ include TestTimeTZ::WithTZ
+
+ class TIME_CLASS < ::Time
+ def self.find_timezone(name)
+ Timezone[name]
+ end
+ end
+
+ def tz
+ @tz ||= Timezone[tzname]
+ end
+ end
+end