From 97a92a4cfddf819357ca09b4a91a5937b044e4d8 Mon Sep 17 00:00:00 2001 From: Leigh Caplan Date: Mon, 28 Jun 2010 14:04:11 -0300 Subject: test that unknown zones don't store mapping keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#4942] Signed-off-by: Santiago Pastorino Signed-off-by: José Valim --- activesupport/test/time_zone_test.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 620623b389..922449988b 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -285,6 +285,11 @@ class TimeZoneTest < Test::Unit::TestCase assert_equal(-21_600, zone.utc_offset) end + def test_unknown_zones_dont_store_mapping_keys + ActiveSupport::TimeZone["bogus"] + assert !ActiveSupport::TimeZone.zones_map.key?("bogus") + end + def test_new assert_equal ActiveSupport::TimeZone["Central Time (US & Canada)"], ActiveSupport::TimeZone.new("Central Time (US & Canada)") end -- cgit v1.2.3 From b2633f9f9323f5d5eca1c2c94bb7ae88ad276cda Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 28 Jun 2010 14:01:48 -0300 Subject: Don't store incorrect values in zones_map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#4942 state:committed] Signed-off-by: José Valim --- activesupport/test/core_ext/time_with_zone_test.rb | 4 +--- activesupport/test/time_zone_test.rb | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index cf11f4d28f..5ce4277672 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -832,9 +832,7 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < Test::Unit::TestCase def test_time_zone_setter_with_invalid_zone Time.zone = 'foo' - assert_not_nil Time.zone - assert_equal 'foo', Time.zone.name - assert_raise(TZInfo::InvalidTimezoneIdentifier) { Time.zone.utc_offset } + assert_nil Time.zone Time.zone = -15.hours assert_nil Time.zone diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb index 922449988b..af6eee69e5 100644 --- a/activesupport/test/time_zone_test.rb +++ b/activesupport/test/time_zone_test.rb @@ -268,7 +268,7 @@ class TimeZoneTest < Test::Unit::TestCase end def test_index - assert_not_nil ActiveSupport::TimeZone["bogus"] + assert_nil ActiveSupport::TimeZone["bogus"] assert_instance_of ActiveSupport::TimeZone, ActiveSupport::TimeZone["Central Time (US & Canada)"] assert_instance_of ActiveSupport::TimeZone, ActiveSupport::TimeZone[8] assert_raise(ArgumentError) { ActiveSupport::TimeZone[false] } -- cgit v1.2.3 From 16cef77d37ffe3e2cdc6f7db76b4ae59ce4cbc5b Mon Sep 17 00:00:00 2001 From: James MacAulay Date: Tue, 18 May 2010 15:19:53 -0400 Subject: Fix AS::MB::Chars#+ to not alter self [#4646 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activesupport/test/multibyte_chars_test.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 602828ef5f..66aa22ec20 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -49,13 +49,15 @@ class MultibyteCharsTest < Test::Unit::TestCase end def test_should_concatenate - assert_equal 'ab', 'a'.mb_chars + 'b' - assert_equal 'ab', 'a' + 'b'.mb_chars - assert_equal 'ab', 'a'.mb_chars + 'b'.mb_chars - - assert_equal 'ab', 'a'.mb_chars << 'b' - assert_equal 'ab', 'a' << 'b'.mb_chars - assert_equal 'ab', 'a'.mb_chars << 'b'.mb_chars + mb_a = 'a'.mb_chars + mb_b = 'b'.mb_chars + assert_equal 'ab', mb_a + 'b' + assert_equal 'ab', 'a' + mb_b + assert_equal 'ab', mb_a + mb_b + + assert_equal 'ab', mb_a << 'b' + assert_equal 'ab', 'a' << mb_b + assert_equal 'abb', mb_a << mb_b end def test_consumes_utf8_strings -- cgit v1.2.3 From 265b7c5edfe9b60d1ab547bfef569d94df05b8e9 Mon Sep 17 00:00:00 2001 From: Alex Muntean Date: Fri, 28 May 2010 13:22:29 +0900 Subject: Fix ActiveSupport::Multibyte::Chars#slice for empty strings when starting offset is negative [#4717 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Valim --- activesupport/test/multibyte_chars_test.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/test') diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 66aa22ec20..610295fa89 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -397,6 +397,7 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase assert_equal 'こ', @chars.slice(0) assert_equal 'わ', @chars.slice(3) assert_equal nil, ''.mb_chars.slice(-1..1) + assert_equal nil, ''.mb_chars.slice(-1, 1) assert_equal '', ''.mb_chars.slice(0..10) assert_equal 'にちわ', @chars.slice(1..3) assert_equal 'にちわ', @chars.slice(1, 3) -- cgit v1.2.3