You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rubygem-tzinfo/SOURCES/rubygem-tzinfo-2.0.5-fix-in...

1032 lines
32 KiB

From f76bc7fc824a831a159f080ea2fdeade47dc1e38 Mon Sep 17 00:00:00 2001
From: Phil Ross <phil.ross@gmail.com>
Date: Fri, 23 Sep 2022 19:50:25 +0100
Subject: [PATCH] Fix include issues with tests on Ruby 3.2.
Ruby 3.2 changes how includes are handled (see
https://redmine.ruby-lang.org/issues/18832). This breaks the
DataSources, Format1 and Format2 test cases (references to constants in
the respective modules are not found).
Add includes for TZInfo::DataSources, TZInfo::Format1 and
TZInfo::Format2 into test classes.
Move the TZInfo include too to stop the pollution of Object (top-level
scope).
---
.../tc_constant_offset_data_timezone_info.rb | 5 +++--
test/data_sources/tc_country_info.rb | 5 +++--
test/data_sources/tc_data_timezone_info.rb | 5 +++--
test/data_sources/tc_linked_timezone_info.rb | 5 +++--
test/data_sources/tc_posix_time_zone_parser.rb | 7 +++++--
test/data_sources/tc_ruby_data_source.rb | 5 +++--
test/data_sources/tc_timezone_info.rb | 5 +++--
test/data_sources/tc_transitions_data_timezone_info.rb | 5 +++--
test/data_sources/tc_zoneinfo_data_source.rb | 7 ++++---
test/data_sources/tc_zoneinfo_reader.rb | 7 ++++---
test/format1/tc_country_definer.rb | 5 +++--
test/format1/tc_country_index_definition.rb | 4 ++--
test/format1/tc_timezone_definer.rb | 5 +++--
test/format1/tc_timezone_definition.rb | 5 +++--
test/format1/tc_timezone_index_definition.rb | 5 +++--
test/format2/tc_country_definer.rb | 5 +++--
test/format2/tc_country_index_definer.rb | 5 +++--
test/format2/tc_country_index_definition.rb | 4 ++--
test/format2/tc_timezone_definer.rb | 5 +++--
test/format2/tc_timezone_definition.rb | 5 +++--
test/format2/tc_timezone_index_definer.rb | 5 +++--
test/format2/tc_timezone_index_definition.rb | 5 +++--
test/tc_annual_rules.rb | 5 ++---
test/tc_country.rb | 4 ++--
test/tc_country_timezone.rb | 4 ++--
test/tc_data_source.rb | 10 ++++++++--
test/tc_data_timezone.rb | 3 +--
test/tc_datetime_with_offset.rb | 4 ++--
test/tc_info_timezone.rb | 4 ++--
test/tc_linked_timezone.rb | 3 +--
test/tc_offset_timezone_period.rb | 3 +--
test/tc_ruby_time_timezone.rb | 4 ++--
test/tc_string_deduper.rb | 4 ++--
test/tc_time_with_offset.rb | 4 ++--
test/tc_timestamp.rb | 4 ++--
test/tc_timestamp_with_offset.rb | 4 ++--
test/tc_timezone.rb | 6 ++++--
test/tc_timezone_london.rb | 4 ++--
test/tc_timezone_melbourne.rb | 4 ++--
test/tc_timezone_new_york.rb | 4 ++--
test/tc_timezone_offset.rb | 3 +--
test/tc_timezone_period.rb | 4 ++--
test/tc_timezone_proxy.rb | 4 ++--
test/tc_timezone_transition.rb | 3 +--
test/tc_timezone_utc.rb | 4 ++--
test/tc_transition_rule.rb | 8 ++++++--
test/tc_transitions_timezone_period.rb | 3 +--
test/tc_tzinfo.rb | 2 ++
test/tc_with_offset.rb | 6 +++---
test/test_utils.rb | 6 +++---
test/ts_all.rb | 2 +-
51 files changed, 133 insertions(+), 104 deletions(-)
diff --git a/test/data_sources/tc_constant_offset_data_timezone_info.rb b/test/data_sources/tc_constant_offset_data_timezone_info.rb
index 1401559a..03204909 100644
--- a/test/data_sources/tc_constant_offset_data_timezone_info.rb
+++ b/test/data_sources/tc_constant_offset_data_timezone_info.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module DataSources
class TCConstantOffsetDataTimezoneInfo < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def test_initialize
offset = TimezoneOffset.new(-17900, 0, 'TESTLMT')
identifier = 'Test/Zone'.dup
diff --git a/test/data_sources/tc_country_info.rb b/test/data_sources/tc_country_info.rb
index aab8f90a..bd4da08a 100644
--- a/test/data_sources/tc_country_info.rb
+++ b/test/data_sources/tc_country_info.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module DataSources
class TCCountryInfo < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def test_initialize_nil_code
error = assert_raises(ArgumentError) { CountryInfo.new(nil, 'Zzz', []) }
assert_match(/\bcode\b/, error.message)
diff --git a/test/data_sources/tc_data_timezone_info.rb b/test/data_sources/tc_data_timezone_info.rb
index b5822db8..72f0fbef 100644
--- a/test/data_sources/tc_data_timezone_info.rb
+++ b/test/data_sources/tc_data_timezone_info.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module DataSources
class TCDataTimezoneInfo < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def test_initialize_nil_identifier
error = assert_raises(ArgumentError) { DataTimezoneInfo.new(nil) }
assert_match(/\bidentifier\b/, error.message)
diff --git a/test/data_sources/tc_linked_timezone_info.rb b/test/data_sources/tc_linked_timezone_info.rb
index 36b8fec4..5a7e8c76 100644
--- a/test/data_sources/tc_linked_timezone_info.rb
+++ b/test/data_sources/tc_linked_timezone_info.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module DataSources
class TCLinkedTimezoneInfo < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def test_initialize_nil_identifier
error = assert_raises(ArgumentError) { LinkedTimezoneInfo.new(nil, 'Test/Linked') }
assert_match(/\bidentifier\b/, error.message)
diff --git a/test/data_sources/tc_posix_time_zone_parser.rb b/test/data_sources/tc_posix_time_zone_parser.rb
index d6c8c352..73dbb747 100644
--- a/test/data_sources/tc_posix_time_zone_parser.rb
+++ b/test/data_sources/tc_posix_time_zone_parser.rb
@@ -3,18 +3,21 @@
require_relative '../test_utils'
-include TZInfo
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)
module DataSources
class TCPosixTimeZoneParser < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
HOUR = 3600
MINUTE = 60
class << self
+ include TZInfo::DataSources
+
private
def append_time_to_rule(day_rule, time)
diff --git a/test/data_sources/tc_ruby_data_source.rb b/test/data_sources/tc_ruby_data_source.rb
index 8baab05e..1447bc76 100644
--- a/test/data_sources/tc_ruby_data_source.rb
+++ b/test/data_sources/tc_ruby_data_source.rb
@@ -7,10 +7,11 @@
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)
-include TZInfo
-
module DataSources
class TCRubyDataSource < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def setup
@data_source = RubyDataSource.new
end
diff --git a/test/data_sources/tc_timezone_info.rb b/test/data_sources/tc_timezone_info.rb
index 00cda364..e643e9e8 100644
--- a/test/data_sources/tc_timezone_info.rb
+++ b/test/data_sources/tc_timezone_info.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module DataSources
class TCTimezoneInfo < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def test_initialize_nil_identifier
error = assert_raises(ArgumentError) { TimezoneInfo.new(nil) }
assert_match(/\bidentifier\b/, error.message)
diff --git a/test/data_sources/tc_transitions_data_timezone_info.rb b/test/data_sources/tc_transitions_data_timezone_info.rb
index 830c1222..35e67a97 100644
--- a/test/data_sources/tc_transitions_data_timezone_info.rb
+++ b/test/data_sources/tc_transitions_data_timezone_info.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module DataSources
class TCTransitionsDataTimezoneInfo < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
def test_initialize_transitions
o1 = TimezoneOffset.new(-17900, 0, 'TESTLMT')
o2 = TimezoneOffset.new(-18000, 3600, 'TESTD')
diff --git a/test/data_sources/tc_zoneinfo_data_source.rb b/test/data_sources/tc_zoneinfo_data_source.rb
index 064eed8e..5327d3bb 100644
--- a/test/data_sources/tc_zoneinfo_data_source.rb
+++ b/test/data_sources/tc_zoneinfo_data_source.rb
@@ -6,15 +6,16 @@
require 'pathname'
require 'tmpdir'
-include TZInfo
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)
-send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
+send(:using, TZInfo.const_get(:UntaintExt)) if TZInfo.const_defined?(:UntaintExt)
module DataSources
class TCZoneinfoDataSource < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
ZONEINFO_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', 'zoneinfo')).untaint
def setup
diff --git a/test/data_sources/tc_zoneinfo_reader.rb b/test/data_sources/tc_zoneinfo_reader.rb
index 3de88978..4a52228f 100644
--- a/test/data_sources/tc_zoneinfo_reader.rb
+++ b/test/data_sources/tc_zoneinfo_reader.rb
@@ -4,14 +4,15 @@
require_relative '../test_utils'
require 'tempfile'
-include TZInfo
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
-send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt)
+send(:using, TZInfo.const_get(:UntaintExt)) if TZInfo.const_defined?(:UntaintExt)
module DataSources
class TCZoneinfoReader < Minitest::Test
+ include TZInfo
+ include TZInfo::DataSources
+
class FakePosixTimeZoneParser
def initialize(&block)
@on_parse = block
diff --git a/test/format1/tc_country_definer.rb b/test/format1/tc_country_definer.rb
index 64a5ce8e..02b09f97 100644
--- a/test/format1/tc_country_definer.rb
+++ b/test/format1/tc_country_definer.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format1
class TCCountryDefiner < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format1)
+
def setup
@identifier_deduper = StringDeduper.new
@description_deduper = StringDeduper.new
diff --git a/test/format1/tc_country_index_definition.rb b/test/format1/tc_country_index_definition.rb
index c86044ae..4406ff35 100644
--- a/test/format1/tc_country_index_definition.rb
+++ b/test/format1/tc_country_index_definition.rb
@@ -3,10 +3,10 @@
require_relative '../test_utils'
-include TZInfo
-
module Format1
class TCCountryIndexDefinition < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format1)
def test_none
m = Module.new
diff --git a/test/format1/tc_timezone_definer.rb b/test/format1/tc_timezone_definer.rb
index 575f1b2e..80fa5df1 100644
--- a/test/format1/tc_timezone_definer.rb
+++ b/test/format1/tc_timezone_definer.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format1
class TCTimezoneDefiner < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format1)
+
def setup
@string_deduper = StringDeduper.new
@definer = TimezoneDefiner.new(@string_deduper)
diff --git a/test/format1/tc_timezone_definition.rb b/test/format1/tc_timezone_definition.rb
index 1c279a4c..1e42d457 100644
--- a/test/format1/tc_timezone_definition.rb
+++ b/test/format1/tc_timezone_definition.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format1
class TCTimezoneDefinition < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format1)
+
def test_timezone_definer_class
m = Module.new
m.send(:include, TimezoneDefinition)
diff --git a/test/format1/tc_timezone_index_definition.rb b/test/format1/tc_timezone_index_definition.rb
index 9ac59b66..fc39a169 100644
--- a/test/format1/tc_timezone_index_definition.rb
+++ b/test/format1/tc_timezone_index_definition.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format1
class TCTimezoneIndexDefinition < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format1)
+
def test_mixed
m = Module.new
m.send(:include, TimezoneIndexDefinition)
diff --git a/test/format2/tc_country_definer.rb b/test/format2/tc_country_definer.rb
index d0f1a7ad..29d24abf 100644
--- a/test/format2/tc_country_definer.rb
+++ b/test/format2/tc_country_definer.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCCountryDefiner < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
+
def setup
@identifier_deduper = StringDeduper.new
@description_deduper = StringDeduper.new
diff --git a/test/format2/tc_country_index_definer.rb b/test/format2/tc_country_index_definer.rb
index c8a799fb..d88cb943 100644
--- a/test/format2/tc_country_index_definer.rb
+++ b/test/format2/tc_country_index_definer.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCCountryIndexDefiner < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
+
def setup
@identifier_deduper = StringDeduper.new
@description_deduper = StringDeduper.new
diff --git a/test/format2/tc_country_index_definition.rb b/test/format2/tc_country_index_definition.rb
index 5fa3042d..1f4dba51 100644
--- a/test/format2/tc_country_index_definition.rb
+++ b/test/format2/tc_country_index_definition.rb
@@ -3,10 +3,10 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCCountryIndexDefinition < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
def test_not_defined
m = Module.new
diff --git a/test/format2/tc_timezone_definer.rb b/test/format2/tc_timezone_definer.rb
index 5bdbf768..f2e60297 100644
--- a/test/format2/tc_timezone_definer.rb
+++ b/test/format2/tc_timezone_definer.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCTimezoneDefiner < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
+
def setup
@string_deduper = StringDeduper.new
@definer = TimezoneDefiner.new(@string_deduper)
diff --git a/test/format2/tc_timezone_definition.rb b/test/format2/tc_timezone_definition.rb
index 4ce8fdd6..4c212fb8 100644
--- a/test/format2/tc_timezone_definition.rb
+++ b/test/format2/tc_timezone_definition.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCTimezoneDefinition < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
+
def test_timezone_definer_class
m = Module.new
m.send(:include, TimezoneDefinition)
diff --git a/test/format2/tc_timezone_index_definer.rb b/test/format2/tc_timezone_index_definer.rb
index dec121c6..42542c7e 100644
--- a/test/format2/tc_timezone_index_definer.rb
+++ b/test/format2/tc_timezone_index_definer.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCTimezoneIndexDefiner < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
+
def setup
@string_deduper = StringDeduper.new
@definer = TimezoneIndexDefiner.new(@string_deduper)
diff --git a/test/format2/tc_timezone_index_definition.rb b/test/format2/tc_timezone_index_definition.rb
index 62f4dd48..e61b798e 100644
--- a/test/format2/tc_timezone_index_definition.rb
+++ b/test/format2/tc_timezone_index_definition.rb
@@ -3,10 +3,11 @@
require_relative '../test_utils'
-include TZInfo
-
module Format2
class TCTimezoneIndexDefinition < Minitest::Test
+ include TZInfo
+ include TZInfo.const_get(:Format2)
+
def test_mixed
m = Module.new
m.send(:include, TimezoneIndexDefinition)
diff --git a/test/tc_annual_rules.rb b/test/tc_annual_rules.rb
index 25af4bc1..8905b6a0 100644
--- a/test/tc_annual_rules.rb
+++ b/test/tc_annual_rules.rb
@@ -3,9 +3,8 @@
require_relative 'test_utils'
-include TZInfo
-
class TCAnnualRules < Minitest::Test
+ include TZInfo
def test_initialize
std_offset = TimezoneOffset.new(0, 0, 'GMT')
@@ -92,7 +91,7 @@ def initialize(month, day)
end
def at(offset, year)
- TimestampWithOffset.for(Time.new(year, @month, @day, 0, 0, 0, offset.observed_utc_offset)).set_timezone_offset(offset)
+ TZInfo::TimestampWithOffset.for(Time.new(year, @month, @day, 0, 0, 0, offset.observed_utc_offset)).set_timezone_offset(offset)
end
end
end
diff --git a/test/tc_country.rb b/test/tc_country.rb
index b0326200..02883f9e 100644
--- a/test/tc_country.rb
+++ b/test/tc_country.rb
@@ -3,13 +3,13 @@
require_relative 'test_utils'
-include TZInfo
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)
class TCCountry < Minitest::Test
+ include TZInfo
+
def setup
@orig_data_source = DataSource.get
end
diff --git a/test/tc_country_timezone.rb b/test/tc_country_timezone.rb
index e175f2ed..343abbfe 100644
--- a/test/tc_country_timezone.rb
+++ b/test/tc_country_timezone.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCCountryTimezone < Minitest::Test
+ include TZInfo
+
def test_identifier
ct = CountryTimezone.new('Europe/London', Rational(2059, 40), Rational(-5, 16))
assert_equal('Europe/London', ct.identifier)
diff --git a/test/tc_data_source.rb b/test/tc_data_source.rb
index 1bdbe8a9..af977b18 100644
--- a/test/tc_data_source.rb
+++ b/test/tc_data_source.rb
@@ -4,9 +4,9 @@
require_relative 'test_utils'
require 'tmpdir'
-include TZInfo
-
class TCDataSource < Minitest::Test
+ include TZInfo
+
class InitDataSource < DataSource
end
@@ -23,6 +23,8 @@ def initialize
end
class GetTimezoneInfoTestDataSource < TestDataSource
+ include TZInfo
+
protected
def load_timezone_info(identifier)
@@ -33,6 +35,8 @@ def load_timezone_info(identifier)
end
class GetCountryInfoTestDataSource < TestDataSource
+ include TZInfo
+
protected
def load_country_info(code)
@@ -88,6 +92,8 @@ def call_lookup_country_info(hash, code, encoding = Encoding::UTF_8)
end
class EagerLoadTestDataSource < GetTimezoneIdentifiersTestDataSource
+ include TZInfo
+
attr_reader :country_codes_called
attr_reader :loaded_timezones
attr_reader :loaded_countries
diff --git a/test/tc_data_timezone.rb b/test/tc_data_timezone.rb
index 2dffa279..4cdb52a5 100644
--- a/test/tc_data_timezone.rb
+++ b/test/tc_data_timezone.rb
@@ -3,9 +3,8 @@
require_relative 'test_utils'
-include TZInfo
-
class TCDataTimezone < Minitest::Test
+ include TZInfo
class TestTimezoneInfo < DataSources::TimezoneInfo
attr_reader :timestamp
diff --git a/test/tc_datetime_with_offset.rb b/test/tc_datetime_with_offset.rb
index 6b0e8f5f..2164b82a 100644
--- a/test/tc_datetime_with_offset.rb
+++ b/test/tc_datetime_with_offset.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCDateTimeWithOffset < Minitest::Test
+ include TZInfo
+
def datetime_with_offset(year, month, day, hour, minute, second, tz_offset)
DateTimeWithOffset.new(year, month, day, hour, minute, second, tz_offset.observed_utc_offset.to_r / 86400).set_timezone_offset(tz_offset)
end
diff --git a/test/tc_info_timezone.rb b/test/tc_info_timezone.rb
index 8673fee3..1a988a1b 100644
--- a/test/tc_info_timezone.rb
+++ b/test/tc_info_timezone.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCInfoTimezone < Minitest::Test
+ include TZInfo
+
def test_identifier
tz = InfoTimezone.new(DataSources::TimezoneInfo.new('Test/Identifier'))
assert_equal('Test/Identifier', tz.identifier)
diff --git a/test/tc_linked_timezone.rb b/test/tc_linked_timezone.rb
index 1b590cf8..72e2c1f6 100644
--- a/test/tc_linked_timezone.rb
+++ b/test/tc_linked_timezone.rb
@@ -3,9 +3,8 @@
require_relative 'test_utils'
-include TZInfo
-
class TCLinkedTimezone < Minitest::Test
+ include TZInfo
class TestTimezone < Timezone
attr_reader :period_for_result
diff --git a/test/tc_offset_timezone_period.rb b/test/tc_offset_timezone_period.rb
index 776d9a3d..cd9a1936 100644
--- a/test/tc_offset_timezone_period.rb
+++ b/test/tc_offset_timezone_period.rb
@@ -3,9 +3,8 @@
require_relative 'test_utils'
-include TZInfo
-
class TCOffsetTimezonePeriod < Minitest::Test
+ include TZInfo
def test_initialize
o = TimezoneOffset.new(-7200, 3600, 'SPECIAL')
diff --git a/test/tc_ruby_time_timezone.rb b/test/tc_ruby_time_timezone.rb
index e38911ed..cfc8012a 100644
--- a/test/tc_ruby_time_timezone.rb
+++ b/test/tc_ruby_time_timezone.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCRubyTimeTimezone < Minitest::Test
+ include TZInfo
+
def test_new_time_with_time_zone_paris
check_can_create_time_with_time_zone
diff --git a/test/tc_string_deduper.rb b/test/tc_string_deduper.rb
index 4217569a..74cbdf11 100644
--- a/test/tc_string_deduper.rb
+++ b/test/tc_string_deduper.rb
@@ -4,9 +4,9 @@
require_relative 'test_utils'
require 'concurrent'
-include TZInfo
-
class TCStringDeduper < Minitest::Test
+ include TZInfo
+
def test_string_deduper_dedupe
dedupe_tests(StringDeduper.new)
end
diff --git a/test/tc_time_with_offset.rb b/test/tc_time_with_offset.rb
index 2d4be53a..3f133523 100644
--- a/test/tc_time_with_offset.rb
+++ b/test/tc_time_with_offset.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimeWithOffset < Minitest::Test
+ include TZInfo
+
def time_with_offset(year, month, day, hour, minute, second, tz_offset)
TimeWithOffset.new(year, month, day, hour, minute, second, tz_offset.observed_utc_offset).set_timezone_offset(tz_offset)
end
diff --git a/test/tc_timestamp.rb b/test/tc_timestamp.rb
index 6132f5bf..26d19cfc 100644
--- a/test/tc_timestamp.rb
+++ b/test/tc_timestamp.rb
@@ -4,9 +4,9 @@
require_relative 'test_utils'
require 'date'
-include TZInfo
-
class TCTimestamp < Minitest::Test
+ include TZInfo
+
class TestTimestampSubclass < Timestamp
end
diff --git a/test/tc_timestamp_with_offset.rb b/test/tc_timestamp_with_offset.rb
index 1029fddf..0b7a41fd 100644
--- a/test/tc_timestamp_with_offset.rb
+++ b/test/tc_timestamp_with_offset.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimestampWithOffset < Minitest::Test
+ include TZInfo
+
def new_timestamp(year, month, day, hour, minute, second, offset, klass = Timestamp)
time = Time.new(year, month, day, hour, minute, second, offset == :utc ? 0 : offset)
klass.new(time.to_i, time.subsec, offset)
diff --git a/test/tc_timezone.rb b/test/tc_timezone.rb
index 5f198f09..0dc3300b 100644
--- a/test/tc_timezone.rb
+++ b/test/tc_timezone.rb
@@ -3,14 +3,16 @@
require_relative 'test_utils'
-include TZInfo
-
# Use send as a workaround for erroneous 'wrong number of arguments' errors with
# JRuby 9.0.5.0 when calling methods with Java implementations. See #114.
send(:using, TestUtils::TaintExt) if TestUtils.const_defined?(:TaintExt)
class TCTimezone < Minitest::Test
+ include TZInfo
+
class << self
+ include TZInfo
+
private
def time_with_unspecified_offset_test(method)
diff --git a/test/tc_timezone_london.rb b/test/tc_timezone_london.rb
index fdbe2c43..b57c7e00 100644
--- a/test/tc_timezone_london.rb
+++ b/test/tc_timezone_london.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezoneLondon < Minitest::Test
+ include TZInfo
+
def test_2004
#Europe/London Sun Mar 28 00:59:59 2004 UTC = Sun Mar 28 00:59:59 2004 GMT isdst=0 gmtoff=0
#Europe/London Sun Mar 28 01:00:00 2004 UTC = Sun Mar 28 02:00:00 2004 BST isdst=1 gmtoff=3600
diff --git a/test/tc_timezone_melbourne.rb b/test/tc_timezone_melbourne.rb
index 6912c2c0..0fd7bf82 100644
--- a/test/tc_timezone_melbourne.rb
+++ b/test/tc_timezone_melbourne.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezoneMelbourne < Minitest::Test
+ include TZInfo
+
def test_2004
#Australia/Melbourne Sat Mar 27 15:59:59 2004 UTC = Sun Mar 28 02:59:59 2004 AEDT isdst=1 gmtoff=39600
#Australia/Melbourne Sat Mar 27 16:00:00 2004 UTC = Sun Mar 28 02:00:00 2004 AEST isdst=0 gmtoff=36000
diff --git a/test/tc_timezone_new_york.rb b/test/tc_timezone_new_york.rb
index 27b4d630..b067b16d 100644
--- a/test/tc_timezone_new_york.rb
+++ b/test/tc_timezone_new_york.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezoneNewYork < Minitest::Test
+ include TZInfo
+
def test_2004
#America/New_York Sun Apr 4 06:59:59 2004 UTC = Sun Apr 4 01:59:59 2004 EST isdst=0 gmtoff=-18000
#America/New_York Sun Apr 4 07:00:00 2004 UTC = Sun Apr 4 03:00:00 2004 EDT isdst=1 gmtoff=-14400
diff --git a/test/tc_timezone_offset.rb b/test/tc_timezone_offset.rb
index 3c0740db..0cc1119c 100644
--- a/test/tc_timezone_offset.rb
+++ b/test/tc_timezone_offset.rb
@@ -3,9 +3,8 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezoneOffset < Minitest::Test
+ include TZInfo
[:base_utc_offset, :utc_offset].each do |method|
define_method("test_#{method}") do
diff --git a/test/tc_timezone_period.rb b/test/tc_timezone_period.rb
index 80e29ddc..ec949714 100644
--- a/test/tc_timezone_period.rb
+++ b/test/tc_timezone_period.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezonePeriod < Minitest::Test
+ include TZInfo
+
class TestTimezonePeriod < TimezonePeriod
attr_reader :start_transition
attr_reader :end_transition
diff --git a/test/tc_timezone_proxy.rb b/test/tc_timezone_proxy.rb
index 8b2788af..58526019 100644
--- a/test/tc_timezone_proxy.rb
+++ b/test/tc_timezone_proxy.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezoneProxy < Minitest::Test
+ include TZInfo
+
def assert_raises_invalid_timezone_identifier(identifier)
error = assert_raises(InvalidTimezoneIdentifier) { yield }
assert_match(Regexp.new('\b' + Regexp.escape(identifier) + '\b'), error.message)
diff --git a/test/tc_timezone_transition.rb b/test/tc_timezone_transition.rb
index 518c3b5f..7a991336 100644
--- a/test/tc_timezone_transition.rb
+++ b/test/tc_timezone_transition.rb
@@ -4,9 +4,8 @@
require_relative 'test_utils'
require 'date'
-include TZInfo
-
class TCTimezoneTransition < Minitest::Test
+ include TZInfo
def test_offset
t = TimezoneTransition.new(TimezoneOffset.new(3600, 3600, 'TDT'),
diff --git a/test/tc_timezone_utc.rb b/test/tc_timezone_utc.rb
index 11500bbf..bf1a5abd 100644
--- a/test/tc_timezone_utc.rb
+++ b/test/tc_timezone_utc.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTimezoneUTC < Minitest::Test
+ include TZInfo
+
def test_2004
tz = Timezone.get('UTC')
diff --git a/test/tc_transition_rule.rb b/test/tc_transition_rule.rb
index 838455f7..79f8738c 100644
--- a/test/tc_transition_rule.rb
+++ b/test/tc_transition_rule.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTransitionRule < Minitest::Test
+ include TZInfo
+
[-1, 0, 1].each do |transition_at|
define_method "test_transition_at_#{transition_at}" do
rule = TestTransitionRule.new(transition_at)
@@ -110,6 +110,7 @@ def test_invalid_transition_at
end
class TCAbsoluteDayOfYearTransitionRule < Minitest::Test
+ include TZInfo
include BaseTransitionRuleTestHelper
[-1, 366, '0'].each do |value|
@@ -214,6 +215,7 @@ def create_with_transition_at(transition_at)
end
class TCJulianDayOfYearTransitionRule < Minitest::Test
+ include TZInfo
include BaseTransitionRuleTestHelper
[0, 366, '1'].each do |value|
@@ -357,6 +359,7 @@ def test_is_not_always_last_day_of_year
end
class TCDayOfMonthTransitionRule < Minitest::Test
+ include TZInfo
include BaseTransitionRuleTestHelper
include DayOfWeekTransitionRuleTestHelper
@@ -463,6 +466,7 @@ def create_with_month_and_day_of_week(month, day_of_week)
end
class TCLastDayOfMonthTransitionRule < Minitest::Test
+ include TZInfo
include BaseTransitionRuleTestHelper
include DayOfWeekTransitionRuleTestHelper
diff --git a/test/tc_transitions_timezone_period.rb b/test/tc_transitions_timezone_period.rb
index 8bb0ca08..55a27025 100644
--- a/test/tc_transitions_timezone_period.rb
+++ b/test/tc_transitions_timezone_period.rb
@@ -3,9 +3,8 @@
require_relative 'test_utils'
-include TZInfo
-
class TCTransitionsTimezonePeriod < Minitest::Test
+ include TZInfo
def test_initialize_start_end
std = TimezoneOffset.new(-7200, 0, 'TEST')
diff --git a/test/tc_tzinfo.rb b/test/tc_tzinfo.rb
index c24e226b..67e336c3 100644
--- a/test/tc_tzinfo.rb
+++ b/test/tc_tzinfo.rb
@@ -4,6 +4,8 @@
require_relative 'test_utils'
class TCTZInfo < Minitest::Test
+ include TZInfo
+
def test_eager_load
test_data_source = Minitest::Mock.new
test_data_source.expect(:kind_of?, true, [DataSource])
diff --git a/test/tc_with_offset.rb b/test/tc_with_offset.rb
index ed52f833..b5dfc72f 100644
--- a/test/tc_with_offset.rb
+++ b/test/tc_with_offset.rb
@@ -3,9 +3,9 @@
require_relative 'test_utils'
-include TZInfo
-
class TCWithOffset < Minitest::Test
+ include TZInfo
+
class TestBaseClass
attr_reader :format
attr_accessor :strftime_result
@@ -17,7 +17,7 @@ def strftime(format)
end
class TestClass < TestBaseClass
- include WithOffset
+ include TZInfo::WithOffset
attr_accessor :timezone_offset
diff --git a/test/test_utils.rb b/test/test_utils.rb
index 4dca87b5..ec83bf30 100644
--- a/test/test_utils.rb
+++ b/test/test_utils.rb
@@ -210,11 +210,11 @@ def type
end
def time(year, month, day, hour, minute, second, sub_second = 0, utc_offset = nil)
- Timestamp.create(year, month, day, hour, minute, second, sub_second, utc_offset)
+ TZInfo::Timestamp.create(year, month, day, hour, minute, second, sub_second, utc_offset)
end
def time_with_offset(offset, year, month, day, hour, minute, second, sub_second = 0)
- TimestampWithOffset.create(year, month, day, hour, minute, second, sub_second, offset.observed_utc_offset).set_timezone_offset(offset)
+ TZInfo::TimestampWithOffset.create(year, month, day, hour, minute, second, sub_second, offset.observed_utc_offset).set_timezone_offset(offset)
end
end
@@ -499,7 +499,7 @@ def assert_equal_with_offset(expected, actual)
# equal.
def assert_equal_with_offset_and_timezone_offset(expected, actual)
assert_equal_with_offset(expected, actual)
- assert_kind_of(TimezoneOffset, actual.timezone_offset)
+ assert_kind_of(TZInfo::TimezoneOffset, actual.timezone_offset)
assert_equal(expected.timezone_offset, actual.timezone_offset)
end
diff --git a/test/ts_all.rb b/test/ts_all.rb
index 93fab598..0dfb3347 100644
--- a/test/ts_all.rb
+++ b/test/ts_all.rb
@@ -7,4 +7,4 @@
Dir[File.join(File.expand_path(File.dirname(__FILE__)), '**', 'tc_*.rb')].each {|t| require t}
-puts "Using #{DataSource.get}"
+puts "Using #{TZInfo::DataSource.get}"