diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-06 03:56:38 +0000 |
commit | 287a34ae0dfc23e4158f67cb7783d239f202c368 (patch) | |
tree | 5e35d5b41aae961b37cf6632f60c42f51c7aa775 /test/ruby | |
parent | 9b52ae2e6491bb5d6c59e1799449f6268baf6f89 (diff) | |
download | ruby-287a34ae0dfc23e4158f67cb7783d239f202c368.tar.gz |
* {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
29 files changed, 187 insertions, 187 deletions
diff --git a/test/ruby/allpairs.rb b/test/ruby/allpairs.rb index 393d0c3288..6cb2729b19 100644 --- a/test/ruby/allpairs.rb +++ b/test/ruby/allpairs.rb @@ -26,7 +26,7 @@ module AllPairs yield row } } - end + end def combine_block(tbl1, tbl2) result = [] @@ -49,7 +49,7 @@ module AllPairs tbl = [] make_basic_block(v) {|row| tbl << row - } + } tbls = [tbl] while tbl.first.length ** 2 < prime tbl = combine_block(tbl, tbl) diff --git a/test/ruby/envutil.rb b/test/ruby/envutil.rb index 4aba8a0bde..6900d03b70 100644 --- a/test/ruby/envutil.rb +++ b/test/ruby/envutil.rb @@ -4,7 +4,7 @@ require "timeout" module EnvUtil def rubybin unless ENV["RUBYOPT"] - + end if ruby = ENV["RUBY"] return ruby diff --git a/test/ruby/marshaltestlib.rb b/test/ruby/marshaltestlib.rb index 4486a78429..5da7ad95dc 100644 --- a/test/ruby/marshaltestlib.rb +++ b/test/ruby/marshaltestlib.rb @@ -290,7 +290,7 @@ module MarshalTestLib class MyStruct def ==(rhs) return true if __id__ == rhs.__id__ - return false unless rhs.is_a?(::Struct) + return false unless rhs.is_a?(::Struct) return false if self.class != rhs.class members.each do |member| return false if self.__send__(member) != rhs.__send__(member) @@ -483,7 +483,7 @@ module MarshalTestLib class MyStruct2 def ==(rhs) return true if __id__ == rhs.__id__ - return false unless rhs.is_a?(::Struct) + return false unless rhs.is_a?(::Struct) return false if self.class != rhs.class members.each do |member| return false if self.__send__(member) != rhs.__send__(member) diff --git a/test/ruby/test_alias.rb b/test/ruby/test_alias.rb index d72fe702af..10fd8f1112 100644 --- a/test/ruby/test_alias.rb +++ b/test/ruby/test_alias.rb @@ -45,7 +45,7 @@ class TestAlias < Test::Unit::TestCase assert_equal "foo", x.bar assert_raise(NoMethodError) { x.quux } end - + class C def m $SAFE diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index d21cad0851..92c309241f 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -125,27 +125,27 @@ class TestArray < Test::Unit::TestCase def test_beg_end_0 x = [1, 2, 3, 4, 5] - + assert_equal(1, x.first) assert_equal([1], x.first(1)) assert_equal([1, 2, 3], x.first(3)) - + assert_equal(5, x.last) assert_equal([5], x.last(1)) assert_equal([3, 4, 5], x.last(3)) - + assert_equal(1, x.shift) assert_equal([2, 3, 4], x.shift(3)) assert_equal([5], x) - + assert_equal([2, 3, 4, 5], x.unshift(2, 3, 4)) assert_equal([1, 2, 3, 4, 5], x.unshift(1)) assert_equal([1, 2, 3, 4, 5], x) - + assert_equal(5, x.pop) assert_equal([3, 4], x.pop(2)) assert_equal([1, 2], x) - + assert_equal([1, 2, 3, 4], x.push(3, 4)) assert_equal([1, 2, 3, 4, 5], x.push(5)) assert_equal([1, 2, 3, 4, 5], x) @@ -318,7 +318,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[10, 11, 12], a[9..11]) assert_equal(@cls[10, 11, 12], a[-91..-89]) - + assert_nil(a[10, -3]) # Ruby 1.8 feature change: # Array#[size..x] returns [] instead of nil. @@ -487,7 +487,7 @@ class TestArray < Test::Unit::TestCase a = @cls[ 1, 'cat', 1..1 ] assert_equal([ Fixnum, String, Range], a.collect! {|e| e.class} ) assert_equal([ Fixnum, String, Range], a) - + a = @cls[ 1, 'cat', 1..1 ] assert_equal([ 99, 99, 99], a.collect! { 99 } ) assert_equal([ 99, 99, 99], a) @@ -535,7 +535,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[1, 2, 3, 4], @cls[1, 2, 3, 4].concat(@cls[])) assert_equal(@cls[], @cls[].concat(@cls[])) assert_equal(@cls[@cls[1, 2], @cls[3, 4]], @cls[@cls[1, 2]].concat(@cls[@cls[3, 4]])) - + a = @cls[1, 2, 3] a.concat(a) assert_equal([1, 2, 3, 1, 2, 3], a) @@ -708,7 +708,7 @@ class TestArray < Test::Unit::TestCase a5 = @cls[ a1, @cls[], a3 ] assert_equal(@cls[1, 2, 3, 4, 5, 6], a5.flatten) assert_equal(@cls[], @cls[].flatten) - assert_equal(@cls[], + assert_equal(@cls[], @cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten) assert_raise(TypeError, "[ruby-dev:31197]") { [[]].flatten("") } @@ -734,7 +734,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[1, 2, 3, 4, 5, 6], a5) assert_equal(@cls[], @cls[].flatten) - assert_equal(@cls[], + assert_equal(@cls[], @cls[@cls[@cls[@cls[],@cls[]],@cls[@cls[]],@cls[]],@cls[@cls[@cls[]]]].flatten) end @@ -839,7 +839,7 @@ class TestArray < Test::Unit::TestCase a = @cls[ 1, 'cat', 1..1 ] assert_equal(@cls[ Fixnum, String, Range], a.map! {|e| e.class} ) assert_equal(@cls[ Fixnum, String, Range], a) - + a = @cls[ 1, 'cat', 1..1 ] assert_equal(@cls[ 99, 99, 99], a.map! { 99 } ) assert_equal(@cls[ 99, 99, 99], a) @@ -880,11 +880,11 @@ class TestArray < Test::Unit::TestCase assert_equal("ABC", @cls[ 65, 66, 67 ].pack("c3")) assert_equal("\377BC", @cls[ -1, 66, 67 ].pack("c*")) - + assert_equal("AB\n\x10", @cls["4142", "0a", "12"].pack("H4H2H1")) assert_equal("AB\n\x02", @cls["1424", "a0", "21"].pack("h4h2h1")) - assert_equal("abc=02def=\ncat=\n=01=\n", + assert_equal("abc=02def=\ncat=\n=01=\n", @cls["abc\002def", "cat", "\001"].pack("M9M3M4")) assert_equal("aGVsbG8K\n", @cls["hello\n"].pack("m")) @@ -1086,7 +1086,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[10, 11, 12], a.slice(9..11)) assert_equal(@cls[10, 11, 12], a.slice(-91..-89)) - + assert_nil(a.slice(-101..-1)) assert_nil(a.slice(10, -3)) @@ -1144,7 +1144,7 @@ class TestArray < Test::Unit::TestCase a.fill(1) assert_equal(@cls[1, 1, 1, 1], a.sort) - + assert_equal(@cls[], @cls[].sort) end @@ -1302,7 +1302,7 @@ class TestArray < Test::Unit::TestCase assert_equal(@cls[[1,1],[1,2],[2,1],[2,2]], @cls[1,2].product([1,2])) assert_equal(@cls[[1,3,5],[1,3,6],[1,4,5],[1,4,6], - [2,3,5],[2,3,6],[2,4,5],[2,4,6]], + [2,3,5],[2,3,6],[2,4,5],[2,4,6]], @cls[1,2].product([3,4],[5,6])) assert_equal(@cls[[1],[2]], @cls[1,2].product) assert_equal(@cls[], @cls[1,2].product([])) diff --git a/test/ruby/test_basicinstructions.rb b/test/ruby/test_basicinstructions.rb index 6ac93e037a..b3145be8b5 100644 --- a/test/ruby/test_basicinstructions.rb +++ b/test/ruby/test_basicinstructions.rb @@ -7,7 +7,7 @@ class Class end class TestBasicInstructions < Test::Unit::TestCase - + def test_immediates assert_equal((1==1), true) assert_equal((1==2), false) @@ -30,7 +30,7 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal false, (self == nil) assert_equal false, (self == 0) end - + def test_string expected = "str" + "ing" assert_equal expected, 'string' @@ -55,14 +55,14 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal :sym, :"#{s}" assert_equal :sym, :"#{"#{"#{s}"}"}" end - + def test_xstr assert_equal 'hoge', `echo hoge`.chomp assert_equal '3', `echo #{1 + 2}`.chomp hoge = 'huga' assert_equal 'huga', `echo #{hoge}`.chomp end - + def test_regexp assert_equal /test/, /test/ assert_equal 'test', /test/.source @@ -108,7 +108,7 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal 'c', a[2] assert_nil a[3] end - + def test_hash assert_equal({}, {}) assert_equal({1=>2}, {1=>2}) @@ -127,7 +127,7 @@ class TestBasicInstructions < Test::Unit::TestCase assert_equal((1...3), (1...2+1)) assert_equal(('a'..'z'), ('a'..'z')) end - + def test_not assert_equal true, !nil assert_equal true, !false diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index 0f1d18a8e5..031efdd7d1 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -22,7 +22,7 @@ class TestEncodingConverter < Test::Unit::TestCase def assert_errinfo(e_res, e_enc1, e_enc2, e_error_bytes, e_readagain_bytes, ec) assert_equal([e_res, e_enc1, e_enc2, - e_error_bytes && e_error_bytes.dup.force_encoding("ASCII-8BIT"), + e_error_bytes && e_error_bytes.dup.force_encoding("ASCII-8BIT"), e_readagain_bytes && e_readagain_bytes.dup.force_encoding("ASCII-8BIT")], ec.primitive_errinfo) end @@ -450,13 +450,13 @@ class TestEncodingConverter < Test::Unit::TestCase def test_errinfo_invalid_euc_jp ec = Encoding::Converter.new("EUC-JP", "Shift_JIS") - ec.primitive_convert(src="\xff", dst="", nil, 10) + ec.primitive_convert(src="\xff", dst="", nil, 10) assert_errinfo(:invalid_byte_sequence, "EUC-JP", "Shift_JIS", "\xFF", "", ec) end def test_errinfo_invalid_euc_jp2 ec = Encoding::Converter.new("EUC-JP", "ISO-8859-1") - ec.primitive_convert(src="\xff", dst="", nil, 10) + ec.primitive_convert(src="\xff", dst="", nil, 10) assert_errinfo(:invalid_byte_sequence, "EUC-JP", "UTF-8", "\xFF", "", ec) end @@ -504,7 +504,7 @@ class TestEncodingConverter < Test::Unit::TestCase assert_equal(nil, ec.insert_output("\xA1\xA1".force_encoding("EUC-JP"))) ec.primitive_convert("", dst, nil, 10, :partial_input=>true) - assert_equal("\e$B!!\e(B???\e$B!\"!!".force_encoding("ISO-2022-JP"), dst) + assert_equal("\e$B!!\e(B???\e$B!\"!!".force_encoding("ISO-2022-JP"), dst) ec.primitive_convert(src="\xa1\xa3", dst, nil, 10, :partial_input=>true) assert_equal("\e$B!!\e(B???\e$B!\"!!!\#".force_encoding("ISO-2022-JP"), dst) @@ -722,9 +722,9 @@ class TestEncodingConverter < Test::Unit::TestCase end def test_econv_new_hash - ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace) + ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace) assert_equal("a ? b", ec.convert("a \u3042 b")) - ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace, :replace => "X") + ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace, :replace => "X") assert_equal("a X b", ec.convert("a \u3042 b")) end diff --git a/test/ruby/test_encoding.rb b/test/ruby/test_encoding.rb index 9f48d30d1d..6e442b564b 100644 --- a/test/ruby/test_encoding.rb +++ b/test/ruby/test_encoding.rb @@ -14,7 +14,7 @@ class TestEncoding < Test::Unit::TestCase assert_equal(e, Encoding.find(e.name.downcase)) end end - + def test_enc_names aliases = Encoding.aliases aliases.each do |a, en| @@ -32,7 +32,7 @@ class TestEncoding < Test::Unit::TestCase assert_raise(TypeError) { e.dup } assert_raise(TypeError) { e.clone } assert_equal(e.object_id, Marshal.load(Marshal.dump(e)).object_id) - end + end end def test_find diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index 2f4b0bfbbd..6dd40bed84 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -204,7 +204,7 @@ class TestEval < Test::Unit::TestCase end end - # + # # From ruby/test/ruby/test_eval.rb # diff --git a/test/ruby/test_fiber.rb b/test/ruby/test_fiber.rb index 536d358dd0..6d64ccf72b 100644 --- a/test/ruby/test_fiber.rb +++ b/test/ruby/test_fiber.rb @@ -137,7 +137,7 @@ class TestFiber < Test::Unit::TestCase end def test_tls - # + # def tvar(var, val) old = Thread.current[var] begin diff --git a/test/ruby/test_file_exhaustive.rb b/test/ruby/test_file_exhaustive.rb index d9fe5505fe..7ed2abb563 100644 --- a/test/ruby/test_file_exhaustive.rb +++ b/test/ruby/test_file_exhaustive.rb @@ -34,7 +34,7 @@ class TestFileExhaustive < Test::Unit::TestCase def make_file(content, file = @file) open(file, "w") {|fh| fh << content } end - + def make_tmp_filename(prefix) @hardlinkfile = @dir + "/" + prefix + File.basename(__FILE__) + ".#{$$}.test" end diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 42b249d0dc..1bd3df4c1a 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -10,7 +10,7 @@ class TestGc < Test::Unit::TestCase def test_gc prev_stress = GC.stress GC.stress = false - + assert_nothing_raised do 1.upto(10000) { tmp = [0,1,2,3,4,5,6,7,8,9] diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb index 06f3b7c6e5..77084f216f 100644 --- a/test/ruby/test_hash.rb +++ b/test/ruby/test_hash.rb @@ -113,7 +113,7 @@ class TestHash < Test::Unit::TestCase assert_instance_of(@cls, h) assert_equal('default', h.default) assert_equal('default', h['spurious']) - + end def test_AREF # '[]' @@ -539,7 +539,7 @@ class TestHash < Test::Unit::TestCase def test_shift h = @h.dup - + @h.length.times { k, v = h.shift assert(@h.key?(k)) diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 678a74a1d0..91da8c03c1 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1195,13 +1195,13 @@ class TestIO < Test::Unit::TestCase def test_sysopen t = make_tempfile - + fd = IO.sysopen(t.path) assert_kind_of(Integer, fd) f = IO.for_fd(fd) assert_equal("foo\nbar\nbaz\n", f.read) f.close - + fd = IO.sysopen(t.path, "w", 0666) assert_kind_of(Integer, fd) if defined?(Fcntl::F_GETFL) @@ -1211,7 +1211,7 @@ class TestIO < Test::Unit::TestCase end f.write("FOO\n") f.close - + fd = IO.sysopen(t.path, "r") assert_kind_of(Integer, fd) f = IO.for_fd(fd) @@ -1360,7 +1360,7 @@ class TestIO < Test::Unit::TestCase def test_initialize t = make_tempfile - + fd = IO.sysopen(t.path, "w") assert_kind_of(Integer, fd) f = IO.new(fd, "w") @@ -1374,7 +1374,7 @@ class TestIO < Test::Unit::TestCase f.instance_eval { initialize } end end - + def test_new_with_block assert_in_out_err([], "r, w = IO.pipe; IO.new(r) {}", [], /^.+$/) end diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index 71299181ec..ce942a8528 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -576,7 +576,7 @@ EOT with_pipe(enc) {|r, w| w << "\xc2\xa1" w.close - s = r.getc + s = r.getc assert_equal(enc, s.encoding) } } @@ -897,7 +897,7 @@ EOT STDIN.reopen(io) STDIN.external_encoding STDIN.write "\u3042" - STDIN.flush + STDIN.flush End Process.wait pid f.rewind @@ -1360,7 +1360,7 @@ EOT } content = File.read("t", :mode=>"rb:ascii-8bit") assert_equal(expected.dup.force_encoding("ascii-8bit"), - content.force_encoding("ascii-8bit")) + content.force_encoding("ascii-8bit")) } end diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 2f435f645a..efdc20c186 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -960,8 +960,8 @@ class TestM17N < Test::Unit::TestCase end def test_sub2 - s = "\x80".force_encoding("ASCII-8BIT") - r = Regexp.new("\x80".force_encoding("ASCII-8BIT")) + s = "\x80".force_encoding("ASCII-8BIT") + r = Regexp.new("\x80".force_encoding("ASCII-8BIT")) s2 = s.sub(r, "") assert(s2.empty?) assert(s2.ascii_only?) diff --git a/test/ruby/test_m17n_comb.rb b/test/ruby/test_m17n_comb.rb index 7d6794292b..2d43a56ab2 100644 --- a/test/ruby/test_m17n_comb.rb +++ b/test/ruby/test_m17n_comb.rb @@ -709,7 +709,7 @@ class TestM17NComb < Test::Unit::TestCase def test_str_chomp combination(STRINGS, STRINGS) {|s1, s2| if !s1.ascii_only? && !s2.ascii_only? && !Encoding.compatible?(s1,s2) - if s1.bytesize > s2.bytesize + if s1.bytesize > s2.bytesize assert_raise(Encoding::CompatibilityError) { s1.chomp(s2) } end next diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index e1f7299636..37336a08a6 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -100,7 +100,7 @@ class TestModule < Test::Unit::TestCase def AClass.cm3 "cm3" end - + private_class_method :cm1, "cm3" def aClass diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index e5c9b77ac1..5dc3caf561 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -20,7 +20,7 @@ class TestParse < Test::Unit::TestCase END assert_equal(42, x) end - + def test_alias_backref assert_raise(SyntaxError) do eval <<-END @@ -193,7 +193,7 @@ class TestParse < Test::Unit::TestCase class foo; end END end - + assert_raise(SyntaxError) do eval <<-END def foo @@ -350,7 +350,7 @@ class TestParse < Test::Unit::TestCase def test_words assert_equal([], %W( )) end - + def test_dstr @@foo = 1 assert_equal("foo 1 bar", "foo #@@foo bar") diff --git a/test/ruby/test_primitive.rb b/test/ruby/test_primitive.rb index 8ffbe549d6..46133eff8c 100644 --- a/test/ruby/test_primitive.rb +++ b/test/ruby/test_primitive.rb @@ -1,7 +1,7 @@ require 'test/unit' class TestRubyPrimitive < Test::Unit::TestCase - + def test_not assert_equal false, !true assert_equal true, !false @@ -143,7 +143,7 @@ class TestRubyPrimitive < Test::Unit::TestCase assert_equal 7, ($test_ruby_primitive_gvar = 7) assert_equal 7, ($test_ruby_primitive_gvar = 7) end - + class A7 @@c = 1 def m @@ -184,7 +184,7 @@ class TestRubyPrimitive < Test::Unit::TestCase assert_equal 3, A9.m assert_equal 4, A9.m end - + class A10 attr_accessor :a end @@ -257,7 +257,7 @@ class TestRubyPrimitive < Test::Unit::TestCase h[0] &&= 1 assert_equal 1, h[0] end - + def test_backref /a(b)(c)d/ =~ 'xyzabcdefgabcdefg' assert_equal 'b', $1 diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 8322fb1722..cb0548ba66 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -177,7 +177,7 @@ class TestProc < Test::Unit::TestCase b = proc { :foo } assert_equal(:foo, b.curry[]) end - + def test_curry_ski_fib s = proc {|f, g, x| f[x][g[x]] }.curry k = proc {|x, y| x }.curry @@ -292,7 +292,7 @@ class TestProc < Test::Unit::TestCase b2 = b1.dup assert(b1 == b2) end - + def test_to_proc b = proc { :foo } assert_equal(:foo, b.to_proc.call) @@ -687,7 +687,7 @@ class TestProc < Test::Unit::TestCase assert_equal([[:opt, :a], [:rest, :b], [:opt, :c], [:block, :d]], proc {|a, *b, c, &d|}.parameters) assert_equal([[:opt, :a], [:opt, :b], [:rest, :c], [:opt, :d], [:block, :e]], proc {|a, b=:b, *c, d, &e|}.parameters) assert_equal([[:opt, nil], [:block, :b]], proc {|(a), &b|}.parameters) - assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters) + assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters) end def pm0() end diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 793771017e..7058834fa6 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -467,9 +467,9 @@ class TestProcess < Test::Unit::TestCase assert_equal("errout", File.read("out")) Process.wait spawn(RUBY, "-e", "STDERR.print 'err'; STDOUT.print 'out'", - STDOUT=>"out", + STDOUT=>"out", STDERR=>[:child, 3], - 3=>[:child, 4], + 3=>[:child, 4], 4=>[:child, STDOUT] ) assert_equal("errout", File.read("out")) diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index bf3861e74d..ee9c2144f3 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -22,7 +22,7 @@ class TestString < Test::Unit::TestCase def test_s_new assert_equal("RUBY", S("RUBY")) end - + def test_AREF # '[]' assert_equal("A", S("AooBar")[0]) assert_equal("B", S("FooBaB")[-1]) @@ -224,7 +224,7 @@ class TestString < Test::Unit::TestCase assert_equal(10, S("FeeFieFoo-Fum") =~ /Fum$/) assert_equal(nil, S("FeeFieFoo-Fum") =~ /FUM$/) - pre_1_7_1 do + pre_1_7_1 do $= = true assert_equal(10, S("FeeFieFoo-Fum") =~ /FUM$/) $= = false @@ -279,7 +279,7 @@ class TestString < Test::Unit::TestCase def test_VERY_EQUAL # '===' # assert_equal(true, S("foo") === :foo) casetest(S("abcdef"), S("abcdef")) - + pre_1_7_1 do $= = true casetest(S("CAT"), S('cat')) @@ -317,7 +317,7 @@ class TestString < Test::Unit::TestCase b = a.dup assert_equal(S("Hello"), a.capitalize!) assert_equal(S("hello"), b) - + end def test_center @@ -551,7 +551,7 @@ class TestString < Test::Unit::TestCase a.taint if taint a.untrust if untrust a.freeze if frozen - b = a.dup + b = a.dup assert_equal(a, b) assert(a.__id__ != b.__id__) @@ -560,7 +560,7 @@ class TestString < Test::Unit::TestCase assert_equal(a.untrusted?, b.untrusted?) end end - end + end end def test_each @@ -570,12 +570,12 @@ class TestString < Test::Unit::TestCase S("hello\nworld").lines.each {|x| res << x} assert_equal(S("hello\n"), res[0]) assert_equal(S("world"), res[1]) - + res=[] S("hello\n\n\nworld").lines(S('')).each {|x| res << x} assert_equal(S("hello\n\n\n"), res[0]) assert_equal(S("world"), res[1]) - + $/ = "!" res=[] S("hello!world").lines.each {|x| res << x} @@ -604,14 +604,14 @@ class TestString < Test::Unit::TestCase S("hello\n\n\nworld").lines(S('')).each {|x| res << x} assert_equal(S("hello\n\n\n"), res[0]) assert_equal(S("world"), res[1]) - + $/ = "!" res=[] S("hello!world").lines.each {|x| res << x} assert_equal(S("hello!"), res[0]) assert_equal(S("world"), res[1]) - + $/ = save s = nil @@ -635,7 +635,7 @@ class TestString < Test::Unit::TestCase assert_equal(S("h<e>ll<o>"), S("hello").gsub(/([aeiou])/, S('<\1>'))) assert_equal(S("h e l l o "), S("hello").gsub(/./) { |s| s[0].to_s + S(' ')}) - assert_equal(S("HELL-o"), + assert_equal(S("HELL-o"), S("hello").gsub(/(hell)(.)/) { |s| $1.upcase + S('-') + $2 }) a = S("hello") @@ -672,8 +672,8 @@ class TestString < Test::Unit::TestCase r.taint r.untrust a.gsub!(/./, r) - assert(a.tainted?) - assert(a.untrusted?) + assert(a.tainted?) + assert(a.untrusted?) a = S("hello") assert_nil(a.sub!(S('X'), S('Y'))) @@ -983,12 +983,12 @@ class TestString < Test::Unit::TestCase assert_nil( a.slice!(6) ) else assert_raise(IndexError) { a.slice!(6) } - end + end assert_equal(S("FooBar"), a) if @aref_slicebang_silent - assert_nil( a.slice!(-7) ) - else + assert_nil( a.slice!(-7) ) + else assert_raise(IndexError) { a.slice!(-7) } end assert_equal(S("FooBar"), a) @@ -1239,8 +1239,8 @@ class TestString < Test::Unit::TestCase r.taint r.untrust a.sub!(/./, r) - assert(a.tainted?) - assert(a.untrusted?) + assert(a.tainted?) + assert(a.untrusted?) end def test_succ @@ -1494,7 +1494,7 @@ class TestString < Test::Unit::TestCase assert_equal([ 65, 66, 67 ], S("ABC").unpack("c3")) assert_equal([ -1, 66, 67 ], S("\377BC").unpack("c*")) - + assert_equal([S("4142"), S("0a"), S("1")], S("AB\n\x10").unpack(S("H4H2H1"))) assert_equal([S("1424"), S("a0"), S("2")], S("AB\n\x02").unpack(S("h4h2h1"))) @@ -1659,7 +1659,7 @@ class TestString < Test::Unit::TestCase end def test_respond_to - o = Object.new + o = Object.new def o.respond_to?(arg) [:to_str].include?(arg) ? nil : super end def o.to_str() "" end def o.==(other) "" == other end diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb index a19a78e605..f402da3907 100644 --- a/test/ruby/test_symbol.rb +++ b/test/ruby/test_symbol.rb @@ -69,7 +69,7 @@ class TestSymbol < Test::Unit::TestCase end def test_inspect_number - # 5) Inconsistency between :$0 and :$1? The first one is valid, but the + # 5) Inconsistency between :$0 and :$1? The first one is valid, but the # latter isn't. assert_inspect_evaled(':$0') assert_inspect_evaled(':$1') diff --git a/test/ruby/test_trace.rb b/test/ruby/test_trace.rb index 48294c9694..45bc599314 100644 --- a/test/ruby/test_trace.rb +++ b/test/ruby/test_trace.rb @@ -7,15 +7,15 @@ class TestTrace < Test::Unit::TestCase trace_var :$x, proc{$y = $x} $x = 40414 assert_equal($x, $y) - + untrace_var :$x $x = 19660208 assert_not_equal($x, $y) - + trace_var :$x, proc{$x *= 2} $x = 5 assert_equal(10, $x) - + untrace_var :$x end diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index b61d3d39db..0a4db06160 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -105,7 +105,7 @@ class TestTranscode < Test::Unit::TestCase all_ascii = (0..127).to_a.pack 'C*' encodings.each do |enc| test_start = all_ascii - assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) + assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) end end @@ -126,7 +126,7 @@ class TestTranscode < Test::Unit::TestCase all_bytes = (0..255).to_a.pack 'C*' encodings_8859.each do |enc| test_start = all_bytes - assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) + assert_equal(test_start, test_start.encode('UTF-8',enc).encode(enc).force_encoding('ASCII-8BIT')) end end @@ -224,7 +224,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u0153", "\x9C", 'windows-1252') # œ assert_raise(Encoding::UndefinedConversionError) { "\x9D".encode("utf-8", 'windows-1252') } check_both_ways("\u017E", "\x9E", 'windows-1252') # ž - check_both_ways("\u00A0", "\xA0", 'windows-1252') # non-breaking space + check_both_ways("\u00A0", "\xA0", 'windows-1252') # non-breaking space check_both_ways("\u00AF", "\xAF", 'windows-1252') # ¯ check_both_ways("\u00B0", "\xB0", 'windows-1252') # ° check_both_ways("\u00BF", "\xBF", 'windows-1252') # ¿ @@ -432,7 +432,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM437') # α check_both_ways("\u2229", "\xEF", 'IBM437') # ∩ check_both_ways("\u2261", "\xF0", 'IBM437') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM437') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM437') # non-breaking space end def test_IBM775 @@ -451,7 +451,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00D3", "\xE0", 'IBM775') # Ó check_both_ways("\u2019", "\xEF", 'IBM775') # ’ check_both_ways("\u00AD", "\xF0", 'IBM775') # osft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM775') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM775') # non-breaking space end def test_IBM852 @@ -470,7 +470,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00D3", "\xE0", 'IBM852') # Ó check_both_ways("\u00B4", "\xEF", 'IBM852') # ´ check_both_ways("\u00AD", "\xF0", 'IBM852') # osft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM852') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM852') # non-breaking space end def test_IBM855 @@ -489,7 +489,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u042F", "\xE0", 'IBM855') # Я check_both_ways("\u2116", "\xEF", 'IBM855') # № check_both_ways("\u00AD", "\xF0", 'IBM855') # osft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM855') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM855') # non-breaking space end def test_IBM857 @@ -517,7 +517,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u00B1", "\xF1", 'IBM857') # ± assert_raise(Encoding::UndefinedConversionError) { "\xF2".encode("utf-8", 'IBM857') } check_both_ways("\u00BE", "\xF3", 'IBM857') # ¾ - check_both_ways("\u00A0", "\xFF", 'IBM857') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM857') # non-breaking space end def test_IBM860 @@ -536,7 +536,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM860') # α check_both_ways("\u2229", "\xEF", 'IBM860') # ∩ check_both_ways("\u2261", "\xF0", 'IBM860') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM860') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM860') # non-breaking space end def test_IBM861 @@ -555,7 +555,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM861') # α check_both_ways("\u2229", "\xEF", 'IBM861') # ∩ check_both_ways("\u2261", "\xF0", 'IBM861') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM861') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM861') # non-breaking space end def test_IBM862 @@ -574,7 +574,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM862') # α check_both_ways("\u2229", "\xEF", 'IBM862') # ∩ check_both_ways("\u2261", "\xF0", 'IBM862') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM862') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM862') # non-breaking space end def test_IBM863 @@ -593,7 +593,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM863') # α check_both_ways("\u2229", "\xEF", 'IBM863') # ∩ check_both_ways("\u2261", "\xF0", 'IBM863') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM863') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM863') # non-breaking space end def test_IBM865 @@ -612,7 +612,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B1", "\xE0", 'IBM865') # α check_both_ways("\u2229", "\xEF", 'IBM865') # ∩ check_both_ways("\u2261", "\xF0", 'IBM865') # ≡ - check_both_ways("\u00A0", "\xFF", 'IBM865') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM865') # non-breaking space end def test_IBM866 @@ -631,7 +631,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u0440", "\xE0", 'IBM866') # р check_both_ways("\u044F", "\xEF", 'IBM866') # я check_both_ways("\u0401", "\xF0", 'IBM866') # Ё - check_both_ways("\u00A0", "\xFF", 'IBM866') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM866') # non-breaking space end def test_IBM869 @@ -658,7 +658,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u03B6", "\xE0", 'IBM869') # ζ check_both_ways("\u0384", "\xEF", 'IBM869') # ΄ check_both_ways("\u00AD", "\xF0", 'IBM869') # soft hyphen - check_both_ways("\u00A0", "\xFF", 'IBM869') # non-breaking space + check_both_ways("\u00A0", "\xFF", 'IBM869') # non-breaking space end def test_macCroatian @@ -906,7 +906,7 @@ class TestTranscode < Test::Unit::TestCase assert_raise(Encoding::UndefinedConversionError) { "\xFC".encode("utf-8", 'TIS-620') } assert_raise(Encoding::UndefinedConversionError) { "\xFF".encode("utf-8", 'TIS-620') } end - + def test_CP850 check_both_ways("\u00C7", "\x80", 'CP850') # Ç check_both_ways("\u00C5", "\x8F", 'CP850') # Å @@ -1265,7 +1265,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u73F1", "\xE0\xFE", 'euc-jp') # 珱 assert_raise(Encoding::UndefinedConversionError) { "\xF4\xA7".encode("utf-8", 'euc-jp') } #check_both_ways("\u9ADC", "\xFC\xE3", 'euc-jp') # 髜 (IBM extended) - + check_both_ways("\u677E\u672C\u884C\u5F18", "\xBE\xBE\xCB\xDC\xB9\xD4\xB9\xB0", 'euc-jp') # 松本行弘 check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC0\xC4\xBB\xB3\xB3\xD8\xB1\xA1\xC2\xE7\xB3\xD8", 'euc-jp') # 青山学院大学 check_both_ways("\u795E\u6797\u7FA9\u535A", "\xBF\xC0\xCE\xD3\xB5\xC1\xC7\xEE", 'euc-jp') # 神林義博 @@ -1460,7 +1460,7 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\u9F44", "\xF7\xFE", 'GB2312') # 齄 check_both_ways("\u9752\u5C71\u5B66\u9662\u5927\u5B66", "\xC7\xE0\xC9\xBD\xD1\xA7\xD4\xBA\xB4\xF3\xD1\xA7", 'GB2312') # 青山学院大学 end - + def test_gbk check_both_ways("\u4E02", "\x81\x40", 'GBK') # 丂 check_both_ways("\u4E8A", "\x81\x7E", 'GBK') # 亊 @@ -1577,33 +1577,33 @@ class TestTranscode < Test::Unit::TestCase def test_gb18030 # test from GBK - check_both_ways("\u4E02", "\x81\x40", 'GB18030') # - check_both_ways("\u4E8A", "\x81\x7E", 'GB18030') # - check_both_ways("\u4E90", "\x81\x80", 'GB18030') # + check_both_ways("\u4E02", "\x81\x40", 'GB18030') # + check_both_ways("\u4E8A", "\x81\x7E", 'GB18030') # + check_both_ways("\u4E90", "\x81\x80", 'GB18030') # check_both_ways("\u4FA2", "\x81\xFE", 'GB18030') # 侢 - check_both_ways("\u5EC6", "\x8F\x40", 'GB18030') # + check_both_ways("\u5EC6", "\x8F\x40", 'GB18030') # check_both_ways("\u5F24", "\x8F\x7E", 'GB18030') # 弤 check_both_ways("\u5F28", "\x8F\x80", 'GB18030') # 弨 - check_both_ways("\u6007", "\x8F\xFE", 'GB18030') # - check_both_ways("\u6008", "\x90\x40", 'GB18030') # + check_both_ways("\u6007", "\x8F\xFE", 'GB18030') # + check_both_ways("\u6008", "\x90\x40", 'GB18030') # check_both_ways("\u6080", "\x90\x7E", 'GB18030') # 悀 - check_both_ways("\u6081", "\x90\x80", 'GB18030') # - check_both_ways("\u6146", "\x90\xFE", 'GB18030') # - check_both_ways("\u70DC", "\x9F\x40", 'GB18030') # + check_both_ways("\u6081", "\x90\x80", 'GB18030') # + check_both_ways("\u6146", "\x90\xFE", 'GB18030') # + check_both_ways("\u70DC", "\x9F\x40", 'GB18030') # check_both_ways("\u7134", "\x9F\x7E", 'GB18030') # 焴 check_both_ways("\u7135", "\x9F\x80", 'GB18030') # 焵 - check_both_ways("\u71D3", "\x9F\xFE", 'GB18030') # - check_both_ways("\u71D6", "\xA0\x40", 'GB18030') # - check_both_ways("\u721A", "\xA0\x7E", 'GB18030') # - check_both_ways("\u721B", "\xA0\x80", 'GB18030') # - check_both_ways("\u72DB", "\xA0\xFE", 'GB18030') # + check_both_ways("\u71D3", "\x9F\xFE", 'GB18030') # + check_both_ways("\u71D6", "\xA0\x40", 'GB18030') # + check_both_ways("\u721A", "\xA0\x7E", 'GB18030') # + check_both_ways("\u721B", "\xA0\x80", 'GB18030') # + check_both_ways("\u72DB", "\xA0\xFE", 'GB18030') # check_both_ways("\u3000", "\xA1\xA1", 'GB18030') # full-width space - check_both_ways("\u3001", "\xA1\xA2", 'GB18030') # - check_both_ways("\u3013", "\xA1\xFE", 'GB18030') # + check_both_ways("\u3001", "\xA1\xA2", 'GB18030') # + check_both_ways("\u3013", "\xA1\xFE", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xA0".encode("utf-8", 'GB18030') } check_both_ways("\u2170", "\xA2\xA1", 'GB18030') # ⅰ #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xB0".encode("utf-8", 'GB18030') } - check_both_ways("\u2488", "\xA2\xB1", 'GB18030') # + check_both_ways("\u2488", "\xA2\xB1", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xE4".encode("utf-8", 'GB18030') } check_both_ways("\u3220", "\xA2\xE5", 'GB18030') # ㈠ #assert_raise(Encoding::UndefinedConversionError) { "\xA2\xF0".encode("utf-8", 'GB18030') } @@ -1612,72 +1612,72 @@ class TestTranscode < Test::Unit::TestCase check_both_ways("\uFF01", "\xA3\xA1", 'GB18030') # E check_both_ways("\uFFE3", "\xA3\xFE", 'GB18030') # E #assert_raise(Encoding::UndefinedConversionError) { "\xA4\xA0".encode("utf-8", 'GB18030') } - check_both_ways("\u3041", "\xA4\xA1", 'GB18030') # + check_both_ways("\u3041", "\xA4\xA1", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA5\xA0".encode("utf-8", 'GB18030') } check_both_ways("\u30A1", "\xA5\xA1", 'GB18030') # ァ - check_both_ways("\u0391", "\xA6\xA1", 'GB18030') # + check_both_ways("\u0391", "\xA6\xA1", 'GB18030') # check_both_ways("\u03B1", "\xA6\xC1", 'GB18030') # α #assert_raise(Encoding::UndefinedConversionError) { "\xA6\xED".encode("utf-8", 'GB18030') } check_both_ways("\uFE3B", "\xA6\xEE", 'GB18030') # E - check_both_ways("\u0410", "\xA7\xA1", 'GB18030') # + check_both_ways("\u0410", "\xA7\xA1", 'GB18030') # check_both_ways("\u0430", "\xA7\xD1", 'GB18030') # а - check_both_ways("\u02CA", "\xA8\x40", 'GB18030') # - check_both_ways("\u2587", "\xA8\x7E", 'GB18030') # + check_both_ways("\u02CA", "\xA8\x40", 'GB18030') # + check_both_ways("\u2587", "\xA8\x7E", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA8\x96".encode("utf-8", 'GB18030') } - check_both_ways("\u0101", "\xA8\xA1", 'GB18030') # + check_both_ways("\u0101", "\xA8\xA1", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA8\xBC".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA8\xBF".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA8\xC4".encode("utf-8", 'GB18030') } - check_both_ways("\u3105", "\xA8\xC5", 'GB18030') # + check_both_ways("\u3105", "\xA8\xC5", 'GB18030') # check_both_ways("\u3021", "\xA9\x40", 'GB18030') # 〡 #assert_raise(Encoding::UndefinedConversionError) { "\xA9\x58".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA9\x5B".encode("utf-8", 'GB18030') } #assert_raise(Encoding::UndefinedConversionError) { "\xA9\x5D".encode("utf-8", 'GB18030') } - check_both_ways("\u3007", "\xA9\x96", 'GB18030') # + check_both_ways("\u3007", "\xA9\x96", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xA9\xA3".encode("utf-8", 'GB18030') } check_both_ways("\u2500", "\xA9\xA4", 'GB18030') # ─ #assert_raise(Encoding::UndefinedConversionError) { "\xA9\xF0".encode("utf-8", 'GB18030') } - check_both_ways("\u7588", "\xAF\x40", 'GB18030') # - check_both_ways("\u7607", "\xAF\x7E", 'GB18030') # - check_both_ways("\u7608", "\xAF\x80", 'GB18030') # - check_both_ways("\u7644", "\xAF\xA0", 'GB18030') # + check_both_ways("\u7588", "\xAF\x40", 'GB18030') # + check_both_ways("\u7607", "\xAF\x7E", 'GB18030') # + check_both_ways("\u7608", "\xAF\x80", 'GB18030') # + check_both_ways("\u7644", "\xAF\xA0", 'GB18030') # #assert_raise(Encoding::UndefinedConversionError) { "\xAF\xA1".encode("utf-8", 'GB18030') } - check_both_ways("\u7645", "\xB0\x40", 'GB18030') # - check_both_ways("\u769B", "\xB0\x7E", 'GB18030') # - check_both_ways("\u769C", "\xB0\x80", 'GB18030') # + check_both_ways("\u7645", "\xB0\x40", 'GB18030') # + check_both_ways("\u769B", "\xB0\x7E", 'GB18030') # + check_both_ways("\u769C", "\xB0\x80", 'GB18030') # check_both_ways("\u5265", "\xB0\xFE", 'GB18030') # 剥 check_both_ways("\u7DFB", "\xBF\x40", 'GB18030') # 緻 check_both_ways("\u7E39", "\xBF\x7E", 'GB18030') # 縹 check_both_ways("\u7E3A", "\xBF\x80", 'GB18030') # 縺 check_both_ways("\u5080", "\xBF\xFE", 'GB18030') # 傀 - check_both_ways("\u7E5E", "\xC0\x40", 'GB18030') # - check_both_ways("\u7E9E", "\xC0\x7E", 'GB18030') # + check_both_ways("\u7E5E", "\xC0\x40", 'GB18030') # + check_both_ways("\u7E9E", "\xC0\x7E", 'GB18030') # check_both_ways("\u7EAE", "\xC0\x80", 'GB18030') # 纮 - check_both_ways("\u4FD0", "\xC0\xFE", 'GB18030') # + check_both_ways("\u4FD0", "\xC0\xFE", 'GB18030') # check_both_ways("\u87A5", "\xCF\x40", 'GB18030') # 螥 check_both_ways("\u87F8", "\xCF\x7E", 'GB18030') # 蟸 check_both_ways("\u87FA", "\xCF\x80", 'GB18030') # 蟺 - check_both_ways("\u6653", "\xCF\xFE", 'GB18030') # + check_both_ways("\u6653", "\xCF\xFE", 'GB18030') # check_both_ways("\u8824", "\xD0\x40", 'GB18030') # 蠤 check_both_ways("\u887A", "\xD0\x7E", 'GB18030') # 衺 check_both_ways("\u887B", "\xD0\x80", 'GB18030') # 衻 - check_both_ways("\u7384", "\xD0\xFE", 'GB18030') # - check_both_ways("\u9019", "\xDF\x40", 'GB18030') # - check_both_ways("\u9081", "\xDF\x7E", 'GB18030') # - check_both_ways("\u9084", "\xDF\x80", 'GB18030') # + check_both_ways("\u7384", "\xD0\xFE", 'GB18030') # + check_both_ways("\u9019", "\xDF\x40", 'GB18030') # + check_both_ways("\u9081", "\xDF\x7E", 'GB18030') # + check_both_ways("\u9084", "\xDF\x80", 'GB18030') # check_both_ways("\u553C", "\xDF\xFE", 'GB18030') # 唼 - check_both_ways("\u90C2", "\xE0\x40", 'GB18030') # - check_both_ways("\u911C", "\xE0\x7E", 'GB18030') # - check_both_ways("\u911D", "\xE0\x80", 'GB18030') # + check_both_ways("\u90C2", "\xE0\x40", 'GB18030') # + check_both_ways("\u911C", "\xE0\x7E", 'GB18030') # + check_both_ways("\u911D", "\xE0\x80", 'GB18030') # check_both_ways("\u5E3C", "\xE0\xFE", 'GB18030') # 帼 check_both_ways("\u986F", "\xEF\x40", 'GB18030') # 顯 check_both_ways("\u98E4", "\xEF\x7E", 'GB18030') # 飤 check_both_ways("\u98E5", "\xEF\x80", 'GB18030') # 飥 - check_both_ways("\u7A14", "\xEF\xFE", 'GB18030') # - check_both_ways("\u9908", "\xF0\x40", 'GB18030') # - check_both_ways("\u9949", "\xF0\x7E", 'GB18030') # - check_both_ways("\u994A", "\xF0\x80", 'GB18030') # - check_both_ways("\u7619", "\xF0\xFE", 'GB18030') # + check_both_ways("\u7A14", "\xEF\xFE", 'GB18030') # + check_both_ways("\u9908", "\xF0\x40", 'GB18030') # + check_both_ways("\u9949", "\xF0\x7E", 'GB18030') # + check_both_ways("\u994A", "\xF0\x80", 'GB18030') # + check_both_ways("\u7619", "\xF0\xFE", 'GB18030') # check_both_ways("\u9F32", "\xFD\x40", 'GB18030') # 鼲 check_both_ways("\u9F78", "\xFD\x7E", 'GB18030') # 齸 check_both_ways("\u9F79", "\xFD\x80", 'GB18030') # 齹 @@ -1692,40 +1692,40 @@ class TestTranscode < Test::Unit::TestCase # new tests for GB18030 check_both_ways("\u9FA6", "\x82\x35\x8F\x33", 'GB18030') # 龦 check_both_ways("\uD7FF", "\x83\x36\xC7\x38", 'GB18030') # No name () - - check_both_ways("\u0452", "\x81\x30\xD3\x30", 'GB18030') # + + check_both_ways("\u0452", "\x81\x30\xD3\x30", 'GB18030') # check_both_ways("\u200F", "\x81\x36\xA5\x31", 'GB18030') # RIGHT-TO-LEFT MARK - + check_both_ways("\uE865", "\x83\x36\xD0\x30", 'GB18030') # No name (Private Use Area) check_both_ways("\uF92B", "\x84\x30\x85\x34", 'GB18030') # E - - check_both_ways("\u2643", "\x81\x37\xA8\x39", 'GB18030') # + + check_both_ways("\u2643", "\x81\x37\xA8\x39", 'GB18030') # check_both_ways("\u2E80", "\x81\x38\xFD\x38", 'GB18030') # ⺀ - + check_both_ways("\uFA2A", "\x84\x30\x9C\x38", 'GB18030') # E check_both_ways("\uFE2F", "\x84\x31\x85\x37", 'GB18030') # No name (Combining Half Marks) - + check_both_ways("\u3CE1", "\x82\x31\xD4\x38", 'GB18030') # 㳡 - check_both_ways("\u4055", "\x82\x32\xAF\x32", 'GB18030') # - - check_both_ways("\u361B", "\x82\x30\xA6\x33", 'GB18030') # - check_both_ways("\u3917", "\x82\x30\xF2\x37", 'GB18030') # - + check_both_ways("\u4055", "\x82\x32\xAF\x32", 'GB18030') # + + check_both_ways("\u361B", "\x82\x30\xA6\x33", 'GB18030') # + check_both_ways("\u3917", "\x82\x30\xF2\x37", 'GB18030') # + check_both_ways("\u49B8", "\x82\x34\xA1\x31", 'GB18030') # 䦸 check_both_ways("\u4C76", "\x82\x34\xE7\x33", 'GB18030') # 䱶 - + check_both_ways("\u4160", "\x82\x32\xC9\x37", 'GB18030') # 䅠 check_both_ways("\u4336", "\x82\x32\xF8\x37", 'GB18030') # 䌶 - - check_both_ways("\u478E", "\x82\x33\xE8\x38", 'GB18030') # - check_both_ways("\u4946", "\x82\x34\x96\x38", 'GB18030') # - - check_both_ways("\u44D7", "\x82\x33\xA3\x39", 'GB18030') # - check_both_ways("\u464B", "\x82\x33\xC9\x31", 'GB18030') # - + + check_both_ways("\u478E", "\x82\x33\xE8\x38", 'GB18030') # + check_both_ways("\u4946", "\x82\x34\x96\x38", 'GB18030') # + + check_both_ways("\u44D7", "\x82\x33\xA3\x39", 'GB18030') # + check_both_ways("\u464B", "\x82\x33\xC9\x31", 'GB18030') # + check_both_ways("\uFFE6", "\x84\x31\xA2\x34", 'GB18030') # E check_both_ways("\uFFFF", "\x84\x31\xA4\x39", 'GB18030') # not a character - + check_both_ways("\u{10000}", "\x90\x30\x81\x30", 'GB18030') # 𐀀 check_both_ways("\u{10FFFE}", "\xE3\x32\x9A\x34", 'GB18030') # No name (Not a character) check_both_ways("\u{10FFFF}", "\xE3\x32\x9A\x35", 'GB18030') # No name (Not a character) @@ -1797,7 +1797,7 @@ class TestTranscode < Test::Unit::TestCase assert_raise(Encoding::UndefinedConversionError) { "\xF9\xD6".encode("utf-8", 'Big5') } check_both_ways("\u795E\u6797\u7FA9\u535A", "\xAF\xAB\xAA\x4C\xB8\x71\xB3\xD5", 'Big5') # 神林義博 end - + def test_nothing_changed a = "James".force_encoding("US-ASCII") b = a.encode("Shift_JIS") diff --git a/test/ruby/test_unicode_escape.rb b/test/ruby/test_unicode_escape.rb index f64b184230..5887dbc3dc 100644 --- a/test/ruby/test_unicode_escape.rb +++ b/test/ruby/test_unicode_escape.rb @@ -58,10 +58,10 @@ EOS assert_equal(:ü, :"\u{fc}") # the NUL character is not allowed in symbols - assert_raise(SyntaxError) { eval %q(:"\u{0}")} + assert_raise(SyntaxError) { eval %q(:"\u{0}")} assert_raise(SyntaxError) { eval %q(:"\u0000")} - assert_raise(SyntaxError) { eval %q(:"\u{fc 0 0041}")} - assert_raise(SyntaxError) { eval %q(:"\x00")} + assert_raise(SyntaxError) { eval %q(:"\u{fc 0 0041}")} + assert_raise(SyntaxError) { eval %q(:"\x00")} assert_raise(SyntaxError) { eval %q(:"\0")} end @@ -137,7 +137,7 @@ EOS def test_dynamic_regexp assert_match(Regexp.new("Martin D\\u{FC}rst"), "Martin Dürst") end - + def test_syntax_variants # all hex digits assert_equal("\xC4\xA3\xE4\x95\xA7\xE8\xA6\xAB\xEC\xB7\xAF", "\u0123\u4567\u89AB\uCDEF") @@ -147,7 +147,7 @@ EOS assert_equal("\xC4\xA3\xE4\x95\xA7\xE8\xA6\xAB\xEC\xB7\xAF", "\u0123\u4567\u89aB\uCdEf") assert_equal("\xC4\xA3\xE4\x95\xA7\xE8\xA6\xAB\xEC\xB7\xAF", "\u0123\u4567\u89aB\ucDEF") end - + def test_fulton # examples from Hal Fulton's book (second edition), chapter 4 # precomposed e'pe'e @@ -188,7 +188,7 @@ EOS assert_equal('Straße', "Stra\u{DF}e") assert_equal("\x53\x74\x72\x61\xC3\x9F\x65", "Stra\u{DF}e") end - + def test_edge_cases # start and end of each outer plane assert_equal("\xF4\x8F\xBF\xBF", "\u{10FFFF}") diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index c0c386040f..a842c31c3f 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -35,7 +35,7 @@ class TestVariable < Test::Unit::TestCase def test_variable assert_instance_of(Fixnum, $$) - + # read-only variable assert_raise(NameError) do $$ = 5 diff --git a/test/ruby/test_whileuntil.rb b/test/ruby/test_whileuntil.rb index df5bda450d..5628317cb8 100644 --- a/test/ruby/test_whileuntil.rb +++ b/test/ruby/test_whileuntil.rb @@ -16,7 +16,7 @@ class TestWhileuntil < Test::Unit::TestCase tmp = open(tmpfilename, "r") assert_instance_of(File, tmp) - + while line = tmp.gets() break if /vt100/ =~ line end |