Upgrade to Rails 2.0.2
Upgraded to Rails 2.0.2, except that we maintain vendor/rails/actionpack/lib/action_controller/routing.rb from Rail 1.2.6 (at least for now), so that Routes don't change. We still get to enjoy Rails's many new features. Also fixed a bug in Chunk-handling: disable WikiWord processing in tags (for real this time).
This commit is contained in:
parent
0f6889e09f
commit
6873fc8026
1083 changed files with 52810 additions and 41058 deletions
|
@ -15,7 +15,7 @@ module UTF8HandlingTest
|
|||
# This is an ASCII string with some russian strings and a ligature. It's nicely calibrated, because
|
||||
# slicing it at some specific bytes will kill your characters if you use standard Ruby routines.
|
||||
# It has both capital and standard letters, so that we can test case conversions easily.
|
||||
# It has 26 charactes and 28 when the ligature gets split during normalization.
|
||||
# It has 26 characters and 28 when the ligature gets split during normalization.
|
||||
@string = "Abcd Блå ffi бла бла бла бла"
|
||||
@string_kd = "Abcd Блå ffi бла бла бла бла"
|
||||
@string_kc = "Abcd Блå ffi бла бла бла бла"
|
||||
|
@ -69,7 +69,7 @@ module UTF8HandlingTest
|
|||
assert_raise(ActiveSupport::Multibyte::Handlers::EncodingError) { @handler.normalize(@bytestring) }
|
||||
end
|
||||
|
||||
# Test for the Public Review Issue #29, bad explaination of composition might lead to a
|
||||
# Test for the Public Review Issue #29, bad explanation of composition might lead to a
|
||||
# bad implementation: http://www.unicode.org/review/pr-29.html
|
||||
def test_normalization_C_pri_29
|
||||
[
|
||||
|
@ -160,8 +160,16 @@ module UTF8HandlingTest
|
|||
assert_equal "d Блå ffi", @handler.slice(@string, 3, 7), "Unicode characters have to be returned"
|
||||
assert_equal "A", @handler.slice(@string, 0, 1), "Slicing from an offset should return characters"
|
||||
assert_equal " Блå ffi ", @handler.slice(@string, 4..10), "Unicode characters have to be returned"
|
||||
assert_equal "ffi бла", @handler.slice(@string, /ffi бла/u), "Slicing on Regexps should be supported"
|
||||
assert_equal "ffi бла", @handler.slice(@string, /ffi \w\wа/u), "Slicing on Regexps should be supported"
|
||||
assert_equal nil, @handler.slice(@string, /unknown/u), "Slicing on Regexps with no match should return nil"
|
||||
assert_equal "ffi бла", @handler.slice(@string, /(ffi бла)/u,1), "Slicing on Regexps with a match group should be supported"
|
||||
assert_equal nil, @handler.slice(@string, /(ffi)/u,2), "Slicing with a Regexp and asking for an invalid match group should return nil"
|
||||
assert_equal "", @handler.slice(@string, 7..6), "Range is empty, should return an empty string"
|
||||
assert_raise(ActiveSupport::Multibyte::Handlers::EncodingError) { @handler.slice(@bytestring, 2..3) }
|
||||
assert_raise(TypeError, "With 2 args, should raise TypeError for non-Numeric or Regexp first argument") { @handler.slice(@string, 2..3, 1) }
|
||||
assert_raise(TypeError, "With 2 args, should raise TypeError for non-Numeric or Regexp second argument") { @handler.slice(@string, 1, 2..3) }
|
||||
assert_raise(ArgumentError, "Should raise ArgumentError when there are more than 2 args") { @handler.slice(@string, 1, 1, 1) }
|
||||
end
|
||||
|
||||
def test_grapheme_cluster_length
|
||||
|
@ -196,6 +204,91 @@ module UTF8HandlingTest
|
|||
assert_raise(ActiveSupport::Multibyte::Handlers::EncodingError) { @handler.index(@bytestring, "\010") }
|
||||
end
|
||||
|
||||
def test_indexed_insert
|
||||
s = "Καλη!"
|
||||
@handler[s, 2] = "a"
|
||||
assert_equal "Καaη!", s
|
||||
@handler[s, 2] = "ηη"
|
||||
assert_equal "Καηηη!", s
|
||||
assert_raises(IndexError) { @handler[s, 10] = 'a' }
|
||||
assert_equal "Καηηη!", s
|
||||
@handler[s, 2] = 32
|
||||
assert_equal "Κα ηη!", s
|
||||
@handler[s, 3, 2] = "λλλ"
|
||||
assert_equal "Κα λλλ!", s
|
||||
@handler[s, 1, 0] = "λ"
|
||||
assert_equal "Κλα λλλ!", s
|
||||
assert_raises(IndexError) { @handler[s, 10, 4] = 'a' }
|
||||
assert_equal "Κλα λλλ!", s
|
||||
@handler[s, 4..6] = "ηη"
|
||||
assert_equal "Κλα ηη!", s
|
||||
assert_raises(RangeError) { @handler[s, 10..12] = 'a' }
|
||||
assert_equal "Κλα ηη!", s
|
||||
@handler[s, /ηη/] = "λλλ"
|
||||
assert_equal "Κλα λλλ!", s
|
||||
assert_raises(IndexError) { @handler[s, /ii/] = 'a' }
|
||||
assert_equal "Κλα λλλ!", s
|
||||
@handler[s, /(λλ)(.)/, 2] = "α"
|
||||
assert_equal "Κλα λλα!", s
|
||||
assert_raises(IndexError) { @handler[s, /()/, 10] = 'a' }
|
||||
assert_equal "Κλα λλα!", s
|
||||
@handler[s, "α"] = "η"
|
||||
assert_equal "Κλη λλα!", s
|
||||
@handler[s, "λλ"] = "ααα"
|
||||
assert_equal "Κλη αααα!", s
|
||||
end
|
||||
|
||||
def test_rjust
|
||||
s = "Καη"
|
||||
assert_raises(ArgumentError) { @handler.rjust(s, 10, '') }
|
||||
assert_raises(ArgumentError) { @handler.rjust(s) }
|
||||
assert_equal "Καη", @handler.rjust(s, -3)
|
||||
assert_equal "Καη", @handler.rjust(s, 0)
|
||||
assert_equal "Καη", @handler.rjust(s, 3)
|
||||
assert_equal " Καη", @handler.rjust(s, 5)
|
||||
assert_equal " Καη", @handler.rjust(s, 7)
|
||||
assert_equal "----Καη", @handler.rjust(s, 7, '-')
|
||||
assert_equal "ααααΚαη", @handler.rjust(s, 7, 'α')
|
||||
assert_equal "abaΚαη", @handler.rjust(s, 6, 'ab')
|
||||
assert_equal "αηαΚαη", @handler.rjust(s, 6, 'αη')
|
||||
end
|
||||
|
||||
def test_ljust
|
||||
s = "Καη"
|
||||
assert_raises(ArgumentError) { @handler.ljust(s, 10, '') }
|
||||
assert_raises(ArgumentError) { @handler.ljust(s) }
|
||||
assert_equal "Καη", @handler.ljust(s, -3)
|
||||
assert_equal "Καη", @handler.ljust(s, 0)
|
||||
assert_equal "Καη", @handler.ljust(s, 3)
|
||||
assert_equal "Καη ", @handler.ljust(s, 5)
|
||||
assert_equal "Καη ", @handler.ljust(s, 7)
|
||||
assert_equal "Καη----", @handler.ljust(s, 7, '-')
|
||||
assert_equal "Καηαααα", @handler.ljust(s, 7, 'α')
|
||||
assert_equal "Καηaba", @handler.ljust(s, 6, 'ab')
|
||||
assert_equal "Καηαηα", @handler.ljust(s, 6, 'αη')
|
||||
end
|
||||
|
||||
def test_center
|
||||
s = "Καη"
|
||||
assert_raises(ArgumentError) { @handler.center(s, 10, '') }
|
||||
assert_raises(ArgumentError) { @handler.center(s) }
|
||||
assert_equal "Καη", @handler.center(s, -3)
|
||||
assert_equal "Καη", @handler.center(s, 0)
|
||||
assert_equal "Καη", @handler.center(s, 3)
|
||||
assert_equal "Καη ", @handler.center(s, 4)
|
||||
assert_equal " Καη ", @handler.center(s, 5)
|
||||
assert_equal " Καη ", @handler.center(s, 6)
|
||||
assert_equal "--Καη--", @handler.center(s, 7, '-')
|
||||
assert_equal "--Καη---", @handler.center(s, 8, '-')
|
||||
assert_equal "ααΚαηαα", @handler.center(s, 7, 'α')
|
||||
assert_equal "ααΚαηααα", @handler.center(s, 8, 'α')
|
||||
assert_equal "aΚαηab", @handler.center(s, 6, 'ab')
|
||||
assert_equal "abΚαηab", @handler.center(s, 7, 'ab')
|
||||
assert_equal "ababΚαηabab", @handler.center(s, 11, 'ab')
|
||||
assert_equal "αΚαηαη", @handler.center(s, 6, 'αη')
|
||||
assert_equal "αηΚαηαη", @handler.center(s, 7, 'αη')
|
||||
end
|
||||
|
||||
def test_strip
|
||||
# A unicode aware version of strip should strip all 26 types of whitespace. This includes the NO BREAK SPACE
|
||||
# aka BOM (byte order mark). The byte order mark has no place in UTF-8 because it's used to detect LE and BE.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue