summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cgi/test_cgi_core.rb2
-rw-r--r--test/cgi/test_cgi_tag_helper.rb2
-rw-r--r--test/csv/test_csv_parsing.rb46
-rw-r--r--test/csv/test_csv_writing.rb6
-rw-r--r--test/csv/test_data_converters.rb66
-rw-r--r--test/csv/test_encodings.rb62
-rw-r--r--test/csv/test_features.rb74
-rw-r--r--test/csv/test_headers.rb68
-rw-r--r--test/csv/test_interface.rb66
-rw-r--r--test/csv/test_row.rb86
-rw-r--r--test/csv/test_serialization.rb50
-rw-r--r--test/csv/test_table.rb118
-rw-r--r--test/date/test_date_base.rb16
-rw-r--r--test/date/test_date_parse.rb2
-rw-r--r--test/date/test_date_strftime.rb2
-rw-r--r--test/dbm/test_dbm.rb4
-rw-r--r--test/dl/test_base.rb2
-rw-r--r--test/dl/test_import.rb4
-rw-r--r--test/drb/drbtest.rb2
-rw-r--r--test/drb/test_acl.rb2
-rw-r--r--test/drb/test_drb.rb18
-rw-r--r--test/drb/ut_large.rb2
-rw-r--r--test/drb/ut_safe1.rb2
-rw-r--r--test/drb/ut_timerholder.rb2
-rw-r--r--test/erb/test_erb.rb28
-rw-r--r--test/erb/test_erb_m17n.rb2
-rw-r--r--test/fileutils/fileasserts.rb2
-rw-r--r--test/gdbm/test_gdbm.rb2
-rwxr-xr-xtest/json/test_json.rb2
-rwxr-xr-xtest/json/test_json_addition.rb2
-rw-r--r--test/json/test_json_rails.rb2
-rw-r--r--test/net/http/test_http.rb2
-rw-r--r--test/net/http/test_https_proxy.rb2
-rw-r--r--test/nkf/test_kconv.rb2
-rw-r--r--test/openssl/ssl_server.rb2
-rw-r--r--test/openssl/test_ec.rb2
-rw-r--r--test/openssl/test_pair.rb2
-rw-r--r--test/openssl/test_pkcs7.rb6
-rw-r--r--test/openssl/test_ssl.rb8
-rw-r--r--test/openssl/test_x509cert.rb30
-rw-r--r--test/openssl/test_x509crl.rb6
-rw-r--r--test/openssl/utils.rb2
-rw-r--r--test/ostruct/test_ostruct.rb2
-rw-r--r--test/rdoc/test_rdoc_info_formatting.rb4
-rw-r--r--test/rdoc/test_rdoc_markup_to_html_crossref.rb8
-rw-r--r--test/rdoc/test_rdoc_parser_c.rb10
-rw-r--r--test/rdoc/test_rdoc_parser_ruby.rb2
-rw-r--r--test/rdoc/test_rdoc_ri_default_display.rb2
-rw-r--r--test/readline/test_readline.rb6
-rw-r--r--test/readline/test_readline_history.rb20
-rw-r--r--test/rinda/test_rinda.rb22
-rw-r--r--test/rinda/test_tuplebag.rb2
-rw-r--r--test/ripper/test_files.rb2
-rw-r--r--test/rss/rss-assertions.rb28
-rw-r--r--test/rss/rss-testcase.rb10
-rw-r--r--test/rss/test_1.0.rb90
-rw-r--r--test/rss/test_2.0.rb60
-rw-r--r--test/rss/test_accessor.rb32
-rw-r--r--test/rss/test_content.rb8
-rw-r--r--test/rss/test_maker_0.9.rb28
-rw-r--r--test/rss/test_maker_1.0.rb38
-rw-r--r--test/rss/test_maker_2.0.rb82
-rw-r--r--test/rss/test_maker_content.rb2
-rw-r--r--test/rss/test_maker_dc.rb8
-rw-r--r--test/rss/test_maker_image.rb4
-rw-r--r--test/rss/test_maker_sy.rb4
-rw-r--r--test/rss/test_maker_taxo.rb6
-rw-r--r--test/rss/test_maker_trackback.rb2
-rw-r--r--test/rss/test_maker_xml-stylesheet.rb6
-rw-r--r--test/rss/test_parser_1.0.rb2
-rw-r--r--test/rss/test_setup_maker_0.9.rb24
-rw-r--r--test/rss/test_setup_maker_1.0.rb84
-rw-r--r--test/rss/test_setup_maker_2.0.rb42
-rw-r--r--test/rss/test_setup_maker_atom_feed.rb2
-rw-r--r--test/rss/test_syndication.rb36
-rw-r--r--test/rss/test_taxonomy.rb14
-rw-r--r--test/rss/test_to_s.rb56
-rw-r--r--test/rss/test_trackback.rb28
-rw-r--r--test/rss/test_xml-stylesheet.rb12
-rw-r--r--test/ruby/allpairs.rb4
-rw-r--r--test/ruby/envutil.rb2
-rw-r--r--test/ruby/marshaltestlib.rb4
-rw-r--r--test/ruby/test_alias.rb2
-rw-r--r--test/ruby/test_array.rb34
-rw-r--r--test/ruby/test_basicinstructions.rb12
-rw-r--r--test/ruby/test_econv.rb12
-rw-r--r--test/ruby/test_encoding.rb4
-rw-r--r--test/ruby/test_eval.rb2
-rw-r--r--test/ruby/test_fiber.rb2
-rw-r--r--test/ruby/test_file_exhaustive.rb2
-rw-r--r--test/ruby/test_gc.rb2
-rw-r--r--test/ruby/test_hash.rb4
-rw-r--r--test/ruby/test_io.rb10
-rw-r--r--test/ruby/test_io_m17n.rb6
-rw-r--r--test/ruby/test_m17n.rb4
-rw-r--r--test/ruby/test_m17n_comb.rb2
-rw-r--r--test/ruby/test_module.rb2
-rw-r--r--test/ruby/test_parse.rb6
-rw-r--r--test/ruby/test_primitive.rb8
-rw-r--r--test/ruby/test_proc.rb6
-rw-r--r--test/ruby/test_process.rb4
-rw-r--r--test/ruby/test_string.rb40
-rw-r--r--test/ruby/test_symbol.rb2
-rw-r--r--test/ruby/test_trace.rb6
-rw-r--r--test/ruby/test_transcode.rb176
-rw-r--r--test/ruby/test_unicode_escape.rb12
-rw-r--r--test/ruby/test_variable.rb2
-rw-r--r--test/ruby/test_whileuntil.rb2
-rw-r--r--test/rubygems/gem_package_tar_test_case.rb4
-rw-r--r--test/rubygems/insure_session.rb2
-rw-r--r--test/rubygems/simple_gem.rb28
-rw-r--r--test/rubygems/test_gem.rb2
-rw-r--r--test/rubygems/test_gem_commands_sources_command.rb4
-rw-r--r--test/rubygems/test_gem_dependency_installer.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_input.rb2
-rw-r--r--test/rubygems/test_gem_package_tar_writer.rb6
-rw-r--r--test/rubygems/test_gem_source_index.rb2
-rw-r--r--test/rubygems/test_gem_specification.rb2
-rw-r--r--test/scanf/test_scanf.rb6
-rw-r--r--test/scanf/test_scanfblocks.rb6
-rw-r--r--test/socket/test_nonblock.rb2
-rw-r--r--test/socket/test_unix.rb2
-rw-r--r--test/stringio/test_stringio.rb8
-rw-r--r--test/test_prime.rb20
-rw-r--r--test/test_pstore.rb12
-rw-r--r--test/test_shellwords.rb6
-rw-r--r--test/uri/test_common.rb14
-rw-r--r--test/uri/test_ftp.rb8
-rw-r--r--test/uri/test_generic.rb32
-rw-r--r--test/uri/test_http.rb2
-rw-r--r--test/uri/test_ldap.rb24
-rw-r--r--test/uri/test_mailto.rb22
-rw-r--r--test/webrick/test_cookie.rb2
-rw-r--r--test/webrick/test_httpauth.rb2
-rw-r--r--test/webrick/test_httpproxy.rb4
-rw-r--r--test/webrick/test_httprequest.rb2
-rw-r--r--test/win32ole/test_folderitem2_invokeverb.rb4
-rw-r--r--test/win32ole/test_nil2vtempty.rb2
-rw-r--r--test/win32ole/test_ole_methods.rb2
-rw-r--r--test/win32ole/test_win32ole.rb16
-rw-r--r--test/win32ole/test_win32ole_event.rb12
-rw-r--r--test/win32ole/test_win32ole_method.rb4
-rw-r--r--test/win32ole/test_win32ole_param.rb2
-rw-r--r--test/win32ole/test_win32ole_type.rb10
-rw-r--r--test/win32ole/test_win32ole_variable.rb2
-rw-r--r--test/win32ole/test_win32ole_variant.rb14
-rw-r--r--test/win32ole/test_word.rb2
-rw-r--r--test/xmlrpc/test_datetime.rb18
-rw-r--r--test/xmlrpc/test_features.rb2
-rw-r--r--test/xmlrpc/test_marshal.rb6
-rw-r--r--test/xmlrpc/test_parser.rb12
-rw-r--r--test/xmlrpc/test_webrick_server.rb8
-rw-r--r--test/xmlrpc/webrick_testing.rb6
-rw-r--r--test/yaml/test_yaml.rb60
-rw-r--r--test/yaml/test_yamlstore.rb12
155 files changed, 1196 insertions, 1196 deletions
diff --git a/test/cgi/test_cgi_core.rb b/test/cgi/test_cgi_core.rb
index fa86cf14cd6..3f75b04fd40 100644
--- a/test/cgi/test_cgi_core.rb
+++ b/test/cgi/test_cgi_core.rb
@@ -135,7 +135,7 @@ class CGICoreTest < Test::Unit::TestCase
assert_equal({"str"=>"\xBE\xBE\xB9\xBE".force_encoding("UTF-8")},hash)
$stdin.rewind
- assert_raise(CGI::InvalidEncoding) do
+ assert_raise(CGI::InvalidEncoding) do
cgi = CGI.new(:accept_charset=>"UTF-8")
end
diff --git a/test/cgi/test_cgi_tag_helper.rb b/test/cgi/test_cgi_tag_helper.rb
index 6e726b93a39..29306578b0d 100644
--- a/test/cgi/test_cgi_tag_helper.rb
+++ b/test/cgi/test_cgi_tag_helper.rb
@@ -326,7 +326,7 @@ class CGITagHelperTest < Test::Unit::TestCase
assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
end
end
-
+
=begin
def test_cgi_tag_helper_html4
## html4
diff --git a/test/csv/test_csv_parsing.rb b/test/csv/test_csv_parsing.rb
index e3916875377..a9e6cd400cc 100644
--- a/test/csv/test_csv_parsing.rb
+++ b/test/csv/test_csv_parsing.rb
@@ -12,22 +12,22 @@ require "timeout"
require "csv"
-#
-# Following tests are my interpretation of the
-# {CSV RCF}[http://www.ietf.org/rfc/rfc4180.txt]. I only deviate from that
+#
+# Following tests are my interpretation of the
+# {CSV RCF}[http://www.ietf.org/rfc/rfc4180.txt]. I only deviate from that
# document in one place (intentionally) and that is to make the default row
# separator <tt>$/</tt>.
-#
+#
class TestCSVParsing < Test::Unit::TestCase
BIG_DATA = "123456789\n" * 1024
-
+
def test_mastering_regex_example
ex = %Q{Ten Thousand,10000, 2710 ,,"10,000","It's ""10 Grand"", baby",10K}
assert_equal( [ "Ten Thousand", "10000", " 2710 ", nil, "10,000",
"It's \"10 Grand\", baby", "10K" ],
CSV.parse_line(ex) )
end
-
+
# Old Ruby 1.8 CSV library tests.
def test_std_lib_csv
[ ["\t", ["\t"]],
@@ -79,7 +79,7 @@ class TestCSVParsing < Test::Unit::TestCase
assert_equal(csv_test.last, CSV.parse_line(csv_test.first))
end
end
-
+
# From: http://ruby-talk.org/cgi-bin/scat.rb/ruby/ruby-core/6496
def test_aras_edge_cases
[ [%Q{a,b}, ["a", "b"]],
@@ -102,35 +102,35 @@ class TestCSVParsing < Test::Unit::TestCase
assert_equal(edge_case.last, CSV.parse_line(edge_case.first))
end
end
-
+
def test_james_edge_cases
# A read at eof? should return nil.
assert_equal(nil, CSV.parse_line(""))
- #
+ #
# With Ruby 1.8 CSV it's impossible to tell an empty line from a line
# containing a single +nil+ field. The old CSV library returns
# <tt>[nil]</tt> in these cases, but <tt>Array.new</tt> makes more sense to
# me.
- #
+ #
assert_equal(Array.new, CSV.parse_line("\n1,2,3\n"))
end
-
+
def test_malformed_csv
assert_raise(CSV::MalformedCSVError) do
CSV.parse_line("1,2\r,3", row_sep: "\n")
end
-
+
bad_data = <<-END_DATA.gsub(/^ +/, "")
line,1,abc
line,2,"def\nghi"
-
+
line,4,some\rjunk
line,5,jkl
END_DATA
lines = bad_data.lines.to_a
assert_equal(6, lines.size)
assert_match(/\Aline,4/, lines.find { |l| l =~ /some\rjunk/ })
-
+
csv = CSV.new(bad_data)
begin
loop do
@@ -141,20 +141,20 @@ class TestCSVParsing < Test::Unit::TestCase
assert_equal( "Unquoted fields do not allow \\r or \\n (line 4).",
$!.message )
end
-
+
assert_raise(CSV::MalformedCSVError) { CSV.parse_line('1,2,"3...') }
-
+
bad_data = <<-END_DATA.gsub(/^ +/, "")
line,1,abc
line,2,"def\nghi"
-
+
line,4,8'10"
line,5,jkl
END_DATA
lines = bad_data.lines.to_a
assert_equal(6, lines.size)
assert_match(/\Aline,4/, lines.find { |l| l =~ /8'10"/ })
-
+
csv = CSV.new(bad_data)
begin
loop do
@@ -165,22 +165,22 @@ class TestCSVParsing < Test::Unit::TestCase
assert_equal("Illegal quoting on line 4.", $!.message)
end
end
-
+
def test_the_parse_fails_fast_when_it_can_for_unquoted_fields
assert_parse_errors_out('valid,fields,bad start"' + BIG_DATA)
end
-
+
def test_the_parse_fails_fast_when_it_can_for_unescaped_quotes
assert_parse_errors_out('valid,fields,"bad start"unescaped' + BIG_DATA)
end
-
+
def test_field_size_limit_controls_lookahead
assert_parse_errors_out( 'valid,fields,"' + BIG_DATA + '"',
field_size_limit: 2048 )
end
-
+
private
-
+
def assert_parse_errors_out(*args)
assert_raise(CSV::MalformedCSVError) do
Timeout.timeout(0.2) do
diff --git a/test/csv/test_csv_writing.rb b/test/csv/test_csv_writing.rb
index 98e41fe9c46..eacba49613f 100644
--- a/test/csv/test_csv_writing.rb
+++ b/test/csv/test_csv_writing.rb
@@ -76,19 +76,19 @@ class TestCSVWriting < Test::Unit::TestCase
assert_equal(test_case.first + $/, CSV.generate_line(test_case.last))
end
end
-
+
def test_col_sep
assert_equal( "a;b;;c\n", CSV.generate_line( ["a", "b", nil, "c"],
col_sep: ";" ) )
assert_equal( "a\tb\t\tc\n", CSV.generate_line( ["a", "b", nil, "c"],
col_sep: "\t" ) )
end
-
+
def test_row_sep
assert_equal( "a,b,,c\r\n", CSV.generate_line( ["a", "b", nil, "c"],
row_sep: "\r\n" ) )
end
-
+
def test_force_quotes
assert_equal( %Q{"1","b","","already ""quoted"""\n},
CSV.generate_line( [1, "b", nil, %Q{already "quoted"}],
diff --git a/test/csv/test_data_converters.rb b/test/csv/test_data_converters.rb
index 781450dc9ed..1ad5093424c 100644
--- a/test/csv/test_data_converters.rb
+++ b/test/csv/test_data_converters.rb
@@ -15,18 +15,18 @@ class TestDataConverters < Test::Unit::TestCase
def setup
@data = "Numbers,:integer,1,:float,3.015"
@parser = CSV.new(@data)
-
+
@custom = lambda { |field| field =~ /\A:(\S.*?)\s*\Z/ ? $1.to_sym : field }
-
+
@win_safe_time_str = Time.now.strftime("%a %b %d %H:%M:%S %Y")
end
-
+
def test_builtin_integer_converter
# does convert
[-5, 1, 10000000000].each do |n|
assert_equal(n, CSV::Converters[:integer][n.to_s])
end
-
+
# does not convert
(%w{junk 1.0} + [""]).each do |str|
assert_equal(str, CSV::Converters[:integer][str])
@@ -38,7 +38,7 @@ class TestDataConverters < Test::Unit::TestCase
[-5.1234, 0, 2.3e-11].each do |n|
assert_equal(n, CSV::Converters[:float][n.to_s])
end
-
+
# does not convert
(%w{junk 1..0 .015F} + [""]).each do |str|
assert_equal(str, CSV::Converters[:float][str])
@@ -64,43 +64,43 @@ class TestDataConverters < Test::Unit::TestCase
# does not convert
assert_instance_of(String, CSV::Converters[:date_time]["junk"])
end
-
+
def test_convert_with_builtin
# setup parser...
assert(@parser.respond_to?(:convert))
assert_nothing_raised(Exception) { @parser.convert(:integer) }
-
+
# and use
assert_equal(["Numbers", ":integer", 1, ":float", "3.015"], @parser.shift)
-
+
setup # reset
-
+
# setup parser...
assert_nothing_raised(Exception) { @parser.convert(:float) }
-
+
# and use
assert_equal(["Numbers", ":integer", 1.0, ":float", 3.015], @parser.shift)
end
-
+
def test_convert_order
# floats first, then integers...
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
@parser.convert(:float)
@parser.convert(:integer)
end
-
+
# gets us nothing but floats
assert_equal( [String, String, Float, String, Float],
@parser.shift.map { |field| field.class } )
-
+
setup # reset
# integers have precendance...
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
@parser.convert(:integer)
@parser.convert(:float)
end
-
+
# gives us proper number conversion
assert_equal( [String, String, Fixnum, String, Float],
@parser.shift.map { |field| field.class } )
@@ -109,7 +109,7 @@ class TestDataConverters < Test::Unit::TestCase
def test_builtin_numeric_combo_converter
# setup parser...
assert_nothing_raised(Exception) { @parser.convert(:numeric) }
-
+
# and use
assert_equal( [String, String, Fixnum, String, Float],
@parser.shift.map { |field| field.class } )
@@ -120,18 +120,18 @@ class TestDataConverters < Test::Unit::TestCase
@data << ",#{@win_safe_time_str}" # add a DateTime field
@parser = CSV.new(@data) # reset parser
assert_nothing_raised(Exception) { @parser.convert(:all) }
-
+
# and use
assert_equal( [String, String, Fixnum, String, Float, DateTime],
@parser.shift.map { |field| field.class } )
end
-
+
def test_convert_with_custom_code
# define custom converter...
assert_nothing_raised(Exception) do
@parser.convert { |field| field =~ /\A:(\S.*?)\s*\Z/ ? $1.to_sym : field }
end
-
+
# and use
assert_equal(["Numbers", :integer, "1", :float, "3.015"], @parser.shift)
@@ -140,11 +140,11 @@ class TestDataConverters < Test::Unit::TestCase
# mix built-in and custom...
assert_nothing_raised(Exception) { @parser.convert(:numeric) }
assert_nothing_raised(Exception) { @parser.convert(&@custom) }
-
+
# and use
assert_equal(["Numbers", :integer, 1, :float, 3.015], @parser.shift)
end
-
+
def test_convert_with_custom_code_using_field_info
# define custom converter that uses field information...
assert_nothing_raised(Exception) do
@@ -153,26 +153,26 @@ class TestDataConverters < Test::Unit::TestCase
info.index == 4 ? Float(field).floor : field
end
end
-
+
# and use
assert_equal(["Numbers", ":integer", "1", ":float", 3], @parser.shift)
end
-
+
def test_convert_with_custom_code_using_field_info_header
@parser = CSV.new(@data, headers: %w{one two three four five})
-
+
# define custom converter that uses field header information...
assert_nothing_raised(Exception) do
@parser.convert do |field, info|
info.header == "three" ? Integer(field) * 100 : field
end
end
-
+
# and use
assert_equal( ["Numbers", ":integer", 100, ":float", "3.015"],
@parser.shift.fields )
end
-
+
def test_shortcut_interface
assert_equal( ["Numbers", ":integer", 1, ":float", 3.015],
CSV.parse_line(@data, converters: :numeric) )
@@ -183,14 +183,14 @@ class TestDataConverters < Test::Unit::TestCase
assert_equal( ["Numbers", :integer, 1, :float, 3.015],
CSV.parse_line(@data, converters: [:numeric, @custom]) )
end
-
+
def test_unconverted_fields
[ [ @data,
["Numbers", :integer, 1, :float, 3.015],
%w{Numbers :integer 1 :float 3.015} ],
["\n", Array.new, Array.new] ].each do |test, fields, unconverted|
row = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
row = CSV.parse_line( test,
converters: [:numeric, @custom],
unconverted_fields: true )
@@ -206,7 +206,7 @@ class TestDataConverters < Test::Unit::TestCase
1,2,3
END_CSV
row = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
row = CSV.parse_line( data,
converters: :numeric,
unconverted_fields: true,
@@ -217,7 +217,7 @@ class TestDataConverters < Test::Unit::TestCase
assert_respond_to(row, :unconverted_fields)
assert_equal(%w{1 2 3}, row.unconverted_fields)
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
row = CSV.parse_line( data,
converters: :numeric,
unconverted_fields: true,
@@ -230,7 +230,7 @@ class TestDataConverters < Test::Unit::TestCase
assert_respond_to(row, :unconverted_fields)
assert_equal(%w{first second third}, row.unconverted_fields)
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
row = CSV.parse_line( data,
converters: :numeric,
unconverted_fields: true,
@@ -244,7 +244,7 @@ class TestDataConverters < Test::Unit::TestCase
assert_respond_to(row, :unconverted_fields)
assert_equal(%w{first second third}, row.unconverted_fields)
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
row = CSV.parse_line( data,
converters: :numeric,
unconverted_fields: true,
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 0a300af2910..63f7207c29d 100644
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -15,43 +15,43 @@ class TestEncodings < Test::Unit::TestCase
def setup
@temp_csv_path = File.join(File.dirname(__FILE__), "temp.csv")
end
-
+
def teardown
File.unlink(@temp_csv_path) if File.exist? @temp_csv_path
end
-
+
########################################
### Hand Test Some Popular Encodings ###
########################################
-
+
def test_parses_utf8_encoding
assert_parses( [ %w[ one two … ],
%w[ 1 … 3 ],
%w[ … 5 6 ] ], "UTF-8" )
end
-
+
def test_parses_latin1_encoding
assert_parses( [ %w[ one two Résumé ],
%w[ 1 Résumé 3 ],
%w[ Résumé 5 6 ] ], "ISO-8859-1" )
end
-
+
def test_parses_utf16be_encoding
assert_parses( [ %w[ one two … ],
%w[ 1 … 3 ],
%w[ … 5 6 ] ], "UTF-16BE" )
end
-
+
def test_parses_shift_jis_encoding
assert_parses( [ %w[ 一 二 三 ],
%w[ 四 五 六 ],
%w[ 七 八 九 ] ], "Shift_JIS" )
end
-
+
###########################################################
### Try Simple Reading for All Non-dummy Ruby Encodings ###
###########################################################
-
+
def test_reading_with_most_encodings
each_encoding do |encoding|
begin
@@ -62,7 +62,7 @@ class TestEncodings < Test::Unit::TestCase
end
end
end
-
+
def test_regular_expression_escaping
each_encoding do |encoding|
begin
@@ -73,18 +73,18 @@ class TestEncodings < Test::Unit::TestCase
end
end
end
-
+
#######################################################################
### Stress Test ASCII Compatible and Non-ASCII Compatible Encodings ###
#######################################################################
-
+
def test_auto_line_ending_detection
# arrange data to place a \r at the end of CSV's read ahead point
encode_for_tests([["a" * 509]], row_sep: "\r\n") do |data|
assert_equal("\r\n".encode(data.encoding), CSV.new(data).row_sep)
end
end
-
+
def test_csv_chars_are_transcoded
encode_for_tests([%w[abc def]]) do |data|
%w[col_sep row_sep quote_char].each do |csv_char|
@@ -93,7 +93,7 @@ class TestEncodings < Test::Unit::TestCase
end
end
end
-
+
def test_parser_works_with_encoded_headers
encode_for_tests([%w[one two three], %w[1 2 3]]) do |data|
parsed = CSV.parse(data, headers: true)
@@ -105,7 +105,7 @@ class TestEncodings < Test::Unit::TestCase
end
end
end
-
+
def test_built_in_converters_transcode_to_utf_8_then_convert
encode_for_tests([%w[one two three], %w[1 2 3]]) do |data|
parsed = CSV.parse(data, converters: :integer)
@@ -114,7 +114,7 @@ class TestEncodings < Test::Unit::TestCase
assert_equal([1, 2, 3], parsed[1])
end
end
-
+
def test_built_in_header_converters_transcode_to_utf_8_then_convert
encode_for_tests([%w[one two three], %w[1 2 3]]) do |data|
parsed = CSV.parse( data, headers: true,
@@ -125,7 +125,7 @@ class TestEncodings < Test::Unit::TestCase
"Wrong data encoding." )
end
end
-
+
def test_open_allows_you_to_set_encodings
encode_for_tests([%w[abc def]]) do |data|
# read and write in encoding
@@ -136,7 +136,7 @@ class TestEncodings < Test::Unit::TestCase
"Wrong data encoding." )
end
end
-
+
# read and write with transcoding
File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f|
f << data
@@ -149,7 +149,7 @@ class TestEncodings < Test::Unit::TestCase
end
end
end
-
+
def test_foreach_allows_you_to_set_encodings
encode_for_tests([%w[abc def]]) do |data|
# read and write in encoding
@@ -158,7 +158,7 @@ class TestEncodings < Test::Unit::TestCase
assert( row.all? { |f| f.encoding == data.encoding },
"Wrong data encoding." )
end
-
+
# read and write with transcoding
File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f|
f << data
@@ -170,7 +170,7 @@ class TestEncodings < Test::Unit::TestCase
end
end
end
-
+
def test_read_allows_you_to_set_encodings
encode_for_tests([%w[abc def]]) do |data|
# read and write in encoding
@@ -178,7 +178,7 @@ class TestEncodings < Test::Unit::TestCase
rows = CSV.read(@temp_csv_path, encoding: data.encoding.name)
assert( rows.flatten.all? { |f| f.encoding == data.encoding },
"Wrong data encoding." )
-
+
# read and write with transcoding
File.open(@temp_csv_path, "wb:UTF-32BE:#{data.encoding.name}") do |f|
f << data
@@ -189,22 +189,22 @@ class TestEncodings < Test::Unit::TestCase
"Wrong data encoding." )
end
end
-
+
#################################
### Write CSV in any Encoding ###
#################################
-
+
def test_can_write_csv_in_any_encoding
each_encoding do |encoding|
# test generate_line with encoding hint
csv = %w[abc d|ef].map { |f| f.encode(encoding) }.
to_csv(col_sep: "|", encoding: encoding.name)
assert_equal(encoding, csv.encoding)
-
+
# test generate_line with encoding guessing from fields
csv = %w[abc d|ef].map { |f| f.encode(encoding) }.to_csv(col_sep: "|")
assert_equal(encoding, csv.encoding)
-
+
# writing to files
data = encode_ary([%w[abc d,ef], %w[123 456 ]], encoding)
CSV.open(@temp_csv_path, "wb:#{encoding.name}") do |f|
@@ -213,9 +213,9 @@ class TestEncodings < Test::Unit::TestCase
assert_equal(data, CSV.read(@temp_csv_path, encoding: encoding.name))
end
end
-
+
private
-
+
def assert_parses(fields, encoding, options = { })
encoding = Encoding.find(encoding) unless encoding.is_a? Encoding
fields = encode_ary(fields, encoding)
@@ -225,11 +225,11 @@ class TestEncodings < Test::Unit::TestCase
assert_equal(encoding, field.encoding, "Field[#{i + 1}] was transcoded.")
end
end
-
+
def encode_ary(ary, encoding)
ary.map { |row| row.map { |field| field.encode(encoding) } }
end
-
+
def ary_to_data(ary, options = { })
encoding = ary.flatten.first.encoding
quote_char = (options[:quote_char] || '"').encode(encoding)
@@ -241,12 +241,12 @@ class TestEncodings < Test::Unit::TestCase
}.join(col_sep) + row_sep
}.join.encode(encoding)
end
-
+
def encode_for_tests(data, options = { })
yield ary_to_data(encode_ary(data, "UTF-8"), options)
yield ary_to_data(encode_ary(data, "UTF-16BE"), options)
end
-
+
def each_encoding
Encoding.list.each do |encoding|
next if encoding.dummy? # skip "dummy" encodings
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb
index 9ed3f981911..58efd1c9b3b 100644
--- a/test/csv/test_features.rb
+++ b/test/csv/test_features.rb
@@ -30,17 +30,17 @@ class TestCSVFeatures < Test::Unit::TestCase
[%Q{,"\r"}, [nil,"\r"]],
[%Q{"\r\n,"}, ["\r\n,"]],
[%Q{"\r\n,",}, ["\r\n,", nil]] ]
-
+
def setup
@sample_data = <<-END_DATA.gsub(/^ +/, "")
line,1,abc
line,2,"def\nghi"
-
+
line,4,jkl
END_DATA
@csv = CSV.new(@sample_data)
end
-
+
def test_col_sep
[";", "\t"].each do |sep|
TEST_CASES.each do |test_case|
@@ -51,7 +51,7 @@ class TestCSVFeatures < Test::Unit::TestCase
end
assert_equal([",,,", nil], CSV.parse_line(",,,;", col_sep: ";"))
end
-
+
def test_row_sep
assert_raise(CSV::MalformedCSVError) do
CSV.parse_line("1,2,3\n,4,5\r\n", row_sep: "\r\n")
@@ -59,7 +59,7 @@ class TestCSVFeatures < Test::Unit::TestCase
assert_equal( ["1", "2", "3\n", "4", "5"],
CSV.parse_line(%Q{1,2,"3\n",4,5\r\n}, row_sep: "\r\n"))
end
-
+
def test_quote_char
TEST_CASES.each do |test_case|
assert_equal( test_case.last.map { |t| t.tr('"', "'") unless t.nil? },
@@ -67,31 +67,31 @@ class TestCSVFeatures < Test::Unit::TestCase
quote_char: "'" ) )
end
end
-
+
def test_csv_char_readers
%w[col_sep row_sep quote_char].each do |reader|
csv = CSV.new("abc,def", reader.to_sym => "|")
assert_equal("|", csv.send(reader))
end
end
-
+
def test_row_sep_auto_discovery
["\r\n", "\n", "\r"].each do |line_end|
data = "1,2,3#{line_end}4,5#{line_end}"
discovered = CSV.new(data).row_sep
assert_equal(line_end, discovered)
end
-
+
assert_equal("\n", CSV.new("\n\r\n\r").row_sep)
-
+
assert_equal($/, CSV.new("").row_sep)
-
+
assert_equal($/, CSV.new(STDERR).row_sep)
end
-
+
def test_lineno
assert_equal(5, @sample_data.lines.to_a.size)
-
+
4.times do |line_count|
assert_equal(line_count, @csv.lineno)
assert_not_nil(@csv.shift)
@@ -99,24 +99,24 @@ class TestCSVFeatures < Test::Unit::TestCase
end
assert_nil(@csv.shift)
end
-
+
def test_readline
test_lineno
-
+
@csv.rewind
-
+
test_lineno
end
-
+
def test_unknown_options
assert_raise(ArgumentError) { CSV.new(String.new, unknown: :error) }
end
-
+
def test_skip_blanks
assert_equal(4, @csv.to_a.size)
@csv = CSV.new(@sample_data, skip_blanks: true)
-
+
count = 0
@csv.each do |row|
count += 1
@@ -124,7 +124,7 @@ class TestCSVFeatures < Test::Unit::TestCase
end
assert_equal(3, count)
end
-
+
def test_csv_behavior_readers
%w[ unconverted_fields return_headers write_headers
skip_blanks force_quotes ].each do |behavior|
@@ -134,47 +134,47 @@ class TestCSVFeatures < Test::Unit::TestCase
assert(csv.send("#{behavior}?"), "Behavior change now registered.")
end
end
-
+
def test_converters_reader
# no change
assert_equal( [:integer],
CSV.new("abc,def", converters: [:integer]).converters )
-
+
# just one
assert_equal( [:integer],
CSV.new("abc,def", converters: :integer).converters )
-
+
# expanded
assert_equal( [:integer, :float],
CSV.new("abc,def", converters: :numeric).converters )
-
+
# custom
csv = CSV.new("abc,def", converters: [:integer, lambda { }])
assert_equal(2, csv.converters.size)
assert_equal(:integer, csv.converters.first)
assert_instance_of(Proc, csv.converters.last)
end
-
+
def test_header_converters_reader
# no change
hc = :header_converters
assert_equal([:downcase], CSV.new("abc,def", hc => [:downcase]).send(hc))
-
+
# just one
assert_equal([:downcase], CSV.new("abc,def", hc => :downcase).send(hc))
-
+
# custom
csv = CSV.new("abc,def", hc => [:symbol, lambda { }])
assert_equal(2, csv.send(hc).size)
assert_equal(:symbol, csv.send(hc).first)
assert_instance_of(Proc, csv.send(hc).last)
end
-
+
# reported by Kev Jackson
def test_failing_to_escape_col_sep_bug_fix
assert_nothing_raised(Exception) { CSV.new(String.new, col_sep: "|") }
end
-
+
# reported by Chris Roos
def test_failing_to_reset_headers_in_rewind_bug_fix
csv = CSV.new("forename,surname", headers: true, return_headers: true)
@@ -182,7 +182,7 @@ class TestCSVFeatures < Test::Unit::TestCase
csv.rewind
csv.each { |row| assert row.header_row? }
end
-
+
# reported by Dave Burt
def test_leading_empty_fields_with_multibyte_col_sep_bug_fix
data = <<-END_DATA.gsub(/^\s+/, "")
@@ -192,7 +192,7 @@ class TestCSVFeatures < Test::Unit::TestCase
parsed = CSV.parse(data, col_sep: "<=>")
assert_equal([[nil, nil, "A", "B", "C"], ["1", "2", "3"]], parsed)
end
-
+
def test_gzip_reader_bug_fix
zipped = nil
assert_nothing_raised(NoMethodError) do
@@ -204,7 +204,7 @@ class TestCSVFeatures < Test::Unit::TestCase
end
assert_equal("\r\n", zipped.row_sep)
end
-
+
def test_gzip_writer_bug_fix
file = File.join(File.dirname(__FILE__), "temp.gz")
zipped = nil
@@ -214,13 +214,13 @@ class TestCSVFeatures < Test::Unit::TestCase
zipped << %w[one two three]
zipped << [1, 2, 3]
zipped.close
-
+
assert( Zlib::GzipReader.open(file) { |f| f.read }.
include?($INPUT_RECORD_SEPARATOR),
"@row_sep did not default" )
File.unlink(file)
end
-
+
def test_inspect_is_smart_about_io_types
str = CSV.new("string,data").inspect
assert(str.include?("io_type:StringIO"), "IO type not detected.")
@@ -234,14 +234,14 @@ class TestCSVFeatures < Test::Unit::TestCase
assert(str.include?("io_type:File"), "IO type not detected.")
File.unlink(path)
end
-
+
def test_inspect_shows_key_attributes
str = @csv.inspect
%w[lineno col_sep row_sep quote_char].each do |attr_name|
assert_match(/\b#{attr_name}:[^\s>]+/, str)
end
end
-
+
def test_inspect_shows_headers_when_available
CSV.new("one,two,three\n1,2,3\n", headers: true) do |csv|
assert(csv.inspect.include?("headers:true"), "Header hint not shown.")
@@ -249,7 +249,7 @@ class TestCSVFeatures < Test::Unit::TestCase
assert_match(/headers:\[[^\]]+\]/, csv.inspect)
end
end
-
+
def test_inspect_encoding_is_ascii_compatible
CSV.new("one,two,three\n1,2,3\n".encode("UTF-16BE")) do |csv|
assert( Encoding.compatible?( Encoding.find("US-ASCII"),
@@ -257,7 +257,7 @@ class TestCSVFeatures < Test::Unit::TestCase
"inspect() was not ASCII compatible." )
end
end
-
+
def test_version
assert_not_nil(CSV::VERSION)
assert_instance_of(String, CSV::VERSION)
diff --git a/test/csv/test_headers.rb b/test/csv/test_headers.rb
index 6ce56758168..6e56ffc27c1 100644
--- a/test/csv/test_headers.rb
+++ b/test/csv/test_headers.rb
@@ -19,12 +19,12 @@ class TestCSVHeaders < Test::Unit::TestCase
1,2,3
END_CSV
end
-
+
def test_first_row
[:first_row, true].each do |setting| # two names for the same setting
# activate headers
csv = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
csv = CSV.parse(@data, headers: setting)
end
@@ -44,11 +44,11 @@ class TestCSVHeaders < Test::Unit::TestCase
assert_nil(csv[2])
end
end
-
+
def test_array_of_headers
# activate headers
csv = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
csv = CSV.parse(@data, headers: [:my, :new, :headers])
end
@@ -73,7 +73,7 @@ class TestCSVHeaders < Test::Unit::TestCase
# empty
assert_nil(csv[3])
-
+
# with return and convert
assert_nothing_raised(Exception) do
csv = CSV.parse( @data, headers: [:my, :new, :headers],
@@ -87,11 +87,11 @@ class TestCSVHeaders < Test::Unit::TestCase
assert(row.header_row?)
assert(!row.field_row?)
end
-
+
def test_csv_header_string
# activate headers
csv = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
csv = CSV.parse(@data, headers: "my,new,headers")
end
@@ -115,7 +115,7 @@ class TestCSVHeaders < Test::Unit::TestCase
# empty
assert_nil(csv[3])
-
+
# with return and convert
assert_nothing_raised(Exception) do
csv = CSV.parse( @data, headers: "my,new,headers",
@@ -129,11 +129,11 @@ class TestCSVHeaders < Test::Unit::TestCase
assert(row.header_row?)
assert(!row.field_row?)
end
-
+
def test_csv_header_string_inherits_separators
# parse with custom col_sep
csv = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
csv = CSV.parse( @data.tr(",", "|"), col_sep: "|",
headers: "my|new|headers" )
end
@@ -144,7 +144,7 @@ class TestCSVHeaders < Test::Unit::TestCase
assert_instance_of(CSV::Row, row)
assert_equal([%w{my first}, %w{new second}, %w{headers third}], row.to_a)
end
-
+
def test_return_headers
# activate headers and request they are returned
csv = nil
@@ -180,14 +180,14 @@ class TestCSVHeaders < Test::Unit::TestCase
# empty
assert_nil(csv[3])
end
-
+
def test_converters
# create test data where headers and fields look alike
data = <<-END_MATCHING_CSV.gsub(/^\s+/, "")
1,2,3
1,2,3
END_MATCHING_CSV
-
+
# normal converters do not affect headers
csv = CSV.parse( data, headers: true,
return_headers: true,
@@ -195,9 +195,9 @@ class TestCSVHeaders < Test::Unit::TestCase
assert_equal([%w{1 1}, %w{2 2}, %w{3 3}], csv[0].to_a)
assert_equal([["1", 1], ["2", 2], ["3", 3]], csv[1].to_a)
assert_nil(csv[2])
-
+
# header converters do affect headers (only)
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
csv = CSV.parse( data, headers: true,
return_headers: true,
converters: :numeric,
@@ -207,21 +207,21 @@ class TestCSVHeaders < Test::Unit::TestCase
assert_equal([[:"1", 1], [:"2", 2], [:"3", 3]], csv[1].to_a)
assert_nil(csv[2])
end
-
+
def test_builtin_downcase_converter
csv = CSV.parse( "One,TWO Three", headers: true,
return_headers: true,
header_converters: :downcase )
assert_equal(%w{one two\ three}, csv.headers)
end
-
+
def test_builtin_symbol_converter
csv = CSV.parse( "One,TWO Three", headers: true,
return_headers: true,
header_converters: :symbol )
assert_equal([:one, :two_three], csv.headers)
end
-
+
def test_custom_converter
converter = lambda { |header| header.tr(" ", "_") }
csv = CSV.parse( "One,TWO Three",
@@ -230,56 +230,56 @@ class TestCSVHeaders < Test::Unit::TestCase
header_converters: converter )
assert_equal(%w{One TWO_Three}, csv.headers)
end
-
+
def test_table_support
csv = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
csv = CSV.parse(@data, headers: true)
end
-
+
assert_instance_of(CSV::Table, csv)
end
-
+
def test_skip_blanks
@data = <<-END_CSV.gsub(/^ +/, "")
-
+
A,B,C
-
+
1,2,3
-
-
-
+
+
+
END_CSV
-
+
expected = [%w[1 2 3]]
CSV.parse(@data, headers: true, skip_blanks: true) do |row|
assert_equal(expected.shift, row.fields)
end
-
+
expected = [%w[A B C], %w[1 2 3]]
CSV.parse( @data,
headers: true,
- return_headers: true,
+ return_headers: true,
skip_blanks: true ) do |row|
assert_equal(expected.shift, row.fields)
end
end
-
+
def test_headers_reader
# no headers
assert_nil(CSV.new(@data).headers)
-
+
# headers
csv = CSV.new(@data, headers: true)
assert_equal(true, csv.headers) # before headers are read
csv.shift # set headers
assert_equal(%w[first second third], csv.headers) # after headers are read
end
-
+
def test_blank_row_bug_fix
@data += "\n#{@data}" # add a blank row
-
+
# ensure that everything returned is a Row object
CSV.parse(@data, headers: true) do |row|
assert_instance_of(CSV::Row, row)
diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb
index b9e634a5594..a6028f92f35 100644
--- a/test/csv/test_interface.rb
+++ b/test/csv/test_interface.rb
@@ -14,7 +14,7 @@ require "csv"
class TestCSVInterface < Test::Unit::TestCase
def setup
@path = File.join(File.dirname(__FILE__), "temp_test_data.csv")
-
+
File.open(@path, "w") do |file|
file << "1\t2\t3\r\n"
file << "4\t5\r\n"
@@ -22,19 +22,19 @@ class TestCSVInterface < Test::Unit::TestCase
@expected = [%w{1 2 3}, %w{4 5}]
end
-
+
def teardown
File.unlink(@path)
end
-
+
### Test Read Interface ###
-
+
def test_foreach
CSV.foreach(@path, col_sep: "\t", row_sep: "\r\n") do |row|
assert_equal(@expected.shift, row)
end
end
-
+
def test_open_and_close
csv = CSV.open(@path, "r+", col_sep: "\t", row_sep: "\r\n")
assert_not_nil(csv)
@@ -42,7 +42,7 @@ class TestCSVInterface < Test::Unit::TestCase
assert_equal(false, csv.closed?)
csv.close
assert(csv.closed?)
-
+
ret = CSV.open(@path) do |new_csv|
csv = new_csv
assert_instance_of(CSV, new_csv)
@@ -51,7 +51,7 @@ class TestCSVInterface < Test::Unit::TestCase
assert(csv.closed?)
assert_equal("Return value.", ret)
end
-
+
def test_parse
data = File.read(@path)
assert_equal( @expected,
@@ -61,27 +61,27 @@ class TestCSVInterface < Test::Unit::TestCase
assert_equal(@expected.shift, row)
end
end
-
+
def test_parse_line
row = CSV.parse_line("1;2;3", col_sep: ";")
assert_not_nil(row)
assert_instance_of(Array, row)
assert_equal(%w{1 2 3}, row)
-
+
# shortcut interface
row = "1;2;3".parse_csv(col_sep: ";")
assert_not_nil(row)
assert_instance_of(Array, row)
assert_equal(%w{1 2 3}, row)
end
-
+
def test_read_and_readlines
assert_equal( @expected,
CSV.read(@path, col_sep: "\t", row_sep: "\r\n") )
assert_equal( @expected,
CSV.readlines(@path, col_sep: "\t", row_sep: "\r\n") )
-
-
+
+
data = CSV.open(@path, col_sep: "\t", row_sep: "\r\n") do |csv|
csv.read
end
@@ -91,13 +91,13 @@ class TestCSVInterface < Test::Unit::TestCase
end
assert_equal(@expected, data)
end
-
+
def test_table
table = CSV.table(@path, col_sep: "\t", row_sep: "\r\n")
assert_instance_of(CSV::Table, table)
assert_equal([[:"1", :"2", :"3"], [4, 5, nil]], table.to_a)
end
-
+
def test_shift # aliased as gets() and readline()
CSV.open(@path, "r+", col_sep: "\t", row_sep: "\r\n") do |csv|
assert_equal(@expected.shift, csv.shift)
@@ -105,7 +105,7 @@ class TestCSVInterface < Test::Unit::TestCase
assert_equal(nil, csv.shift)
end
end
-
+
### Test Write Interface ###
def test_generate
@@ -123,13 +123,13 @@ class TestCSVInterface < Test::Unit::TestCase
end
assert_equal(%Q{1,2,3\n4,,5\nlast,"""row"""\n}, str)
end
-
+
def test_generate_line
line = CSV.generate_line(%w{1 2 3}, col_sep: ";")
assert_not_nil(line)
assert_instance_of(String, line)
assert_equal("1;2;3\n", line)
-
+
# shortcut interface
line = %w{1 2 3}.to_csv(col_sep: ";")
assert_not_nil(line)
@@ -173,7 +173,7 @@ class TestCSVInterface < Test::Unit::TestCase
csv.each { |line| assert_equal(lines.shift, line.to_hash) }
end
end
-
+
def test_write_hash_with_headers_array
File.unlink(@path)
@@ -216,7 +216,7 @@ class TestCSVInterface < Test::Unit::TestCase
csv.each { |line| assert_equal(lines.shift, line.to_hash) }
end
end
-
+
def test_write_headers
File.unlink(@path)
@@ -241,10 +241,10 @@ class TestCSVInterface < Test::Unit::TestCase
csv.each { |line| assert_equal(lines.shift, line.to_hash) }
end
end
-
+
def test_append # aliased add_row() and puts()
File.unlink(@path)
-
+
CSV.open(@path, "w", col_sep: "\t", row_sep: "\r\n") do |csv|
@expected.each { |row| csv << row }
end
@@ -253,19 +253,19 @@ class TestCSVInterface < Test::Unit::TestCase
# same thing using CSV::Row objects
File.unlink(@path)
-
+
CSV.open(@path, "w", col_sep: "\t", row_sep: "\r\n") do |csv|
@expected.each { |row| csv << CSV::Row.new(Array.new, row) }
end
test_shift
end
-
+
### Test Read and Write Interface ###
-
+
def test_filter
assert_respond_to(CSV, :filter)
-
+
expected = [[1, 2, 3], [4, 5]]
CSV.filter( "1;2;3\n4;5\n", (result = String.new),
in_col_sep: ";", out_col_sep: ",",
@@ -276,27 +276,27 @@ class TestCSVInterface < Test::Unit::TestCase
end
assert_equal("2,4,6,\"Added\r\"\n8,10,\"Added\r\"\n", result)
end
-
+
def test_instance
csv = String.new
-
+
first = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
first = CSV.instance(csv, col_sep: ";")
first << %w{a b c}
end
-
+
assert_equal("a;b;c\n", csv)
-
+
second = nil
- assert_nothing_raised(Exception) do
+ assert_nothing_raised(Exception) do
second = CSV.instance(csv, col_sep: ";")
second << [1, 2, 3]
end
-
+
assert_equal(first.object_id, second.object_id)
assert_equal("a;b;c\n1;2;3\n", csv)
-
+
# shortcuts
assert_equal(STDOUT, CSV.instance.instance_eval { @io })
assert_equal(STDOUT, CSV { |new_csv| new_csv.instance_eval { @io } })
diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb
index d0b0cdc4067..f9aa9597013 100644
--- a/test/csv/test_row.rb
+++ b/test/csv/test_row.rb
@@ -15,27 +15,27 @@ class TestCSVRow < Test::Unit::TestCase
def setup
@row = CSV::Row.new(%w{A B C A A}, [1, 2, 3, 4])
end
-
+
def test_initialize
# basic
row = CSV::Row.new(%w{A B C}, [1, 2, 3])
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([["A", 1], ["B", 2], ["C", 3]], row.to_a)
-
+
# missing headers
row = CSV::Row.new(%w{A}, [1, 2, 3])
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([["A", 1], [nil, 2], [nil, 3]], row.to_a)
-
+
# missing fields
row = CSV::Row.new(%w{A B C}, [1, 2])
assert_not_nil(row)
assert_instance_of(CSV::Row, row)
assert_equal([["A", 1], ["B", 2], ["C", nil]], row.to_a)
end
-
+
def test_row_type
# field rows
row = CSV::Row.new(%w{A B C}, [1, 2, 3]) # implicit
@@ -50,11 +50,11 @@ class TestCSVRow < Test::Unit::TestCase
assert(row.header_row?)
assert(!row.field_row?)
end
-
+
def test_headers
assert_equal(%w{A B C A A}, @row.headers)
end
-
+
def test_field
# by name
assert_equal(2, @row.field("B"))
@@ -62,11 +62,11 @@ class TestCSVRow < Test::Unit::TestCase
# by index
assert_equal(3, @row.field(2))
-
+
# missing
assert_nil(@row.field("Missing"))
assert_nil(@row.field(10))
-
+
# minimum index
assert_equal(1, @row.field("A"))
assert_equal(1, @row.field("A", 0))
@@ -76,24 +76,24 @@ class TestCSVRow < Test::Unit::TestCase
assert_equal(nil, @row.field("A", 4))
assert_equal(nil, @row.field("A", 5))
end
-
+
def test_set_field
# set field by name
assert_equal(100, @row["A"] = 100)
-
+
# set field by index
assert_equal(300, @row[3] = 300)
-
+
# set field by name and minimum index
assert_equal([:a, :b, :c], @row["A", 4] = [:a, :b, :c])
-
+
# verify the changes
assert_equal( [ ["A", 100],
["B", 2],
["C", 3],
["A", 300],
["A", [:a, :b, :c]] ], @row.to_a )
-
+
# assigning an index past the end
assert_equal("End", @row[10] = "End")
assert_equal( [ ["A", 100],
@@ -107,7 +107,7 @@ class TestCSVRow < Test::Unit::TestCase
[nil, nil],
[nil, nil],
[nil, "End"] ], @row.to_a )
-
+
# assigning a new field by header
assert_equal("New", @row[:new] = "New")
assert_equal( [ ["A", 100],
@@ -123,7 +123,7 @@ class TestCSVRow < Test::Unit::TestCase
[nil, "End"],
[:new, "New"] ], @row.to_a )
end
-
+
def test_append
# add a value
assert_equal(@row, @row << "Value")
@@ -133,7 +133,7 @@ class TestCSVRow < Test::Unit::TestCase
["A", 4],
["A", nil],
[nil, "Value"] ], @row.to_a )
-
+
# add a pair
assert_equal(@row, @row << %w{Header Field})
assert_equal( [ ["A", 1],
@@ -143,7 +143,7 @@ class TestCSVRow < Test::Unit::TestCase
["A", nil],
[nil, "Value"],
%w{Header Field} ], @row.to_a )
-
+
# a pair with Hash syntax
assert_equal(@row, @row << {key: :value})
assert_equal( [ ["A", 1],
@@ -154,7 +154,7 @@ class TestCSVRow < Test::Unit::TestCase
[nil, "Value"],
%w{Header Field},
[:key, :value] ], @row.to_a )
-
+
# multiple fields at once
assert_equal(@row, @row.push(100, 200, [:last, 300]))
assert_equal( [ ["A", 1],
@@ -169,39 +169,39 @@ class TestCSVRow < Test::Unit::TestCase
[nil, 200],
[:last, 300] ], @row.to_a )
end
-
+
def test_delete
# by index
assert_equal(["B", 2], @row.delete(1))
# by header
assert_equal(["C", 3], @row.delete("C"))
-
+
# using a block
assert_equal(@row, @row.delete_if { |h, f| h == "A" and not f.nil? })
assert_equal([["A", nil]], @row.to_a)
end
-
+
def test_fields
# all fields
assert_equal([1, 2, 3, 4, nil], @row.fields)
-
+
# by header
assert_equal([1, 3], @row.fields("A", "C"))
-
+
# by index
assert_equal([2, 3, nil], @row.fields(1, 2, 10))
-
+
# by both
assert_equal([2, 3, 4], @row.fields("B", "C", 3))
-
+
# with minimum indices
assert_equal([2, 3, 4], @row.fields("B", "C", ["A", 3]))
-
+
# by header range
assert_equal([2, 3], @row.values_at("B".."C"))
end
-
+
def test_index
# basic usage
assert_equal(0, @row.index("A"))
@@ -218,20 +218,20 @@ class TestCSVRow < Test::Unit::TestCase
assert_equal(4, @row.index("A", 4))
assert_equal(nil, @row.index("A", 5))
end
-
+
def test_queries
# headers
assert(@row.header?("A"))
assert(@row.header?("C"))
assert(!@row.header?("Z"))
assert(@row.include?("A")) # alias
-
+
# fields
assert(@row.field?(4))
assert(@row.field?(nil))
assert(!@row.field?(10))
end
-
+
def test_each
# array style
ary = @row.to_a
@@ -239,25 +239,25 @@ class TestCSVRow < Test::Unit::TestCase
assert_equal(ary.first.first, pair.first)
assert_equal(ary.shift.last, pair.last)
end
-
+
# hash style
ary = @row.to_a
@row.each do |header, field|
assert_equal(ary.first.first, header)
assert_equal(ary.shift.last, field)
end
-
+
# verify that we can chain the call
assert_equal(@row, @row.each { })
end
-
+
def test_enumerable
assert_equal( [["A", 1], ["A", 4], ["A", nil]],
@row.select { |pair| pair.first == "A" } )
-
+
assert_equal(10, @row.inject(0) { |sum, (header, n)| sum + (n || 0) })
end
-
+
def test_to_a
row = CSV::Row.new(%w{A B C}, [1, 2, 3]).to_a
assert_instance_of(Array, row)
@@ -267,27 +267,27 @@ class TestCSVRow < Test::Unit::TestCase
end
assert_equal([["A", 1], ["B", 2], ["C", 3]], row)
end
-
+
def test_to_hash
assert_equal({"A" => nil, "B" => 2, "C" => 3}, @row.to_hash)
end
-
+
def test_to_csv
# normal conversion
assert_equal("1,2,3,4,\n", @row.to_csv)
assert_equal("1,2,3,4,\n", @row.to_s) # alias
-
+
# with options
assert_equal( "1|2|3|4|\r\n",
@row.to_csv(col_sep: "|", row_sep: "\r\n") )
end
-
+
def test_array_delegation
assert(!@row.empty?, "Row was empty.")
-
+
assert_equal([@row.headers.size, @row.fields.size].max, @row.size)
end
-
+
def test_inspect_shows_header_field_pairs
str = @row.inspect
@row.each do |header, field|
@@ -295,13 +295,13 @@ class TestCSVRow < Test::Unit::TestCase
"Header field pair not found." )
end
end
-
+
def test_inspect_encoding_is_ascii_compatible
assert( Encoding.compatible?( Encoding.find("US-ASCII"),
@row.inspect.encoding ),
"inspect() was not ASCII compatible." )
end
-
+
def test_inspect_shows_symbol_headers_as_bare_attributes
str = CSV::Row.new(@row.headers.map { |h| h.to_sym }, @row.fields).inspect
@row.each do |header, field|
diff --git a/test/csv/test_serialization.rb b/test/csv/test_serialization.rb
index 878619f58a5..f8e6df1b1de 100644
--- a/test/csv/test_serialization.rb
+++ b/test/csv/test_serialization.rb
@@ -16,48 +16,48 @@ class Hash
def self.csv_load( meta, headers, fields )
self[*headers.zip(fields).to_a.flatten.map { |e| eval(e) }]
end
-
+
def csv_headers
keys.map { |key| key.inspect }
end
-
+
def csv_dump( headers )
headers.map { |header| fetch(eval(header)).inspect }
end
end
class TestSerialization < Test::Unit::TestCase
-
+
### Classes Used to Test Serialization ###
-
+
class ReadOnlyName
def initialize( first, last )
@first, @last = first, last
end
attr_reader :first, :last
-
+
def ==( other )
%w{first last}.all? { |att| send(att) == other.send(att) }
end
end
Name = Struct.new(:first, :last)
-
+
class FullName < Name
def initialize( first, last, suffix = nil )
super(first, last)
-
+
@suffix = suffix
end
-
+
attr_accessor :suffix
-
+
def ==( other )
%w{first last suffix}.all? { |att| send(att) == other.send(att) }
end
end
-
+
### Tests ###
def test_class_dump
@@ -66,8 +66,8 @@ class TestSerialization < Test::Unit::TestCase
%w{Greg Brown} ].map do |first, last|
ReadOnlyName.new(first, last)
end
-
- assert_nothing_raised(Exception) do
+
+ assert_nothing_raised(Exception) do
@data = CSV.dump(@names)
end
assert_equal(<<-END_CLASS_DUMP.gsub(/^\s*/, ""), @data)
@@ -78,15 +78,15 @@ class TestSerialization < Test::Unit::TestCase
Greg,Brown
END_CLASS_DUMP
end
-
+
def test_struct_dump
@names = [ %w{James Gray},
%w{Dana Gray},
%w{Greg Brown} ].map do |first, last|
Name.new(first, last)
end
-
- assert_nothing_raised(Exception) do
+
+ assert_nothing_raised(Exception) do
@data = CSV.dump(@names)
end
assert_equal(<<-END_STRUCT_DUMP.gsub(/^\s*/, ""), @data)
@@ -97,15 +97,15 @@ class TestSerialization < Test::Unit::TestCase
Greg,Brown
END_STRUCT_DUMP
end
-
+
def test_inherited_struct_dump
@names = [ %w{James Gray II},
%w{Dana Gray},
%w{Greg Brown} ].map do |first, last, suffix|
FullName.new(first, last, suffix)
end
-
- assert_nothing_raised(Exception) do
+
+ assert_nothing_raised(Exception) do
@data = CSV.dump(@names)
end
assert_equal(<<-END_STRUCT_DUMP.gsub(/^\s*/, ""), @data)
@@ -116,7 +116,7 @@ class TestSerialization < Test::Unit::TestCase
,Greg,Brown
END_STRUCT_DUMP
end
-
+
def test_load
%w{ test_class_dump
test_struct_dump
@@ -128,13 +128,13 @@ class TestSerialization < Test::Unit::TestCase
end
end
end
-
+
def test_io
test_class_dump
-
+
data_file = File.join(File.dirname(__FILE__), "temp_test_data.csv")
CSV.dump(@names, File.open(data_file, "w"))
-
+
assert(File.exist?(data_file))
assert_equal(<<-END_IO_DUMP.gsub(/^\s*/, ""), File.read(data_file))
class,TestSerialization::ReadOnlyName
@@ -143,12 +143,12 @@ class TestSerialization < Test::Unit::TestCase
Dana,Gray
Greg,Brown
END_IO_DUMP
-
+
assert_equal(@names, CSV.load(File.open(data_file)))
-
+
File.unlink(data_file)
end
-
+
def test_custom_dump_and_load
obj = {1 => "simple", test: Hash}
assert_equal(obj, CSV.load(CSV.dump([obj])).first)
diff --git a/test/csv/test_table.rb b/test/csv/test_table.rb
index d0b4d101033..e87f1b25452 100644
--- a/test/csv/test_table.rb
+++ b/test/csv/test_table.rb
@@ -27,32 +27,32 @@ class TestCSVTable < Test::Unit::TestCase
assert_not_nil(@table)
assert_instance_of(CSV::Table, @table)
end
-
+
def test_modes
assert_equal(:col_or_row, @table.mode)
-
+
# non-destructive changes, intended for one shot calls
cols = @table.by_col
assert_equal(:col_or_row, @table.mode)
assert_equal(:col, cols.mode)
assert_equal(@table, cols)
-
+
rows = @table.by_row
assert_equal(:col_or_row, @table.mode)
assert_equal(:row, rows.mode)
assert_equal(@table, rows)
-
+
# destructive mode changing calls
assert_equal(@table, @table.by_row!)
assert_equal(:row, @table.mode)
assert_equal(@table, @table.by_col_or_row!)
assert_equal(:col_or_row, @table.mode)
end
-
+
def test_headers
assert_equal(@rows.first.headers, @table.headers)
end
-
+
def test_index
##################
### Mixed Mode ###
@@ -60,40 +60,40 @@ class TestCSVTable < Test::Unit::TestCase
# by row
@rows.each_index { |i| assert_equal(@rows[i], @table[i]) }
assert_equal(nil, @table[100]) # empty row
-
+
# by col
@rows.first.headers.each do |header|
assert_equal(@rows.map { |row| row[header] }, @table[header])
end
assert_equal([nil] * @rows.size, @table["Z"]) # empty col
-
+
# by cell, row then col
assert_equal(2, @table[0][1])
assert_equal(6, @table[1]["C"])
-
+
# by cell, col then row
assert_equal(5, @table["B"][1])
assert_equal(9, @table["C"][2])
-
+
# with headers (by col)
assert_equal(["B", 2, 5, 8], @header_table["B"])
-
+
###################
### Column Mode ###
###################
@table.by_col!
-
+
assert_equal([2, 5, 8], @table[1])
assert_equal([2, 5, 8], @table["B"])
-
+
################
### Row Mode ###
################
@table.by_row!
-
+
assert_equal(@rows[1], @table[1])
assert_raise(TypeError) { @table["B"] }
-
+
############################
### One Shot Mode Change ###
############################
@@ -101,7 +101,7 @@ class TestCSVTable < Test::Unit::TestCase
assert_equal([2, 5, 8], @table.by_col[1])
assert_equal(@rows[1], @table[1])
end
-
+
def test_set_row_or_column
##################
### Mixed Mode ###
@@ -113,7 +113,7 @@ class TestCSVTable < Test::Unit::TestCase
@table[3] = CSV::Row.new(%w[A B C], [13, 14, 15])
assert_equal( [%w[A B C], [1, 2, 3], [4, 5, 6], [10, 11, 12], [13, 14, 15]],
@table.to_a )
-
+
# set col
@table["Type"] = "data"
assert_equal( [ %w[A B C Type],
@@ -147,7 +147,7 @@ class TestCSVTable < Test::Unit::TestCase
10,,12,data,3
13,,15,data,
END_RESULT
-
+
# with headers
@header_table["Type"] = "data"
assert_equal(%w[Type data data data], @header_table["Type"])
@@ -156,7 +156,7 @@ class TestCSVTable < Test::Unit::TestCase
### Column Mode ###
###################
@table.by_col!
-
+
@table[1] = [2, 5, 11, 14]
assert_equal( [ %w[A B C Type Index],
[1, 2, 3, "data", 1],
@@ -164,7 +164,7 @@ class TestCSVTable < Test::Unit::TestCase
[10, 11, 12, "data", 3],
[13, 14, 15, "data", nil] ],
@table.to_a )
-
+
@table["Extra"] = "new stuff"
assert_equal( [ %w[A B C Type Index Extra],
[1, 2, 3, "data", 1, "new stuff"],
@@ -177,7 +177,7 @@ class TestCSVTable < Test::Unit::TestCase
### Row Mode ###
################
@table.by_row!
-
+
@table[1] = (1..6).to_a
assert_equal( [ %w[A B C Type Index Extra],
[1, 2, 3, "data", 1, "new stuff"],
@@ -185,10 +185,10 @@ class TestCSVTable < Test::Unit::TestCase
[10, 11, 12, "data", 3, "new stuff"],
[13, 14, 15, "data", nil, "new stuff"] ],
@table.to_a )
-
+
assert_raise(TypeError) { @table["Extra"] = nil }
end
-
+
def test_each
######################
### Mixed/Row Mode ###
@@ -201,43 +201,43 @@ class TestCSVTable < Test::Unit::TestCase
# verify that we can chain the call
assert_equal(@table, @table.each { })
-
+
###################
### Column Mode ###
###################
@table.by_col!
-
+
headers = @table.headers
@table.each do |header, column|
assert_equal(headers.shift, header)
assert_equal(@table[header], column)
end
-
+
############################
### One Shot Mode Change ###
############################
@table.by_col_or_row!
-
+
@table.each { |row| assert_instance_of(CSV::Row, row) }
@table.by_col.each { |tuple| assert_instance_of(Array, tuple) }
@table.each { |row| assert_instance_of(CSV::Row, row) }
end
-
+
def test_enumerable
assert_equal( @rows.values_at(0, 2),
@table.select { |row| (row["B"] % 2).zero? } )
-
+
assert_equal(@rows[1], @table.find { |row| row["C"] > 5 })
end
-
+
def test_to_a
assert_equal([%w[A B C], [1, 2, 3], [4, 5, 6], [7, 8, 9]], @table.to_a)
-
+
# with headers
assert_equal( [%w[A B C], [1, 2, 3], [4, 5, 6], [7, 8, 9]],
@header_table.to_a )
end
-
+
def test_to_csv
csv = <<-END_CSV.gsub(/^\s+/, "")
A,B,C
@@ -245,11 +245,11 @@ class TestCSVTable < Test::Unit::TestCase
4,5,6
7,8,9
END_CSV
-
+
# normal conversion
assert_equal(csv, @table.to_csv)
assert_equal(csv, @table.to_s) # alias
-
+
# with options
assert_equal( csv.gsub(",", "|").gsub("\n", "\r\n"),
@table.to_csv(col_sep: "|", row_sep: "\r\n") )
@@ -257,36 +257,36 @@ class TestCSVTable < Test::Unit::TestCase
# with headers
assert_equal(csv, @header_table.to_csv)
end
-
+
def test_append
# verify that we can chain the call
assert_equal(@table, @table << [10, 11, 12])
-
+
# Array append
assert_equal(CSV::Row.new(%w[A B C], [10, 11, 12]), @table[-1])
-
+
# Row append
assert_equal(@table, @table << CSV::Row.new(%w[A B C], [13, 14, 15]))
assert_equal(CSV::Row.new(%w[A B C], [13, 14, 15]), @table[-1])
end
-
+
def test_delete
##################
### Mixed Mode ###
##################
# delete a row
assert_equal(@rows[1], @table.delete(1))
-
+
# delete a col
assert_equal(@rows.map { |row| row["A"] }, @table.delete("A"))
-
+
# verify resulting table
assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv)
B,C
2,3
8,9
END_RESULT
-
+
###################
### Column Mode ###
###################
@@ -295,7 +295,7 @@ class TestCSVTable < Test::Unit::TestCase
assert_equal(@rows.map { |row| row[0] }, @table.delete(0))
assert_equal(@rows.map { |row| row["C"] }, @table.delete("C"))
-
+
# verify resulting table
assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv)
B
@@ -303,7 +303,7 @@ class TestCSVTable < Test::Unit::TestCase
5
8
END_RESULT
-
+
################
### Row Mode ###
################
@@ -312,7 +312,7 @@ class TestCSVTable < Test::Unit::TestCase
assert_equal(@rows[1], @table.delete(1))
assert_raise(TypeError) { @table.delete("C") }
-
+
# verify resulting table
assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv)
A,B,C
@@ -320,7 +320,7 @@ class TestCSVTable < Test::Unit::TestCase
7,8,9
END_RESULT
end
-
+
def test_delete_if
######################
### Mixed/Row Mode ###
@@ -333,13 +333,13 @@ class TestCSVTable < Test::Unit::TestCase
A,B,C
4,5,6
END_RESULT
-
+
###################
### Column Mode ###
###################
setup
@table.by_col!
-
+
assert_equal(@table, @table.delete_if { |h, v| h > "A" })
assert_equal(<<-END_RESULT.gsub(/^\s+/, ""), @table.to_csv)
A
@@ -348,7 +348,7 @@ class TestCSVTable < Test::Unit::TestCase
7
END_RESULT
end
-
+
def test_values_at
##################
### Mixed Mode ###
@@ -356,27 +356,27 @@ class TestCSVTable < Test::Unit::TestCase
# rows
assert_equal(@rows.values_at(0, 2), @table.values_at(0, 2))
assert_equal(@rows.values_at(1..2), @table.values_at(1..2))
-
+
# cols
assert_equal([[1, 3], [4, 6], [7, 9]], @table.values_at("A", "C"))
assert_equal([[2, 3], [5, 6], [8, 9]], @table.values_at("B".."C"))
-
+
###################
### Column Mode ###
###################
@table.by_col!
-
+
assert_equal([[1, 3], [4, 6], [7, 9]], @table.values_at(0, 2))
assert_equal([[1, 3], [4, 6], [7, 9]], @table.values_at("A", "C"))
-
+
################
### Row Mode ###
################
@table.by_row!
-
+
assert_equal(@rows.values_at(0, 2), @table.values_at(0, 2))
assert_raise(TypeError) { @table.values_at("A", "C") }
-
+
############################
### One Shot Mode Change ###
############################
@@ -384,22 +384,22 @@ class TestCSVTable < Test::Unit::TestCase
assert_equal([[1, 3], [4, 6], [7, 9]], @table.by_col.values_at(0, 2))
assert_equal(@rows.values_at(0, 2), @table.values_at(0, 2))
end
-
+
def test_array_delegation
assert(!@table.empty?, "Table was empty.")
-
+
assert_equal(@rows.size, @table.size)
end
-
+
def test_inspect_shows_current_mode
str = @table.inspect
assert(str.include?("mode:#{@table.mode}"), "Mode not shown.")
-
+
@table.by_col!
str = @table.inspect
assert(str.include?("mode:#{@table.mode}"), "Mode not shown.")
end
-
+
def test_inspect_encoding_is_ascii_compatible
assert( Encoding.compatible?( Encoding.find("US-ASCII"),
@table.inspect.encoding ),
diff --git a/test/date/test_date_base.rb b/test/date/test_date_base.rb
index 4b9bcf2aa4a..a8dc2ee6b2a 100644
--- a/test/date/test_date_base.rb
+++ b/test/date/test_date_base.rb
@@ -262,19 +262,19 @@ class TestDateBase < Test::Unit::TestCase
end
end
- # October 1582
+ # October 1582
# S M Tu W Th F S
# 274 275 276 277 288 289
# 290 291 292 293 294 295 296
# 297 298 299 300 301 302 303
- # 304
+ # 304
- # October 1582
+ # October 1582
# S M Tu W Th F S
# -92 -91 -90 -89 -78 -77
# -76 -75 -74 -73 -72 -71 -70
# -69 -68 -67 -66 -65 -64 -63
- # -62
+ # -62
def test_valid_ordinal__italy
valid_ordinal_p = :_valid_ordinal?
@@ -286,7 +286,7 @@ class TestDateBase < Test::Unit::TestCase
end
end
- # September 1752
+ # September 1752
# S M Tu W Th F S
# 245 246 258 259 260
# 261 262 263 264 265 266 267
@@ -327,12 +327,12 @@ class TestDateBase < Test::Unit::TestCase
end
end
- # October 1582
+ # October 1582
# S M Tu W Th F S
# 1 2 3 4 15 16
# 17 18 19 20 21 22 23
# 24 25 26 27 28 29 30
- # 31
+ # 31
def test_valid_civil__italy
valid_civil_p = :_valid_civil?
@@ -356,7 +356,7 @@ class TestDateBase < Test::Unit::TestCase
end
end
- # September 1752
+ # September 1752
# S M Tu W Th F S
# 1 2 14 15 16
# 17 18 19 20 21 22 23
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index c44523fd987..959a6e5d954 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -110,7 +110,7 @@ class TestDateParse < Test::Unit::TestCase
# broken iso 8601 (?)
# [['1999-05-23T235521Z',false],[1999,5,23,23,55,21,'Z',0,nil]], # cp
- [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
+ [['19990523T23:55:21Z',false],[1999,5,23,23,55,21,'Z',0,nil]],
[['19990523235521.1234-100',true],[1999,5,23,23,55,21,'-100',-1*3600,nil]],
[['19990523235521.1234-10',true],[1999,5,23,23,55,21,'-10',-10*3600,nil]],
diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb
index 4131af3aab3..117517256ce 100644
--- a/test/date/test_date_strftime.rb
+++ b/test/date/test_date_strftime.rb
@@ -382,7 +382,7 @@ class TestDateStrftime < Test::Unit::TestCase
H18.09.01).each do |s|
assert_equal(s, Date.parse(s).jisx0301)
end
-
+
end
end
diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb
index 1845a6db556..14fd83899ed 100644
--- a/test/dbm/test_dbm.rb
+++ b/test/dbm/test_dbm.rb
@@ -37,7 +37,7 @@ if defined? DBM
DBM.open("#{@tmpdir}/#{@prefix}_rdonly") {|dbm|
dbm['foo'] = 'FOO'
}
-
+
File.chmod(0400, *Dir.glob("#{@tmpdir}/#{@prefix}_rdonly.*"))
assert_instance_of(DBM, @dbm_rdonly = DBM.new("#{@tmpdir}/#{@prefix}_rdonly", nil))
@@ -530,7 +530,7 @@ if defined? DBM
DBM.open("#{@tmproot}/a") {} # create a db.
v = DBM.open("#{@tmproot}/a", nil, DBM::READER) {|d|
# Errno::EPERM is raised on Solaris which use ndbm.
- # DBMError is raised on Debian which use gdbm.
+ # DBMError is raised on Debian which use gdbm.
assert_raise(Errno::EPERM, DBMError) { d["k"] = "v" }
true
}
diff --git a/test/dl/test_base.rb b/test/dl/test_base.rb
index e24ed7ba2c4..439739bcf5b 100644
--- a/test/dl/test_base.rb
+++ b/test/dl/test_base.rb
@@ -47,7 +47,7 @@ module DL
@libc = dlopen(LIBC_SO)
@libm = dlopen(LIBM_SO)
end
-
+
def assert_match(expected, actual, message="")
assert(expected === actual, message)
end
diff --git a/test/dl/test_import.rb b/test/dl/test_import.rb
index 8514f8298ec..c70cb9a6d04 100644
--- a/test/dl/test_import.rb
+++ b/test/dl/test_import.rb
@@ -54,7 +54,7 @@ module DL
def test_unsigned_result()
d = (2 ** 31) + 1
-
+
r = LIBC.strtoul(d.to_s, 0, 0)
assert_equal(d, r)
end
@@ -75,7 +75,7 @@ module DL
def test_value()
i = LIBC.value('int', 2)
assert_equal(2, i.value)
-
+
d = LIBC.value('double', 2.0)
assert_equal(2.0, d.value)
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb
index e06139a9d6c..e1d3aeedf21 100644
--- a/test/drb/drbtest.rb
+++ b/test/drb/drbtest.rb
@@ -98,7 +98,7 @@ module DRbCore
assert_equal(6, @there.sample(onecky, 1, 2))
ary = @there.to_a
assert_kind_of(DRb::DRbObject, ary)
-
+
assert(@there.respond_to?(:to_a, true))
assert(@there.respond_to?(:eval, true))
assert(! @there.respond_to?(:eval, false))
diff --git a/test/drb/test_acl.rb b/test/drb/test_acl.rb
index d8955e0e75e..7fe30f4c4ac 100644
--- a/test/drb/test_acl.rb
+++ b/test/drb/test_acl.rb
@@ -192,4 +192,4 @@ class ACLTest < Test::Unit::TestCase
end
end
-
+
diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb
index 57cf7175d73..0548dc7aa01 100644
--- a/test/drb/test_drb.rb
+++ b/test/drb/test_drb.rb
@@ -18,11 +18,11 @@ class TestDRbYield < Test::Unit::TestCase
@there.echo_yield_1([]) {|one|
assert_equal([], one)
}
-
+
@there.echo_yield_1(1) {|one|
assert_equal(1, one)
}
-
+
@there.echo_yield_1(nil) {|one|
assert_equal(nil, one)
}
@@ -140,7 +140,7 @@ class TestDRbRubyYield < TestDRbYield
def setup
@there = self
end
-
+
def teardown
end
end
@@ -150,15 +150,15 @@ class TestDRbRuby18Yield < TestDRbRubyYield
def echo_yield(*arg, &proc)
proc.call(*arg)
end
-
+
def echo_yield_0(&proc)
proc.call
end
-
+
def echo_yield_1(a, &proc)
proc.call(a)
end
-
+
def echo_yield_2(a, b, &proc)
proc.call(a, b)
end
@@ -217,7 +217,7 @@ class TestDRbEval # < Test::Unit::TestCase
def teardown
@ext.stop_service if @ext
end
-
+
def test_01_safe1_safe4_eval
assert_raise(SecurityError) do
@there.method_missing(:instance_eval, 'ENV.inspect')
@@ -239,7 +239,7 @@ class TestDRbEval # < Test::Unit::TestCase
four = @there.four
assert_equal(1, four.method_missing(:send, :eval, '1'))
-
+
remote_class = four.remote_class
assert_equal(1, remote_class.class_eval('1'))
@@ -292,7 +292,7 @@ class TestDRbLarge < Test::Unit::TestCase
ary = ["Hello, World"] * 102400
exception = nil
begin
- @there.size(ary)
+ @there.size(ary)
rescue StandardError
exception = $!
end
diff --git a/test/drb/ut_large.rb b/test/drb/ut_large.rb
index d6717c5589d..9545f78f4b4 100644
--- a/test/drb/ut_large.rb
+++ b/test/drb/ut_large.rb
@@ -6,7 +6,7 @@ class DRbLarge
include DRbUndumped
def size(ary)
- ary.size
+ ary.size
end
def sum(ary)
diff --git a/test/drb/ut_safe1.rb b/test/drb/ut_safe1.rb
index 4df8e1e5a12..97b4df24aba 100644
--- a/test/drb/ut_safe1.rb
+++ b/test/drb/ut_safe1.rb
@@ -8,7 +8,7 @@ if __FILE__ == $0
it
end
- DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6],
+ DRb.start_service('druby://localhost:0', [1, 2, 'III', 4, "five", 6],
{:safe_level => 1})
es = DRb::ExtServ.new(ARGV.shift, ARGV.shift)
DRb.thread.join
diff --git a/test/drb/ut_timerholder.rb b/test/drb/ut_timerholder.rb
index 141cb73302c..6f66dd3393b 100644
--- a/test/drb/ut_timerholder.rb
+++ b/test/drb/ut_timerholder.rb
@@ -34,7 +34,7 @@ class TimerHolderTest < RUNIT::TestCase
assert(!holder.include?(key))
holder.delete(key)
end
-
+
def test_00
do_test(0.5)
end
diff --git a/test/erb/test_erb.rb b/test/erb/test_erb.rb
index be9df0dbc3e..3c54e8a50a5 100644
--- a/test/erb/test_erb.rb
+++ b/test/erb/test_erb.rb
@@ -73,7 +73,7 @@ class TestERBCore < Test::Unit::TestCase
* <%= n %>
<% end %>
EOS
-
+
ans = <<EOS
%% hi
= hello
@@ -118,7 +118,7 @@ EOS
% n=0
* 2
EOS
-
+
erb = @erb.new(src, safe, 2)
assert_equal(ans, erb.result)
erb = @erb.new(src, safe, '<>')
@@ -212,7 +212,7 @@ end%>
%%%
EOS
ans = <<EOS
-%
+%
% %%><%0
% %%><%1
%%
@@ -234,7 +234,7 @@ EOS
klass.module_eval do
def_erb_method('hello_world', erb)
end
- assert(klass.new.respond_to?('hello_world'))
+ assert(klass.new.respond_to?('hello_world'))
end
def test_def_method_without_filename
@@ -300,7 +300,7 @@ EOS
def test_keep_lineno
src = <<EOS
-Hello,
+Hello,
% x = "World"
<%= x%>
% raise("lineno")
@@ -316,21 +316,21 @@ EOS
src = <<EOS
%>
-Hello,
+Hello,
<% x = "World%%>
"%>
<%= x%>
EOS
ans = <<EOS
-%>Hello,
+%>Hello,
World%>
EOS
assert_equal(ans, ERB.new(src, nil, '>').result)
ans = <<EOS
%>
-Hello,
+Hello,
World%>
EOS
@@ -338,7 +338,7 @@ EOS
ans = <<EOS
%>
-Hello,
+Hello,
World%>
@@ -346,7 +346,7 @@ EOS
assert_equal(ans, ERB.new(src).result)
src = <<EOS
-Hello,
+Hello,
<% x = "World%%>
"%>
<%= x%>
@@ -381,7 +381,7 @@ EOS
% y = 'Hello'
<%- x = "World%%>
"-%>
-<%= x %><%- x = nil -%>
+<%= x %><%- x = nil -%>
<% raise("lineno") %>
EOS
@@ -417,19 +417,19 @@ NotSkip <%- y = x -%> NotSkip
<%- up = w.upcase -%>
* <%= up %>
<%- end -%>
-KeepNewLine <%- z = nil -%>
+KeepNewLine <%- z = nil -%>
EOS
ans = <<EOS
NotSkip NotSkip
* HELLO
* WORLD
- NotSkip
+ NotSkip
* hello
* HELLO
* world
* WORLD
-KeepNewLine
+KeepNewLine
EOS
assert_equal(ans, ERB.new(src, nil, '-').result)
assert_equal(ans, ERB.new(src, nil, '-%').result)
diff --git a/test/erb/test_erb_m17n.rb b/test/erb/test_erb_m17n.rb
index 432cb4fd745..640b1e6c51d 100644
--- a/test/erb/test_erb_m17n.rb
+++ b/test/erb/test_erb_m17n.rb
@@ -16,7 +16,7 @@ class TestERB < Test::Unit::TestCase
erb = ERB.new("γεια σας".encode("ISO-8859-7"))
assert_equal Encoding::ISO_8859_7, erb.result.encoding
- assert_raise(ArgumentError, /ASCII compatible/) {
+ assert_raise(ArgumentError, /ASCII compatible/) {
ERB.new("こんにちは".force_encoding("ISO-2022-JP")) # dummy encoding
}
end
diff --git a/test/fileutils/fileasserts.rb b/test/fileutils/fileasserts.rb
index d7845445550..bad87e9ce08 100644
--- a/test/fileutils/fileasserts.rb
+++ b/test/fileutils/fileasserts.rb
@@ -94,7 +94,7 @@ EOT
<#{expected_str}> expected but was
<#{actual_str}>.
EOT
- # subsecond timestamp is not portable.
+ # subsecond timestamp is not portable.
assert_block(full_message) { expected.tv_sec == actual.tv_sec }
}
end
diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb
index 7e28d5121d5..03b5eb792b4 100644
--- a/test/gdbm/test_gdbm.rb
+++ b/test/gdbm/test_gdbm.rb
@@ -696,7 +696,7 @@ if defined? GDBM
def test_newdb_open
GDBM.open("#{@tmproot}/a.dbm") {|dbm|
dbm["k"] = "v"
- }
+ }
v = GDBM.open("#{@tmproot}/a.dbm", nil, GDBM::NEWDB) {|d|
assert_equal(0, d.length)
assert_nil(d["k"])
diff --git a/test/json/test_json.rb b/test/json/test_json.rb
index 02da6d4e7a5..ae77f7b14fb 100755
--- a/test/json/test_json.rb
+++ b/test/json/test_json.rb
@@ -134,7 +134,7 @@ class TC_JSON < Test::Unit::TestCase
assert_equal(@ary,
parse('[[1],["foo"],[3.14],[47.11e+2],[2718.0E-3],[null],[[1,-2,3]]'\
',[false],[true]]'))
- assert_equal(@ary, parse(%Q{ [ [1] , ["foo"] , [3.14] \t , [47.11e+2]
+ assert_equal(@ary, parse(%Q{ [ [1] , ["foo"] , [3.14] \t , [47.11e+2]
, [2718.0E-3 ],\r[ null] , [[1, -2, 3 ]], [false ],[ true]\n ] }))
end
diff --git a/test/json/test_json_addition.rb b/test/json/test_json_addition.rb
index 95b61662616..2650db68f08 100755
--- a/test/json/test_json_addition.rb
+++ b/test/json/test_json_addition.rb
@@ -17,7 +17,7 @@ class TC_JSONAddition < Test::Unit::TestCase
def ==(other)
a == other.a
end
-
+
def self.json_create(object)
new(*object['args'])
end
diff --git a/test/json/test_json_rails.rb b/test/json/test_json_rails.rb
index 52dc29f3882..91eb9ee9ea0 100644
--- a/test/json/test_json_rails.rb
+++ b/test/json/test_json_rails.rb
@@ -17,7 +17,7 @@ class TC_JSONRails < Test::Unit::TestCase
def ==(other)
a == other.a
end
-
+
def self.json_create(object)
new(*object['args'])
end
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 50d1fe2eae7..271c50e8026 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -253,7 +253,7 @@ module TestNetHTTP_version_1_2_methods
assert_kind_of String, res.body
assert_equal $test_net_http_data, res.body
end
-
+
def _test_send_request__POST(http)
data = 'aaabbb cc ddddddddddd lkjoiu4j3qlkuoa'
res = http.send_request('POST', '/', data)
diff --git a/test/net/http/test_https_proxy.rb b/test/net/http/test_https_proxy.rb
index 4f26342339b..5618830587d 100644
--- a/test/net/http/test_https_proxy.rb
+++ b/test/net/http/test_https_proxy.rb
@@ -34,4 +34,4 @@ class HTTPSProxyTest < Test::Unit::TestCase
t.join if t
end
end if defined?(OpenSSL)
-
+
diff --git a/test/nkf/test_kconv.rb b/test/nkf/test_kconv.rb
index d396b4be47f..8581f10e4e6 100644
--- a/test/nkf/test_kconv.rb
+++ b/test/nkf/test_kconv.rb
@@ -21,7 +21,7 @@ class TestKconv < Test::Unit::TestCase
\x1b\x24\x42\x25\x2a\x25\x56\x25\x38\x25\x27\x25\x2f\x25\x48\x3b\x58\x38\x7e\
\x25\x57\x25\x6d\x25\x30\x25\x69\x25\x5f\x25\x73\x25\x30\x38\x40\x38\x6c\x1b\x28\x42
\x52\x75\x62\x79".force_encoding('ISO-2022-JP')
- end
+ end
def test_eucjp
diff --git a/test/openssl/ssl_server.rb b/test/openssl/ssl_server.rb
index 6e620629c5f..d3ad55d236f 100644
--- a/test/openssl/ssl_server.rb
+++ b/test/openssl/ssl_server.rb
@@ -53,7 +53,7 @@ tcps = nil
port = port + i
break
rescue Errno::EADDRINUSE
- next
+ next
end
}
ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
diff --git a/test/openssl/test_ec.rb b/test/openssl/test_ec.rb
index 66dbf54b4d5..282bb676244 100644
--- a/test/openssl/test_ec.rb
+++ b/test/openssl/test_ec.rb
@@ -88,7 +88,7 @@ class OpenSSL::TestEC < Test::Unit::TestCase
for key in @keys
sig = key.dsa_sign_asn1(@data1)
assert_equal(key.dsa_verify_asn1(@data1, sig), true)
-
+
assert_raise(OpenSSL::PKey::ECError) { key.dsa_sign_asn1(@data2) }
end
end
diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb
index 271459f55e1..9d22a87e297 100644
--- a/test/openssl/test_pair.rb
+++ b/test/openssl/test_pair.rb
@@ -57,7 +57,7 @@ module SSLPair
ensure
if th && th.alive?
th.kill
- th.join
+ th.join
end
end
end
diff --git a/test/openssl/test_pkcs7.rb b/test/openssl/test_pkcs7.rb
index 2cdd9343fff..d86de36cc70 100644
--- a/test/openssl/test_pkcs7.rb
+++ b/test/openssl/test_pkcs7.rb
@@ -35,7 +35,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase
@ca_cert, @rsa2048, OpenSSL::Digest::SHA1.new)
end
- def issue_cert(*args)
+ def issue_cert(*args)
OpenSSL::TestUtils.issue_cert(*args)
end
@@ -77,7 +77,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase
assert_equal(@ee1_cert.serial, signers[0].serial)
assert_equal(@ee1_cert.issuer.to_s, signers[0].issuer.to_s)
- # A signed-data which have multiple signatures can be created
+ # A signed-data which have multiple signatures can be created
# through the following steps.
# 1. create two signed-data
# 2. copy signerInfo and certificate from one to another
@@ -85,7 +85,7 @@ class OpenSSL::TestPKCS7 < Test::Unit::TestCase
tmp1 = OpenSSL::PKCS7.sign(@ee1_cert, @rsa1024, data, [], flag)
tmp2 = OpenSSL::PKCS7.sign(@ee2_cert, @rsa1024, data, [], flag)
tmp1.add_signer(tmp2.signers[0])
- tmp1.add_certificate(@ee2_cert)
+ tmp1.add_certificate(@ee2_cert)
p7 = OpenSSL::PKCS7.new(tmp1.to_der)
certs = p7.certificates
diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb
index 2c5886bb420..5053634a847 100644
--- a/test/openssl/test_ssl.rb
+++ b/test/openssl/test_ssl.rb
@@ -82,7 +82,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
end
Thread.start do
- Thread.current.abort_on_exception = true
+ Thread.current.abort_on_exception = true
server_proc.call(ctx, ssl)
end
end
@@ -93,7 +93,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
ctx_proc = args[:ctx_proc]
server_proc = args[:server_proc]
server_proc ||= method(:readwrite_loop)
-
+
store = OpenSSL::X509::Store.new
store.add_cert(@ca_cert)
store.purpose = OpenSSL::X509::PURPOSE_SSL_CLIENT
@@ -120,7 +120,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
begin
server = Thread.new do
- Thread.current.abort_on_exception = true
+ Thread.current.abort_on_exception = true
server_loop(ctx, ssls, server_proc)
end
@@ -532,7 +532,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
ctx.session_add(saved_session)
end
connections += 1
-
+
readwrite_loop(ctx, ssl)
end
diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb
index c092ce57966..398ab2ff345 100644
--- a/test/openssl/test_x509cert.rb
+++ b/test/openssl/test_x509cert.rb
@@ -28,7 +28,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
def test_serial
[1, 2**32, 2**100].each{|s|
cert = issue_cert(@ca, @rsa2048, s, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
assert_equal(s, cert.serial)
cert = OpenSSL::X509::Certificate.new(cert.to_der)
assert_equal(s, cert.serial)
@@ -60,25 +60,25 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
def test_validity
now = Time.now until now && now.usec != 0
cert = issue_cert(@ca, @rsa2048, 1, now, now+3600, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
assert_not_equal(now, cert.not_before)
assert_not_equal(now+3600, cert.not_after)
now = Time.at(now.to_i)
cert = issue_cert(@ca, @rsa2048, 1, now, now+3600, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
assert_equal(now.getutc, cert.not_before)
assert_equal((now+3600).getutc, cert.not_after)
now = Time.at(0)
cert = issue_cert(@ca, @rsa2048, 1, now, now, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
assert_equal(now.getutc, cert.not_before)
assert_equal(now.getutc, cert.not_after)
now = Time.at(0x7fffffff)
cert = issue_cert(@ca, @rsa2048, 1, now, now, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
assert_equal(now.getutc, cert.not_before)
assert_equal(now.getutc, cert.not_after)
end
@@ -91,7 +91,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
["authorityKeyIdentifier","keyid:always",false],
]
ca_cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, ca_exts,
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
ca_cert.extensions.each_with_index{|ext, i|
assert_equal(ca_exts[i].first, ext.oid)
assert_equal(ca_exts[i].last, ext.critical?)
@@ -105,7 +105,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
["subjectAltName","email:ee1@ruby-lang.org",false],
]
ee1_cert = issue_cert(@ee1, @rsa1024, 2, Time.now, Time.now+1800, ee1_exts,
- ca_cert, @rsa2048, OpenSSL::Digest::SHA1.new)
+ ca_cert, @rsa2048, OpenSSL::Digest::SHA1.new)
assert_equal(ca_cert.subject.to_der, ee1_cert.issuer.to_der)
ee1_cert.extensions.each_with_index{|ext, i|
assert_equal(ee1_exts[i].first, ext.oid)
@@ -120,7 +120,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
["subjectAltName","email:ee2@ruby-lang.org",false],
]
ee2_cert = issue_cert(@ee2, @rsa1024, 3, Time.now, Time.now+1800, ee2_exts,
- ca_cert, @rsa2048, OpenSSL::Digest::MD5.new)
+ ca_cert, @rsa2048, OpenSSL::Digest::MD5.new)
assert_equal(ca_cert.subject.to_der, ee2_cert.issuer.to_der)
ee2_cert.extensions.each_with_index{|ext, i|
assert_equal(ee2_exts[i].first, ext.oid)
@@ -131,7 +131,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
def test_sign_and_verify
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
assert_equal(false, cert.verify(@rsa1024))
assert_equal(true, cert.verify(@rsa2048))
assert_equal(false, cert.verify(@dsa256))
@@ -140,7 +140,7 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
assert_equal(false, cert.verify(@rsa2048))
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::MD5.new)
+ nil, nil, OpenSSL::Digest::MD5.new)
assert_equal(false, cert.verify(@rsa1024))
assert_equal(true, cert.verify(@rsa2048))
assert_equal(false, cert.verify(@dsa256))
@@ -149,25 +149,25 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
assert_equal(false, cert.verify(@rsa2048))
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::DSS1.new)
+ nil, nil, OpenSSL::Digest::DSS1.new)
assert_equal(false, cert.verify(@rsa1024))
assert_equal(false, cert.verify(@rsa2048))
assert_equal(false, cert.verify(@dsa256))
assert_equal(true, cert.verify(@dsa512))
- cert.not_after = Time.now
+ cert.not_after = Time.now
assert_equal(false, cert.verify(@dsa512))
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::DSS1.new)
+ nil, nil, OpenSSL::Digest::DSS1.new)
}
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::MD5.new)
+ nil, nil, OpenSSL::Digest::MD5.new)
}
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
- nil, nil, OpenSSL::Digest::SHA1.new)
+ nil, nil, OpenSSL::Digest::SHA1.new)
}
end
end
diff --git a/test/openssl/test_x509crl.rb b/test/openssl/test_x509crl.rb
index 444a00a5868..e1f4e009cd9 100644
--- a/test/openssl/test_x509crl.rb
+++ b/test/openssl/test_x509crl.rb
@@ -125,13 +125,13 @@ class OpenSSL::TestX509CRL < Test::Unit::TestCase
def test_extension
cert_exts = [
["basicConstraints", "CA:TRUE", true],
- ["subjectKeyIdentifier", "hash", false],
- ["authorityKeyIdentifier", "keyid:always", false],
+ ["subjectKeyIdentifier", "hash", false],
+ ["authorityKeyIdentifier", "keyid:always", false],
["subjectAltName", "email:xyzzy@ruby-lang.org", false],
["keyUsage", "cRLSign, keyCertSign", true],
]
crl_exts = [
- ["authorityKeyIdentifier", "keyid:always", false],
+ ["authorityKeyIdentifier", "keyid:always", false],
["issuerAltName", "issuer:copy", false],
]
diff --git a/test/openssl/utils.rb b/test/openssl/utils.rb
index 07a1835f9dd..2edb7b0c991 100644
--- a/test/openssl/utils.rb
+++ b/test/openssl/utils.rb
@@ -96,7 +96,7 @@ Q1VB8qkJN7rA7/2HrCR3gTsWNb1YhAsnFsoeRscC+LxXoXi9OAIUBG98h4tilg6S
cert
end
- def issue_crl(revoke_info, serial, lastup, nextup, extensions,
+ def issue_crl(revoke_info, serial, lastup, nextup, extensions,
issuer, issuer_key, digest)
crl = OpenSSL::X509::CRL.new
crl.issuer = issuer.subject
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 8adfd0159a2..d92092339a4 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -20,7 +20,7 @@ class TC_OpenStruct < Test::Unit::TestCase
o2.instance_eval{@table = {:a => 'b'}}
assert_not_equal(o1, o2)
end
-
+
def test_inspect
foo = OpenStruct.new
assert_equal("#<OpenStruct>", foo.inspect)
diff --git a/test/rdoc/test_rdoc_info_formatting.rb b/test/rdoc/test_rdoc_info_formatting.rb
index c10532aa178..110c84b2d19 100644
--- a/test/rdoc/test_rdoc_info_formatting.rb
+++ b/test/rdoc/test_rdoc_info_formatting.rb
@@ -40,7 +40,7 @@ class TestRDocInfoFormatting < MiniTest::Unit::TestCase
def test_escaping
assert_match(/@@ and @\{@\} should be at-sign-prefixed/)
end
-
+
# This tests that *bold* and <b>bold me</b> become @strong{bolded}
def test_bold
# Seems like a limitation of the Info format: @strong{bold}
@@ -139,7 +139,7 @@ Second inner item.
Second outer item.
@end itemize")
end
-
+
def test_internal_hyperlinks
# be sure to test multi-word hyperlinks as well.
end
diff --git a/test/rdoc/test_rdoc_markup_to_html_crossref.rb b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
index baacda82854..ccc5e957992 100644
--- a/test/rdoc/test_rdoc_markup_to_html_crossref.rb
+++ b/test/rdoc/test_rdoc_markup_to_html_crossref.rb
@@ -32,7 +32,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase
# predicable.
RDoc::Generator::Method.reset
top_level = RDoc::TopLevel.new @source_file_name
-
+
options = RDoc::Options.new
options.quiet = true
@@ -107,7 +107,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase
#
def verify_class_crossref(xref, reference, class_name)
class_file_name = class_name.gsub(/::/, "/")
-
+
result = "<a href=\"../classes/#{class_file_name}.html\">#{reference}</a>"
verify_convert xref, reference, result
@@ -120,7 +120,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase
#
def verify_method_crossref(xref, reference, class_name, method_seq)
class_file_name = class_name.gsub(/::/, "/")
-
+
result = "<a href=\"../classes/#{class_file_name}.html##{method_seq}\">#{reference}</a>"
verify_convert xref, reference, result
@@ -145,7 +145,7 @@ class TestRDocMarkupToHtmlCrossref < MiniTest::Unit::TestCase
# bogus does not exist and so no cross-reference should be generated.
verify_no_crossref xref, "bogus"
verify_no_crossref xref, "\\bogus"
-
+
# Ref_Class1 is in the top-level namespace, and so a cross-reference always
# should be generated, unless markup is suppressed.
verify_class_crossref xref, "Ref_Class1", "Ref_Class1"
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb
index ebf96594c82..ce93b5b3f70 100644
--- a/test/rdoc/test_rdoc_parser_c.rb
+++ b/test/rdoc/test_rdoc_parser_c.rb
@@ -176,11 +176,11 @@ void Init_foo(){
comment = <<-EOF.chomp
-
+
Multiline comment goes here because this comment spans multiple lines.
Multiline comment goes here because this comment spans multiple lines.
-
-
+
+
EOF
assert_equal ['MULTILINE', 'INT2FIX(1)', comment], constants.shift
assert_equal ['MULTILINE_VALUE', '1', comment], constants.shift
@@ -189,8 +189,8 @@ void Init_foo(){
Multiline comment goes here because this comment spans multiple lines.
Multiline comment goes here because this comment spans multiple lines.
-
-
+
+
EOF
assert_equal ['MULTILINE_NOT_EMPTY', 'INT2FIX(1)', comment], constants.shift
diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb
index 3845fb29072..7fe626c302a 100644
--- a/test/rdoc/test_rdoc_parser_ruby.rb
+++ b/test/rdoc/test_rdoc_parser_ruby.rb
@@ -177,7 +177,7 @@ class TestRDocParserRuby < MiniTest::Unit::TestCase
assert_equal 'Foo', foo.full_name
assert_equal comment, foo.comment
end
-
+
def test_parse_class_mistaken_for_module
#
# The code below is not strictly legal Ruby (Foo must have been defined
diff --git a/test/rdoc/test_rdoc_ri_default_display.rb b/test/rdoc/test_rdoc_ri_default_display.rb
index 1182b046c3c..966325ef5c9 100644
--- a/test/rdoc/test_rdoc_ri_default_display.rb
+++ b/test/rdoc/test_rdoc_ri_default_display.rb
@@ -169,7 +169,7 @@ Instance method extensions:
------------------------------------------------------- SomeClass::some_method
SomeClass::some_method(arg1, arg2)
- From
+ From
------------------------------------------------------------------------------
[no description]
EOF
diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb
index 846f80d2479..c9a88c2f688 100644
--- a/test/readline/test_readline.rb
+++ b/test/readline/test_readline.rb
@@ -36,7 +36,7 @@ class TestReadline < Test::Unit::TestCase
def teardown
Readline.instance_variable_set("@completion_proc", nil)
end
-
+
def test_safe_level_4
method_args =
[
@@ -119,7 +119,7 @@ class TestReadline < Test::Unit::TestCase
Readline.input = "This is not a file."
end
end
-
+
def test_output=
assert_raise(TypeError) do
Readline.output = "This is not a file."
@@ -156,7 +156,7 @@ class TestReadline < Test::Unit::TestCase
rescue NotImplementedError
end
end
-
+
# vi_editing_mode
# emacs_editing_mode
def test_editing_mode
diff --git a/test/readline/test_readline_history.rb b/test/readline/test_readline_history.rb
index 0640d08eba3..a5d8c686dad 100644
--- a/test/readline/test_readline_history.rb
+++ b/test/readline/test_readline_history.rb
@@ -73,7 +73,7 @@ class Readline::TestHistory < Test::Unit::TestCase
}.join
end
end
-
+
def test_to_s
expected = "HISTORY"
assert_equal(expected, HISTORY.to_s)
@@ -101,7 +101,7 @@ class Readline::TestHistory < Test::Unit::TestCase
HISTORY[i]
end
end
-
+
invalid_indexes = [100_000_000_000_000_000_000,
-100_000_000_000_000_000_000]
invalid_indexes.each do |i|
@@ -127,7 +127,7 @@ class Readline::TestHistory < Test::Unit::TestCase
assert_raise(IndexError, NotImplementedError, "index=<0>") do
HISTORY[0] = "set: 0"
end
-
+
lines = push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
@@ -135,7 +135,7 @@ class Readline::TestHistory < Test::Unit::TestCase
HISTORY[i] = "set: #{i}"
end
end
-
+
invalid_indexes = [100_000_000_000_000_000_000,
-100_000_000_000_000_000_000]
invalid_indexes.each do |i|
@@ -180,13 +180,13 @@ class Readline::TestHistory < Test::Unit::TestCase
def test_pop
begin
assert_equal(nil, HISTORY.pop)
-
+
lines = push_history(5)
(1..5).each do |i|
assert_external_string_equal(lines[-i], HISTORY.pop)
assert_equal(lines.length - i, HISTORY.length)
end
-
+
assert_equal(nil, HISTORY.pop)
rescue NotImplementedError
end
@@ -195,13 +195,13 @@ class Readline::TestHistory < Test::Unit::TestCase
def test_shift
begin
assert_equal(nil, HISTORY.shift)
-
+
lines = push_history(5)
(0..4).each do |i|
assert_external_string_equal(lines[i], HISTORY.shift)
assert_equal(lines.length - (i + 1), HISTORY.length)
end
-
+
assert_equal(nil, HISTORY.shift)
rescue NotImplementedError
end
@@ -276,7 +276,7 @@ class Readline::TestHistory < Test::Unit::TestCase
assert_raise(IndexError, NotImplementedError, "index=<0>") do
HISTORY.delete_at(0)
end
-
+
lines = push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
@@ -284,7 +284,7 @@ class Readline::TestHistory < Test::Unit::TestCase
HISTORY.delete_at(i)
end
end
-
+
invalid_indexes = [100_000_000_000_000_000_000,
-100_000_000_000_000_000_000]
invalid_indexes.each do |i|
diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb
index 0b1c512bf18..0d94cf70da6 100644
--- a/test/rinda/test_rinda.rb
+++ b/test/rinda/test_rinda.rb
@@ -16,7 +16,7 @@ class MockClock
nil
end
end
-
+
def initialize
@now = 2
@reso = 1
@@ -32,7 +32,7 @@ class MockClock
def at(n)
n
end
-
+
def _forward(n=nil)
now ,= @ts.take([nil, :now])
@now = now + n
@@ -114,7 +114,7 @@ module TupleSpaceTestModule
end
th.value
end
-
+
def test_00_tuple
tuple = Rinda::TupleEntry.new([1,2,3])
assert(!tuple.canceled?)
@@ -283,7 +283,7 @@ module TupleSpaceTestModule
@ts.write([:ans, s])
s
end
-
+
assert_equal(10, thread_join(taker))
tuple = @ts.take([:ans, nil])
assert_equal(10, tuple[1])
@@ -314,7 +314,7 @@ module TupleSpaceTestModule
assert_equal(10, tuple[1])
assert_equal([], @ts.read_all([nil, nil]))
end
-
+
def test_core_03_notify
notify1 = @ts.notify(nil, [:req, Integer])
notify2 = @ts.notify(nil, [:ans, Integer], 8)
@@ -417,7 +417,7 @@ module TupleSpaceTestModule
assert_equal([[:removeme, 1]], @ts.read_all([nil, nil]))
entry.cancel
assert_equal([], @ts.read_all([nil, nil]))
-
+
template = nil
taker = Thread.new do
@ts.take([:take, nil], 10) do |t|
@@ -427,7 +427,7 @@ module TupleSpaceTestModule
end
end
end
-
+
sleep(2)
assert_raise(Rinda::RequestCanceledError) do
@@ -435,7 +435,7 @@ module TupleSpaceTestModule
end
assert(template.canceled?)
-
+
@ts.write([:take, 1])
assert_equal([[:take, 1]], @ts.read_all([nil, nil]))
@@ -464,7 +464,7 @@ module TupleSpaceTestModule
end
assert(template.canceled?)
-
+
@ts.write([:take, 1])
assert_equal([[:take, 1]], @ts.read_all([nil, nil]))
@@ -475,7 +475,7 @@ module TupleSpaceTestModule
@sec = sec
@n = n
end
-
+
def renew
return -1 if @n <= 0
@n -= 1
@@ -488,7 +488,7 @@ module TupleSpaceTestModule
assert(!tuple.canceled?)
assert(tuple.expired?)
assert(!tuple.alive?)
-
+
tuple = Rinda::TupleEntry.new([1,2,3], 1)
assert(!tuple.canceled?)
assert(!tuple.expired?)
diff --git a/test/rinda/test_tuplebag.rb b/test/rinda/test_tuplebag.rb
index e1ca1bde6cd..3e30127f0f0 100644
--- a/test/rinda/test_tuplebag.rb
+++ b/test/rinda/test_tuplebag.rb
@@ -150,7 +150,7 @@ class TestTupleBag < Test::Unit::TestCase
t = tup(:val, 1)
@tb.push t
-
+
assert_equal t, @tb.find(tem(:val, 1))
end
diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb
index c2d7a50a3f6..2bbe4a0060f 100644
--- a/test/ripper/test_files.rb
+++ b/test/ripper/test_files.rb
@@ -22,4 +22,4 @@ end
rescue LoadError
end
-
+
diff --git a/test/rss/rss-assertions.rb b/test/rss/rss-assertions.rb
index 0a84e4f16de..86f9dd87c03 100644
--- a/test/rss/rss-assertions.rb
+++ b/test/rss/rss-assertions.rb
@@ -14,7 +14,7 @@ module RSS
::RSS::Parser.parse(rss, false).validate
end
end
-
+
def assert_ns(prefix, uri)
_wrap_assertion do
begin
@@ -26,7 +26,7 @@ module RSS
end
end
end
-
+
def assert_missing_tag(tag, parent)
_wrap_assertion do
begin
@@ -38,7 +38,7 @@ module RSS
end
end
end
-
+
def assert_too_much_tag(tag, parent)
_wrap_assertion do
begin
@@ -50,7 +50,7 @@ module RSS
end
end
end
-
+
def assert_missing_attribute(tag, attrname)
_wrap_assertion do
begin
@@ -62,7 +62,7 @@ module RSS
end
end
end
-
+
def assert_not_expected_tag(tag, uri, parent)
_wrap_assertion do
begin
@@ -75,7 +75,7 @@ module RSS
end
end
end
-
+
def assert_not_available_value(tag, value, attribute=nil)
_wrap_assertion do
begin
@@ -101,7 +101,7 @@ module RSS
end
end
end
-
+
def assert_xml_declaration(version, encoding, standalone, rss)
_wrap_assertion do
assert_equal(version, rss.version)
@@ -109,7 +109,7 @@ module RSS
assert_equal(standalone, rss.standalone)
end
end
-
+
def assert_xml_stylesheet_attrs(attrs, xsl)
_wrap_assertion do
n_attrs = normalized_attrs(attrs)
@@ -118,7 +118,7 @@ module RSS
end
end
end
-
+
def assert_xml_stylesheet(target, attrs, xsl)
_wrap_assertion do
if attrs.has_key?(:href)
@@ -133,7 +133,7 @@ module RSS
end
end
end
-
+
def assert_xml_stylesheet_pis(attrs_ary, rss=nil)
_wrap_assertion do
if rss.nil?
@@ -806,7 +806,7 @@ EOA
end
end
end
-
+
def assert_multiple_dublin_core(elems, target)
_wrap_assertion do
elems.each do |name, values, plural|
@@ -816,7 +816,7 @@ EOA
end
end
end
-
+
def assert_syndication(elems, target)
_wrap_assertion do
elems.each do |name, value|
@@ -826,7 +826,7 @@ EOA
end
end
end
-
+
def assert_content(elems, target)
_wrap_assertion do
elems.each do |name, value|
@@ -834,7 +834,7 @@ EOA
end
end
end
-
+
def assert_trackback(attrs, target)
_wrap_assertion do
n_attrs = normalized_attrs(attrs)
diff --git a/test/rss/rss-testcase.rb b/test/rss/rss-testcase.rb
index 79f8cb87e86..6a7093a8da3 100644
--- a/test/rss/rss-testcase.rb
+++ b/test/rss/rss-testcase.rb
@@ -37,11 +37,11 @@ module RSS
CLOUD_PATH = "/RPC2"
CLOUD_REGISTER_PROCEDURE = "ourFavoriteSongs.rssPleaseNotify"
CLOUD_PROTOCOL = "xml-rpc"
-
+
ENCLOSURE_URL = "http://www.scripting.com/mp3s/weatherReportSuite.mp3"
ENCLOSURE_LENGTH = "12216320"
ENCLOSURE_TYPE = "audio/mpeg"
-
+
CATEGORY_DOMAIN = "http://www.superopendirectory.com/"
FEED_TITLE = "dive into mark"
@@ -375,7 +375,7 @@ EOA
rdf.items << item
assert_not_equal("", rdf.to_s)
end
-
+
def setup_rss20(rss)
assert_equal("", rss.to_s)
@@ -389,7 +389,7 @@ EOA
rss.channel = channel
assert_not_equal("", rss.to_s)
end
-
+
def setup_dummy_channel(maker)
about = "http://hoge.com"
title = "fugafuga"
@@ -421,7 +421,7 @@ EOA
url = "http://hoge.com/hoge.png"
maker.channel.link = link if maker.channel.link.nil?
-
+
maker.image.title = title
maker.image.url = url
end
diff --git a/test/rss/test_1.0.rb b/test/rss/test_1.0.rb
index 9cb76075904..52ad24cfcda 100644
--- a/test/rss/test_1.0.rb
+++ b/test/rss/test_1.0.rb
@@ -6,32 +6,32 @@ require "rss/1.0"
module RSS
class TestRSS10Core < TestCase
-
+
def setup
@rdf_prefix = "rdf"
@rdf_uri = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@uri = "http://purl.org/rss/1.0/"
end
-
+
def test_RDF
version = "1.0"
encoding = "UTF-8"
standalone = false
-
+
rdf = RDF.new(version, encoding, standalone)
setup_rss10(rdf)
doc = REXML::Document.new(rdf.to_s)
-
+
xmldecl = doc.xml_decl
-
+
%w(version encoding).each do |x|
assert_equal(instance_eval(x), xmldecl.__send__(x))
end
assert_equal(standalone, !xmldecl.standalone.nil?)
-
+
assert_equal(@rdf_uri, doc.root.namespace)
end
-
+
def test_not_displayed_xml_stylesheets
rdf = RDF.new()
plain_rdf = rdf.to_s
@@ -40,7 +40,7 @@ module RSS
assert_equal(plain_rdf, rdf.to_s)
end
end
-
+
def test_xml_stylesheets
[
[{:href => "a.xsl", :type => "text/xsl"}],
@@ -52,7 +52,7 @@ module RSS
assert_xml_stylesheet_pis(attrs_ary)
end
end
-
+
def test_channel
about = "http://hoge.com"
title = "fugafuga"
@@ -77,7 +77,7 @@ module RSS
%w(title link description image items textinput).each do |x|
channel.__send__("#{x}=", instance_eval(x))
end
-
+
doc = REXML::Document.new(make_RDF(<<-EOR))
#{channel}
<items>
@@ -85,7 +85,7 @@ module RSS
</items>
EOR
c = doc.root.elements[1]
-
+
assert_equal(about, c.attributes["about"])
%w(title link description image textinput).each do |x|
elem = c.elements[x]
@@ -105,52 +105,52 @@ EOR
assert_equal(@uri, c.elements["items"].namespace)
assert_equal("items", c.elements["items"].name)
end
-
+
def test_channel_image
resource = "http://hoge.com/hoge.png"
image = RDF::Channel::Image.new(resource)
-
+
doc = REXML::Document.new(make_RDF(image.to_s))
i = doc.root.elements[1]
-
+
assert_equal("image", i.name)
assert_equal(@uri, i.namespace)
-
+
res = i.attributes.get_attribute("resource")
-
+
assert_equal(@rdf_uri, res.namespace)
assert_equal(resource, res.value)
end
-
+
def test_channel_textinput
resource = "http://hoge.com/hoge.png"
textinput = RDF::Channel::Textinput.new(resource)
-
+
doc = REXML::Document.new(make_RDF(textinput.to_s))
t = doc.root.elements[1]
-
+
assert_equal("textinput", t.name)
assert_equal(@uri, t.namespace)
-
+
res = t.attributes.get_attribute("resource")
-
+
assert_equal(@rdf_uri, res.namespace)
assert_equal(resource, res.value)
end
-
+
def test_channel_items
item_link = "http://example.com/item"
items = RDF::Channel::Items.new
li = items.Seq.class::Li.new(item_link)
items.Seq.lis << li
-
+
doc = REXML::Document.new(make_RDF(items.to_s))
i = doc.root.elements[1]
-
+
assert_equal("items", i.name)
assert_equal(@uri, i.namespace)
-
+
assert_equal(1, i.elements.size)
seq = i.elements[1]
assert_equal("Seq", seq.name)
@@ -162,16 +162,16 @@ EOR
assert_equal(@rdf_uri, l.namespace)
assert_equal(item_link, l.attributes["resource"])
end
-
+
def test_seq
item_link = "http://example.com/item"
seq = RDF::Seq.new
li = seq.class::Li.new(item_link)
seq.lis << li
-
+
doc = REXML::Document.new(make_RDF(seq.to_s))
s = doc.root.elements[1]
-
+
assert_equal("Seq", s.name)
assert_equal(@rdf_uri, s.namespace)
@@ -181,37 +181,37 @@ EOR
assert_equal(@rdf_uri, l.namespace)
assert_equal(item_link, l.attributes["resource"])
end
-
+
def test_li
resource = "http://hoge.com/"
li = RDF::Li.new(resource)
-
+
doc = REXML::Document.new(make_RDF(li.to_s))
l = doc.root.elements[1]
-
+
assert_equal("li", l.name)
assert_equal(@rdf_uri, l.namespace(l.prefix))
-
+
res = l.attributes.get_attribute("resource")
-
+
assert_equal('', res.instance_eval("@prefix"))
assert_equal(resource, res.value)
end
-
+
def test_image
about = "http://hoge.com"
title = "fugafuga"
url = "http://hoge.com/hoge"
link = "http://hoge.com/fuga"
-
+
image = RDF::Image.new(about)
%w(title url link).each do |x|
image.__send__("#{x}=", instance_eval(x))
end
-
+
doc = REXML::Document.new(make_RDF(image.to_s))
i = doc.root.elements[1]
-
+
assert_equal(about, i.attributes["about"])
%w(title url link).each do |x|
elem = i.elements[x]
@@ -220,21 +220,21 @@ EOR
assert_equal(instance_eval(x), elem.text)
end
end
-
+
def test_item
about = "http://hoge.com"
title = "fugafuga"
link = "http://hoge.com/fuga"
description = "hogehogehoge"
-
+
item = RDF::Item.new(about)
%w(title link description).each do |x|
item.__send__("#{x}=", instance_eval(x))
end
-
+
doc = REXML::Document.new(make_RDF(item.to_s))
i = doc.root.elements[1]
-
+
assert_equal(about, i.attributes["about"])
%w(title link description).each do |x|
elem = i.elements[x]
@@ -243,22 +243,22 @@ EOR
assert_equal(instance_eval(x), elem.text)
end
end
-
+
def test_textinput
about = "http://hoge.com"
title = "fugafuga"
link = "http://hoge.com/fuga"
name = "foo"
description = "hogehogehoge"
-
+
textinput = RDF::Textinput.new(about)
%w(title link name description).each do |x|
textinput.__send__("#{x}=", instance_eval(x))
end
-
+
doc = REXML::Document.new(make_RDF(textinput.to_s))
t = doc.root.elements[1]
-
+
assert_equal(about, t.attributes["about"])
%w(title link name description).each do |x|
elem = t.elements[x]
diff --git a/test/rss/test_2.0.rb b/test/rss/test_2.0.rb
index 5a63efbcb95..884afcc8164 100644
--- a/test/rss/test_2.0.rb
+++ b/test/rss/test_2.0.rb
@@ -8,28 +8,28 @@ module RSS
def setup
@rss_version = "2.0"
end
-
+
def test_Rss
version = "1.0"
encoding = "UTF-8"
standalone = false
-
+
rss = Rss.new(@rss_version, version, encoding, standalone)
setup_rss20(rss)
-
+
doc = REXML::Document.new(rss.to_s(false))
-
+
xmldecl = doc.xml_decl
-
+
%w(version encoding).each do |x|
assert_equal(instance_eval(x), xmldecl.__send__(x))
end
assert_equal(standalone, !xmldecl.standalone.nil?)
-
+
assert_equal("", doc.root.namespace)
assert_equal(@rss_version, doc.root.attributes["version"])
end
-
+
def test_not_displayed_xml_stylesheets
rss = Rss.new(@rss_version)
plain_rss = rss.to_s
@@ -38,7 +38,7 @@ module RSS
assert_equal(plain_rss, rss.to_s)
end
end
-
+
def test_xml_stylesheets
[
[{:href => "a.xsl", :type => "text/xsl"}],
@@ -57,7 +57,7 @@ module RSS
title = "fugafuga"
link = "http://hoge.com"
description = "fugafugafugafuga"
-
+
language = "en-us"
copyright = "Copyright 2002, Spartanburg Herald-Journal"
managingEditor = "geo@herald.com (George Matesky)"
@@ -81,7 +81,7 @@ module RSS
rating = '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi North America Server" for "http://www.rsac.org" on "1996.04.16T08:15-0500" r (n 0 s 0 v 0 l 0))'
channel = Rss::Channel.new
-
+
elems = %w(title link description language copyright
managingEditor webMaster pubDate lastBuildDate
generator docs ttl rating)
@@ -94,10 +94,10 @@ module RSS
channel.categories << Rss::Channel::Category.new(cat[:domain],
cat[:content])
end
-
+
doc = REXML::Document.new(make_rss20(channel.to_s))
c = doc.root.elements[1]
-
+
elems.each do |x|
elem = c.elements[x]
assert_equal(x, elem.name)
@@ -139,10 +139,10 @@ module RSS
cloud_params[:registerProcedure],
cloud_params[:protocol])
cloud_params[:port] = cloud.port
-
+
doc = REXML::Document.new(cloud.to_s)
cloud_elem = doc.root
-
+
actual = {}
cloud_elem.attributes.each do |name, value|
value = value.to_i if name == "port"
@@ -169,7 +169,7 @@ module RSS
doc = REXML::Document.new(image.to_s)
image_elem = doc.root
-
+
image_params.each do |name, value|
value = image.__send__(name)
actual = image_elem.elements[name.to_s].text
@@ -177,7 +177,7 @@ module RSS
assert_equal(value, actual)
end
end
-
+
def test_channel_textInput
textInput_params = {
:title => "fugafuga",
@@ -192,13 +192,13 @@ module RSS
doc = REXML::Document.new(textInput.to_s)
input_elem = doc.root
-
+
textInput_params.each do |name, value|
actual = input_elem.elements[name.to_s].text
assert_equal(value, actual)
end
end
-
+
def test_channel_skip_days
skipDays_values = [
"Sunday",
@@ -208,15 +208,15 @@ module RSS
skipDays_values.each do |value|
skipDays.days << Rss::Channel::SkipDays::Day.new(value)
end
-
+
doc = REXML::Document.new(skipDays.to_s)
days_elem = doc.root
-
+
skipDays_values.each_with_index do |value, i|
assert_equal(value, days_elem.elements[i + 1].text)
end
end
-
+
def test_channel_skip_hours
skipHours_values = [
"0",
@@ -229,7 +229,7 @@ module RSS
doc = REXML::Document.new(skipHours.to_s)
hours_elem = doc.root
-
+
skipHours_values.each_with_index do |value, i|
expected = skipHours.hours[i].content
assert_equal(expected, hours_elem.elements[i + 1].text.to_i)
@@ -260,7 +260,7 @@ module RSS
item = Rss::Channel::Item.new
channel.items << item
-
+
elems = %w(title link description author comments pubDate)
elems.each do |x|
value = instance_eval(x)
@@ -271,7 +271,7 @@ module RSS
item.categories << Rss::Channel::Category.new(cat[:domain],
cat[:content])
end
-
+
doc = REXML::Document.new(channel.to_s)
channel_elem = doc.root
@@ -311,7 +311,7 @@ module RSS
enclosure_params[:length],
enclosure_params[:type])
enclosure_params[:length] = enclosure.length
-
+
doc = REXML::Document.new(enclosure.to_s)
enclosure_elem = doc.root
@@ -322,7 +322,7 @@ module RSS
end
assert_equal(enclosure_params, actual)
end
-
+
def test_item_guid
test_params = [
{
@@ -345,10 +345,10 @@ module RSS
else
assert_equal(guid.isPermaLink, guid.PermaLink?)
end
-
+
doc = REXML::Document.new(guid.to_s)
guid_elem = doc.root
-
+
actual = {}
actual[:content] = guid_elem.text if guid_elem.text
guid_elem.attributes.each do |name, value|
@@ -358,7 +358,7 @@ module RSS
assert_equal(guid_params, actual)
end
end
-
+
def test_item_source
source_params = {
:url => "http://www.tomalak.org/links2.xml",
@@ -370,7 +370,7 @@ module RSS
doc = REXML::Document.new(source.to_s)
source_elem = doc.root
-
+
actual = {}
actual[:content] = source_elem.text
source_elem.attributes.each do |name, value|
diff --git a/test/rss/test_accessor.rb b/test/rss/test_accessor.rb
index ceb31fc9c22..f2b8508a6de 100644
--- a/test/rss/test_accessor.rb
+++ b/test/rss/test_accessor.rb
@@ -11,11 +11,11 @@ module RSS
channel = Rss::Channel.new
channel.pubDate = nil
assert_nil(channel.pubDate)
-
+
time = Time.now
channel.pubDate = time
assert_equal(time, channel.pubDate)
-
+
time = Time.parse(Time.now.rfc822)
channel.pubDate = time.rfc822
assert_equal(time, channel.pubDate)
@@ -25,35 +25,35 @@ module RSS
assert_not_available_value("pubDate", value) do
channel.pubDate = value
end
-
+
channel.do_validate = false
time = Time.parse(Time.now.iso8601)
value = time.iso8601
channel.pubDate = value
assert_equal(time, channel.pubDate)
-
+
channel.pubDate = nil
assert_nil(channel.pubDate)
end
-
+
def test_integer
image_item = RDF::Item::ImageItem.new
image_item.width = nil
assert_nil(image_item.width)
-
+
width = 10
image_item.width = width
assert_equal(width, image_item.width)
-
+
width = 10.0
image_item.width = width
assert_equal(width, image_item.width)
-
+
width = "10"
image_item.width = width
assert_equal(width.to_i, image_item.width)
-
+
width = "10.0"
assert_not_available_value("image:width", width) do
image_item.width = width
@@ -63,29 +63,29 @@ module RSS
width = "10.0"
image_item.width = width
assert_equal(width.to_i, image_item.width)
-
+
image_item.width = nil
assert_nil(image_item.width)
end
-
+
def test_positive_integer
channel = RDF::Channel.new
channel.sy_updateFrequency = nil
assert_nil(channel.sy_updateFrequency)
-
+
freq = 10
channel.sy_updateFrequency = freq
assert_equal(freq, channel.sy_updateFrequency)
-
+
freq = 10.0
channel.sy_updateFrequency = freq
assert_equal(freq, channel.sy_updateFrequency)
-
+
freq = "10"
channel.sy_updateFrequency = freq
assert_equal(freq.to_i, channel.sy_updateFrequency)
-
+
freq = "10.0"
assert_not_available_value("sy:updateFrequency", freq) do
channel.sy_updateFrequency = freq
@@ -95,7 +95,7 @@ module RSS
freq = "10.0"
channel.sy_updateFrequency = freq
assert_equal(freq.to_i, channel.sy_updateFrequency)
-
+
channel.sy_updateFrequency = nil
assert_nil(channel.sy_updateFrequency)
end
diff --git a/test/rss/test_content.rb b/test/rss/test_content.rb
index 02db59186b1..f59b0c8e838 100644
--- a/test/rss/test_content.rb
+++ b/test/rss/test_content.rb
@@ -10,15 +10,15 @@ module RSS
def setup
@prefix = "content"
@uri = "http://purl.org/rss/1.0/modules/content/"
-
+
@elems = {
:encoded => "<em>ATTENTION</em>",
}
-
+
@content_nodes = @elems.collect do |name, value|
"<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>"
end.join("\n")
-
+
@rss10_source = make_RDF(<<-EOR, {@prefix => @uri})
#{make_channel()}
#{make_image()}
@@ -79,7 +79,7 @@ EOR
end
end
end
-
+
def test_to_s
@elems.each do |name, value|
excepted = make_element("#{@prefix}:#{name}", {}, value)
diff --git a/test/rss/test_maker_0.9.rb b/test/rss/test_maker_0.9.rb
index f397f926468..61b272d1308 100644
--- a/test/rss/test_maker_0.9.rb
+++ b/test/rss/test_maker_0.9.rb
@@ -16,20 +16,20 @@ module RSS
assert_raise(LocalJumpError) do
RSS::Maker.make("0.91")
end
-
+
rss = RSS::Maker.make("0.9") do |maker|
setup_dummy_channel(maker)
setup_dummy_image(maker)
end
assert_equal("0.92", rss.rss_version)
-
+
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
setup_dummy_image(maker)
end
assert_equal("0.91", rss.rss_version)
-
+
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
setup_dummy_image(maker)
@@ -112,7 +112,7 @@ module RSS
maker.image.title = image_title
end
channel = rss.channel
-
+
assert_equal(title, channel.title)
assert_equal(link, channel.link)
assert_equal(description, channel.description)
@@ -132,7 +132,7 @@ module RSS
skipHours.each_with_index do |hour, i|
assert_equal(hour.to_i, channel.skipHours.hours[i].content)
end
-
+
assert(channel.items.empty?)
assert_equal(image_url, channel.image.url)
@@ -185,7 +185,7 @@ module RSS
end
end
end
-
+
def test_image
title = "fugafuga"
link = "http://hoge.com"
@@ -197,7 +197,7 @@ module RSS
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -216,7 +216,7 @@ module RSS
RSS::Maker.make("0.91") do |maker|
# setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -252,7 +252,7 @@ module RSS
setup_dummy_channel(maker)
# maker.channel.link = link
maker.channel.link = nil
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -274,7 +274,7 @@ module RSS
end
end
end
-
+
def test_items(with_convenience_way=true)
title = "TITLE"
link = "http://hoge.com/"
@@ -288,7 +288,7 @@ module RSS
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
-
+
maker.items.new_item do |item|
item.title = title
item.link = link
@@ -307,7 +307,7 @@ module RSS
item_size = 5
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |_item|
_item.title = "#{title}#{i}"
@@ -328,7 +328,7 @@ module RSS
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |_item|
_item.title = "#{title}#{i}"
@@ -391,7 +391,7 @@ module RSS
end
end
end
-
+
def test_not_valid_textInput
title = "fugafuga"
description = "text hoge fuga"
diff --git a/test/rss/test_maker_1.0.rb b/test/rss/test_maker_1.0.rb
index bee3206a3a5..ab6f6ade6b2 100644
--- a/test/rss/test_maker_1.0.rb
+++ b/test/rss/test_maker_1.0.rb
@@ -19,7 +19,7 @@ module RSS
setup_dummy_item(maker)
end
assert_equal("1.0", rss.rss_version)
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.encoding = "EUC-JP"
@@ -137,8 +137,8 @@ module RSS
end
end
end
-
-
+
+
def test_image
title = "fugafuga"
link = "http://hoge.com"
@@ -147,7 +147,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
@@ -164,7 +164,7 @@ module RSS
RSS::Maker.make("1.0") do |maker|
# setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
end
@@ -179,7 +179,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
# maker.image.url = url
maker.image.title = title
@@ -191,7 +191,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.url = url
# maker.image.title = title
@@ -205,7 +205,7 @@ module RSS
setup_dummy_channel(maker)
# maker.channel.link = link
maker.channel.link = nil
-
+
maker.image.url = url
maker.image.title = title
@@ -227,7 +227,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.items.new_item do |item|
item.title = title
item.link = link
@@ -241,11 +241,11 @@ module RSS
assert_equal(link, item.link)
assert_nil(item.description)
-
+
item_size = 5
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |_item|
_item.title = "#{title}#{i}"
@@ -265,7 +265,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |_item|
_item.title = "#{title}#{i}"
@@ -292,7 +292,7 @@ module RSS
max_size = item_size / 2
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |_item|
_item.title = "#{title}#{i}"
@@ -329,7 +329,7 @@ module RSS
max_size = -2
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |_item|
_item.title = "#{title}#{i}"
@@ -398,7 +398,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.link = link
maker.textinput.title = title
maker.textinput.description = description
@@ -425,7 +425,7 @@ module RSS
end
end
end
-
+
def test_not_valid_textinput
title = "fugafuga"
description = "text hoge fuga"
@@ -447,7 +447,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.link = link
# maker.textinput.title = title
maker.textinput.description = description
@@ -460,7 +460,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.link = link
maker.textinput.title = title
# maker.textinput.description = description
@@ -473,7 +473,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.link = link
maker.textinput.title = title
maker.textinput.description = description
diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb
index 9fe6543dd95..7285f11a721 100644
--- a/test/rss/test_maker_2.0.rb
+++ b/test/rss/test_maker_2.0.rb
@@ -13,15 +13,15 @@ module RSS
assert_raise(LocalJumpError) do
RSS::Maker.make("2.0")
end
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
end
assert_equal("2.0", rss.rss_version)
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.encoding = "EUC-JP"
end
assert_equal("2.0", rss.rss_version)
@@ -29,7 +29,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.standalone = "yes"
end
assert_equal("2.0", rss.rss_version)
@@ -37,7 +37,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.encoding = "EUC-JP"
maker.standalone = "yes"
end
@@ -72,7 +72,7 @@ module RSS
]
generator = "RSS Maker"
ttl = "60"
-
+
rss = RSS::Maker.make("2.0") do |maker|
maker.channel.title = title
maker.channel.link = link
@@ -96,18 +96,18 @@ module RSS
new_hour.content = hour
end
end
-
+
categories.each do |category|
maker.channel.categories.new_category do |new_category|
new_category.content = category
end
end
-
+
maker.channel.generator = generator
maker.channel.ttl = ttl
end
channel = rss.channel
-
+
assert_equal(title, channel.title)
assert_equal(link, channel.link)
assert_equal(description, channel.description)
@@ -127,11 +127,11 @@ module RSS
skipHours.each_with_index do |hour, i|
assert_equal(hour.to_i, channel.skipHours.hours[i].content)
end
-
+
channel.categories.each_with_index do |category, i|
assert_equal(categories[i], category.content)
end
-
+
assert_equal(generator, channel.generator)
assert_equal(ttl.to_i, channel.ttl)
@@ -145,7 +145,7 @@ module RSS
link = "http://hoge.com"
description = "fugafugafugafuga"
language = "ja"
-
+
assert_not_set_error("maker.channel", %w(title)) do
RSS::Maker.make("2.0") do |maker|
# maker.channel.title = title
@@ -182,7 +182,7 @@ module RSS
assert_not_nil(rss)
end
-
+
def test_cloud
domain = "rpc.sys.com"
port = "80"
@@ -206,7 +206,7 @@ module RSS
assert_equal(registerProcedure, cloud.registerProcedure)
assert_equal(protocol, cloud.protocol)
end
-
+
def test_not_valid_cloud
domain = "rpc.sys.com"
port = "80"
@@ -269,7 +269,7 @@ module RSS
end
assert_nil(rss.channel.cloud)
end
-
+
def test_image
title = "fugafuga"
@@ -282,7 +282,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -301,7 +301,7 @@ module RSS
RSS::Maker.make("2.0") do |maker|
# setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -322,7 +322,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
# maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -336,7 +336,7 @@ module RSS
setup_dummy_channel(maker)
# maker.channel.link = link
maker.channel.link = nil
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
@@ -348,7 +348,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
# maker.image.url = url
maker.image.width = width
@@ -357,7 +357,7 @@ module RSS
end
assert_nil(rss.image)
end
-
+
def test_items(with_convenience_way=true)
title = "TITLE"
link = "http://hoge.com/"
@@ -374,7 +374,7 @@ module RSS
item_size = 5
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |item|
item.title = "#{title}#{i}"
@@ -400,7 +400,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |item|
item.title = "#{title}#{i}"
@@ -467,7 +467,7 @@ module RSS
def test_guid
isPermaLink = "true"
content = "http://inessential.com/2002/09/01.php#a2"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -483,7 +483,7 @@ module RSS
def test_not_valid_guid
content = "http://inessential.com/2002/09/01.php#a2"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -493,12 +493,12 @@ module RSS
end
assert_nil(rss.channel.items.last.guid)
end
-
+
def test_enclosure
url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3"
length = "12216320"
type = "audio/mpeg"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -518,7 +518,7 @@ module RSS
url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3"
length = "12216320"
type = "audio/mpeg"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -529,7 +529,7 @@ module RSS
enclosure.type = type
end
assert_nil(rss.channel.items.last.enclosure)
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -540,7 +540,7 @@ module RSS
enclosure.type = type
end
assert_nil(rss.channel.items.last.enclosure)
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -557,7 +557,7 @@ module RSS
def test_source
url = "http://static.userland.com/tomalak/links2.xml"
content = "Tomalak's Realm"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -574,7 +574,7 @@ module RSS
def test_not_valid_source
url = "http://static.userland.com/tomalak/links2.xml"
content = "Tomalak's Realm"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -584,7 +584,7 @@ module RSS
source.content = content
end
assert_nil(rss.channel.items.last.source)
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -595,11 +595,11 @@ module RSS
end
assert_nil(rss.channel.items.last.source)
end
-
+
def test_category
domain = "http://www.fool.com/cusips"
content = "MSFT"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -616,7 +616,7 @@ module RSS
def test_not_valid_category
content = "Grateful Dead"
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
setup_dummy_item(maker)
@@ -627,7 +627,7 @@ module RSS
end
assert(rss.channel.items.last.categories.empty?)
end
-
+
def test_textInput
title = "fugafuga"
description = "text hoge fuga"
@@ -659,7 +659,7 @@ module RSS
end
end
end
-
+
def test_not_valid_textInput
title = "fugafuga"
description = "text hoge fuga"
@@ -678,7 +678,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.title = title
# maker.textinput.description = description
maker.textinput.name = name
@@ -688,7 +688,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.title = title
maker.textinput.description = description
# maker.textinput.name = name
@@ -698,7 +698,7 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.title = title
maker.textinput.description = description
maker.textinput.name = name
diff --git a/test/rss/test_maker_content.rb b/test/rss/test_maker_content.rb
index 53750bb095e..393adcb7157 100644
--- a/test/rss/test_maker_content.rb
+++ b/test/rss/test_maker_content.rb
@@ -7,7 +7,7 @@ module RSS
def setup
@uri = "http://purl.org/rss/1.0/modules/content/"
-
+
@elements = {
:encoded => "<em>ATTENTION</em>",
}
diff --git a/test/rss/test_maker_dc.rb b/test/rss/test_maker_dc.rb
index 72a967231a8..626ec8d7535 100644
--- a/test/rss/test_maker_dc.rb
+++ b/test/rss/test_maker_dc.rb
@@ -7,12 +7,12 @@ module RSS
def setup
@uri = "http://purl.org/dc/elements/1.1/"
-
+
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
-
+
@elements = {
:title => "hoge",
:description =>
@@ -103,7 +103,7 @@ module RSS
def test_date
t1 = Time.iso8601("2000-01-01T12:00:05+00:00")
t2 = Time.iso8601("2005-01-01T12:00:05+00:00")
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.channel.date = t1
@@ -121,7 +121,7 @@ module RSS
assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value})
assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value})
end
-
+
private
def accessor_name(name)
"dc_#{name}"
diff --git a/test/rss/test_maker_image.rb b/test/rss/test_maker_image.rb
index 1fc8076c468..4fba2cf795f 100644
--- a/test/rss/test_maker_image.rb
+++ b/test/rss/test_maker_image.rb
@@ -39,7 +39,7 @@ module RSS
setup_dummy_textinput(maker)
end
-
+
setup_rss = RSS::Maker.make("1.0") do |maker|
rss.setup_maker(maker)
end
@@ -49,7 +49,7 @@ module RSS
assert_equal(@favicon_infos["about"], favicon.about)
assert_equal(@favicon_infos["image_size"], favicon.image_size)
assert_equal(@favicon_infos["dc_title"], favicon.dc_title)
-
+
item = target.items.last.image_item
assert_equal(@item_infos["about"], item.about)
assert_equal(@item_infos["resource"], item.resource)
diff --git a/test/rss/test_maker_sy.rb b/test/rss/test_maker_sy.rb
index 309a3b70fd3..3f026b5c9cc 100644
--- a/test/rss/test_maker_sy.rb
+++ b/test/rss/test_maker_sy.rb
@@ -7,12 +7,12 @@ module RSS
def setup
@uri = "http://purl.org/rss/1.0/modules/syndication/"
-
+
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
-
+
@elements = {
:updatePeriod => "hourly",
:updateFrequency => "2",
diff --git a/test/rss/test_maker_taxo.rb b/test/rss/test_maker_taxo.rb
index 8feb4e1d331..c5cf18adc15 100644
--- a/test/rss/test_maker_taxo.rb
+++ b/test/rss/test_maker_taxo.rb
@@ -7,7 +7,7 @@ module RSS
def setup
@uri = "http://purl.org/rss/1.0/modules/taxonomy/"
-
+
@resources = [
"http://meerkat.oreillynet.com/?c=cat23",
"http://meerkat.oreillynet.com/?c=47",
@@ -52,7 +52,7 @@ module RSS
def _test_date
t1 = Time.iso8601("2000-01-01T12:00:05+00:00")
t2 = Time.iso8601("2005-01-01T12:00:05+00:00")
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.channel.date = t1
@@ -70,7 +70,7 @@ module RSS
assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value})
assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value})
end
-
+
private
def set_topics(target, resources=@resources)
resources.each do |value|
diff --git a/test/rss/test_maker_trackback.rb b/test/rss/test_maker_trackback.rb
index 58705c6f80a..d9fe2ad01dd 100644
--- a/test/rss/test_maker_trackback.rb
+++ b/test/rss/test_maker_trackback.rb
@@ -7,7 +7,7 @@ module RSS
def setup
@uri = "http://madskills.com/public/xml/rss/module/trackback/"
-
+
@elements = {
:ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback",
:abouts => [
diff --git a/test/rss/test_maker_xml-stylesheet.rb b/test/rss/test_maker_xml-stylesheet.rb
index 81d97ddc0e0..c1dd6f71ed3 100644
--- a/test/rss/test_maker_xml-stylesheet.rb
+++ b/test/rss/test_maker_xml-stylesheet.rb
@@ -35,7 +35,7 @@ module RSS
assert_equal(charset, xss.charset)
assert_equal(alternate, xss.alternate)
-
+
href = 'http://example.com/index.xsl'
type = 'text/xsl'
rss = RSS::Maker.make("1.0") do |maker|
@@ -55,7 +55,7 @@ module RSS
def test_not_valid_xml_stylesheet
href = 'xss.XXX'
type = "text/xsl"
-
+
rss = RSS::Maker.make("1.0") do |maker|
maker.xml_stylesheets.new_xml_stylesheet do |xss|
# xss.href = href
@@ -78,6 +78,6 @@ module RSS
end
assert(rss.xml_stylesheets.empty?)
end
-
+
end
end
diff --git a/test/rss/test_parser_1.0.rb b/test/rss/test_parser_1.0.rb
index 216881b7671..ddc82b157d9 100644
--- a/test/rss/test_parser_1.0.rb
+++ b/test/rss/test_parser_1.0.rb
@@ -484,7 +484,7 @@ EOR
assert_not_expected_tag(name, uri, "image") do
Parser.parse(rss, true, false)
end
-
+
uri = CONTENT_URI
name = "encoded"
elem = "<#{name} xmlns='#{uri}'/>"
diff --git a/test/rss/test_setup_maker_0.9.rb b/test/rss/test_setup_maker_0.9.rb
index c20186cc8a0..0bcb0cbdc95 100644
--- a/test/rss/test_setup_maker_0.9.rb
+++ b/test/rss/test_setup_maker_0.9.rb
@@ -64,7 +64,7 @@ module RSS
setup_dummy_image(maker)
end
channel = new_rss.channel
-
+
assert_equal(title, channel.title)
assert_equal(link, channel.link)
assert_equal(description, channel.description)
@@ -99,19 +99,19 @@ module RSS
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
maker.image.height = height
maker.image.description = description
end
-
+
new_rss = RSS::Maker.make("0.91") do |maker|
rss.channel.setup_maker(maker)
rss.image.setup_maker(maker)
end
-
+
image = new_rss.image
assert_equal(title, image.title)
assert_equal(link, image.link)
@@ -120,7 +120,7 @@ module RSS
assert_equal(height.to_i, image.height)
assert_equal(description, image.description)
end
-
+
def test_setup_maker_textinput
title = "fugafuga"
description = "text hoge fuga"
@@ -142,7 +142,7 @@ module RSS
rss.image.setup_maker(maker)
rss.textinput.setup_maker(maker)
end
-
+
textInput = new_rss.channel.textInput
assert_equal(title, textInput.title)
assert_equal(description, textInput.description)
@@ -156,10 +156,10 @@ module RSS
description = "text hoge fuga"
item_size = 5
-
+
rss = RSS::Maker.make("0.91") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |item|
item.title = "#{title}#{i}"
@@ -170,7 +170,7 @@ module RSS
setup_dummy_image(maker)
end
-
+
new_rss = RSS::Maker.make("0.91") do |maker|
rss.channel.setup_maker(maker)
@@ -196,11 +196,11 @@ module RSS
def test_setup_maker_items_backward_compatibility
test_setup_maker_items(true)
end
-
+
def test_setup_maker
encoding = "EUC-JP"
standalone = true
-
+
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
@@ -228,7 +228,7 @@ module RSS
new_rss = RSS::Maker.make("0.91") do |maker|
rss.setup_maker(maker)
end
-
+
assert_equal("0.91", new_rss.rss_version)
assert_equal(encoding, new_rss.encoding)
assert_equal(standalone, new_rss.standalone)
diff --git a/test/rss/test_setup_maker_1.0.rb b/test/rss/test_setup_maker_1.0.rb
index 0b960d91c8c..9f7bb1c1e82 100644
--- a/test/rss/test_setup_maker_1.0.rb
+++ b/test/rss/test_setup_maker_1.0.rb
@@ -10,7 +10,7 @@ module RSS
class << t
alias_method(:to_s, :iso8601)
end
-
+
@dc_elems = {
:title => "hoge",
:description =>
@@ -39,7 +39,7 @@ module RSS
@content_elems = {
:encoded => "<em>ATTENTION</em>",
}
-
+
@trackback_elems = {
:ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback",
:about => [
@@ -67,7 +67,7 @@ module RSS
},
]
end
-
+
def test_setup_maker_channel
about = "http://hoge.com"
title = "fugafuga"
@@ -79,7 +79,7 @@ module RSS
maker.channel.title = title
maker.channel.link = link
maker.channel.description = description
-
+
@dc_elems.each do |var, value|
maker.channel.__send__("dc_#{var}=", value)
end
@@ -98,7 +98,7 @@ module RSS
end
end
channel = new_rss.channel
-
+
assert_equal(about, channel.about)
assert_equal(title, channel.title)
assert_equal(link, channel.link)
@@ -110,23 +110,23 @@ module RSS
@dc_elems.each do |var, value|
assert_equal(value, channel.__send__("dc_#{var}"))
end
-
+
@sy_elems.each do |var, value|
value = value.to_i if var == :updateFrequency
assert_equal(value, channel.__send__("sy_#{var}"))
end
-
+
end
def test_setup_maker_image
title = "fugafuga"
link = "http://hoge.com"
url = "http://hoge.com/hoge.png"
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
@@ -136,7 +136,7 @@ module RSS
setup_dummy_item(maker)
end
-
+
new_rss = RSS::Maker.make("1.0") do |maker|
rss.channel.setup_maker(maker)
rss.image.setup_maker(maker)
@@ -144,7 +144,7 @@ module RSS
item.setup_maker(maker)
end
end
-
+
image = new_rss.image
assert_equal(url, image.about)
assert_equal(url, new_rss.channel.image.resource)
@@ -156,7 +156,7 @@ module RSS
assert_equal(image.__send__("dc_#{var}"), value)
end
end
-
+
def test_setup_maker_textinput
title = "fugafuga"
description = "text hoge fuga"
@@ -165,7 +165,7 @@ module RSS
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
maker.textinput.link = link
maker.textinput.title = title
maker.textinput.description = description
@@ -177,7 +177,7 @@ module RSS
setup_dummy_item(maker)
end
-
+
new_rss = RSS::Maker.make("1.0") do |maker|
rss.channel.setup_maker(maker)
rss.textinput.setup_maker(maker)
@@ -185,7 +185,7 @@ module RSS
item.setup_maker(maker)
end
end
-
+
textinput = new_rss.textinput
assert_equal(link, textinput.about)
assert_equal(link, new_rss.channel.textinput.resource)
@@ -205,10 +205,10 @@ module RSS
description = "text hoge fuga"
item_size = 5
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |item|
item.title = "#{title}#{i}"
@@ -232,7 +232,7 @@ module RSS
end
end
end
-
+
new_rss = RSS::Maker.make("1.0") do |maker|
rss.channel.setup_maker(maker)
@@ -244,7 +244,7 @@ module RSS
end
end
end
-
+
assert_equal(item_size, new_rss.items.size)
new_rss.items.each_with_index do |item, i|
assert_equal("#{link}#{i}", item.about)
@@ -255,11 +255,11 @@ module RSS
@dc_elems.each do |var, value|
assert_equal(item.__send__("dc_#{var}"), value)
end
-
+
@content_elems.each do |var, value|
assert_equal(item.__send__("content_#{var}"), value)
end
-
+
assert_equal(@trackback_elems[:ping], item.trackback_ping)
assert_equal(@trackback_elems[:about].size, item.trackback_abouts.size)
item.trackback_abouts.each_with_index do |about, j|
@@ -274,10 +274,10 @@ module RSS
description = "text hoge fuga"
item_size = 5
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
item = RSS::RDF::Item.new("#{link}#{i}")
item.title = "#{title}#{i}"
@@ -296,10 +296,10 @@ module RSS
assert_equal("#{description}#{i}", item.description)
end
-
+
rss = RSS::Maker.make("1.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
item = RSS::RDF::Item.new("#{link}#{i}")
item.title = "#{title}#{i}"
@@ -322,11 +322,11 @@ module RSS
def test_setup_maker_items_backward_compatibility
test_setup_maker_items(true)
end
-
+
def test_setup_maker
encoding = "EUC-JP"
standalone = true
-
+
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
@@ -350,11 +350,11 @@ module RSS
setup_dummy_channel(maker)
setup_dummy_item(maker)
end
-
+
new_rss = RSS::Maker.make("1.0") do |maker|
rss.setup_maker(maker)
end
-
+
assert_equal("1.0", new_rss.rss_version)
assert_equal(encoding, new_rss.encoding)
assert_equal(standalone, new_rss.standalone)
@@ -372,7 +372,7 @@ module RSS
def test_setup_maker_full
encoding = "EUC-JP"
standalone = true
-
+
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
@@ -387,18 +387,18 @@ module RSS
image_title = "fugafuga"
image_url = "http://hoge.com/hoge.png"
-
+
textinput_title = "fugafuga"
textinput_description = "text hoge fuga"
textinput_name = "hoge"
textinput_link = "http://hoge.com"
-
+
item_title = "TITLE"
item_link = "http://hoge.com/"
item_description = "text hoge fuga"
item_size = 5
-
+
rss = RSS::Maker.make("1.0") do |maker|
maker.encoding = encoding
maker.standalone = standalone
@@ -422,13 +422,13 @@ module RSS
@sy_elems.each do |var, value|
maker.channel.__send__("sy_#{var}=", value)
end
-
+
maker.image.title = image_title
maker.image.url = image_url
@dc_elems.each do |var, value|
maker.image.__send__("dc_#{var}=", value)
end
-
+
maker.textinput.link = textinput_link
maker.textinput.title = textinput_title
maker.textinput.description = textinput_description
@@ -436,7 +436,7 @@ module RSS
@dc_elems.each do |var, value|
maker.textinput.__send__("dc_#{var}=", value)
end
-
+
item_size.times do |i|
maker.items.new_item do |item|
item.title = "#{item_title}#{i}"
@@ -462,11 +462,11 @@ module RSS
setup_taxo_topic(maker, @taxo_topic_elems)
end
-
+
new_rss = RSS::Maker.make("1.0") do |maker|
rss.setup_maker(maker)
end
-
+
assert_equal("1.0", new_rss.rss_version)
assert_equal(encoding, new_rss.encoding)
assert_equal(standalone, new_rss.standalone)
@@ -509,7 +509,7 @@ module RSS
@dc_elems.each do |var, value|
assert_equal(image.__send__("dc_#{var}"), value)
end
-
+
textinput = new_rss.textinput
assert_equal(textinput_link, textinput.about)
assert_equal(textinput_link, new_rss.channel.textinput.resource)
@@ -531,11 +531,11 @@ module RSS
@dc_elems.each do |var, value|
assert_equal(item.__send__("dc_#{var}"), value)
end
-
+
@content_elems.each do |var, value|
assert_equal(item.__send__("content_#{var}"), value)
end
-
+
assert_equal(@trackback_elems[:ping], item.trackback_ping)
assert_equal(@trackback_elems[:about].size, item.trackback_abouts.size)
item.trackback_abouts.each_with_index do |about, j|
@@ -545,6 +545,6 @@ module RSS
assert_taxo_topic(@taxo_topic_elems, new_rss)
end
-
+
end
end
diff --git a/test/rss/test_setup_maker_2.0.rb b/test/rss/test_setup_maker_2.0.rb
index 8fb727de8d5..17a066a8a0c 100644
--- a/test/rss/test_setup_maker_2.0.rb
+++ b/test/rss/test_setup_maker_2.0.rb
@@ -62,7 +62,7 @@ module RSS
new_category.content = category
end
end
-
+
maker.channel.generator = generator
maker.channel.ttl = ttl
end
@@ -71,7 +71,7 @@ module RSS
rss.channel.setup_maker(maker)
end
channel = new_rss.channel
-
+
assert_equal(title, channel.title)
assert_equal(link, channel.link)
assert_equal(description, channel.description)
@@ -90,12 +90,12 @@ module RSS
skipHours.each_with_index do |hour, i|
assert_equal(hour.to_i, channel.skipHours.hours[i].content)
end
-
+
channel.categories.each_with_index do |category, i|
assert_equal(categories[i], category.content)
end
-
+
assert_equal(generator, channel.generator)
assert_equal(ttl.to_i, channel.ttl)
@@ -116,19 +116,19 @@ module RSS
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
maker.channel.link = link
-
+
maker.image.title = title
maker.image.url = url
maker.image.width = width
maker.image.height = height
maker.image.description = description
end
-
+
new_rss = RSS::Maker.make("2.0") do |maker|
rss.channel.setup_maker(maker)
rss.image.setup_maker(maker)
end
-
+
image = new_rss.image
assert_equal(title, image.title)
assert_equal(link, image.link)
@@ -137,7 +137,7 @@ module RSS
assert_equal(height.to_i, image.height)
assert_equal(description, image.description)
end
-
+
def test_setup_maker_textinput
title = "fugafuga"
description = "text hoge fuga"
@@ -157,7 +157,7 @@ module RSS
rss.channel.setup_maker(maker)
rss.textinput.setup_maker(maker)
end
-
+
textInput = new_rss.channel.textInput
assert_equal(title, textInput.title)
assert_equal(description, textInput.description)
@@ -175,22 +175,22 @@ module RSS
guid_isPermaLink = "true"
guid_content = "http://inessential.com/2002/09/01.php#a2"
-
+
enclosure_url = "http://www.scripting.com/mp3s/weatherReportSuite.mp3"
enclosure_length = "12216320"
enclosure_type = "audio/mpeg"
source_url = "http://static.userland.com/tomalak/links2.xml"
source_content = "Tomalak's Realm"
-
+
category_domain = "http://www.fool.com/cusips"
category_content = "MSFT"
-
+
item_size = 5
-
+
rss = RSS::Maker.make("2.0") do |maker|
setup_dummy_channel(maker)
-
+
item_size.times do |i|
maker.items.new_item do |item|
item.title = "#{title}#{i}"
@@ -216,7 +216,7 @@ module RSS
end
end
end
-
+
new_rss = RSS::Maker.make("2.0") do |maker|
rss.channel.setup_maker(maker)
@@ -228,7 +228,7 @@ module RSS
end
end
end
-
+
assert_equal(item_size, new_rss.items.size)
new_rss.items.each_with_index do |item, i|
assert_equal("#{title}#{i}", item.title)
@@ -258,11 +258,11 @@ module RSS
def test_setup_maker_items_backward_compatibility
test_setup_maker_items(true)
end
-
+
def test_setup_maker
encoding = "EUC-JP"
standalone = true
-
+
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
@@ -285,11 +285,11 @@ module RSS
setup_dummy_channel(maker)
end
-
+
new_rss = RSS::Maker.make("2.0") do |maker|
rss.setup_maker(maker)
end
-
+
assert_equal("2.0", new_rss.rss_version)
assert_equal(encoding, new_rss.encoding)
assert_equal(standalone, new_rss.standalone)
@@ -303,6 +303,6 @@ module RSS
assert_equal(charset, xss.charset)
assert_equal(alternate, xss.alternate)
end
-
+
end
end
diff --git a/test/rss/test_setup_maker_atom_feed.rb b/test/rss/test_setup_maker_atom_feed.rb
index 03d33dbb9c6..978b3cf1231 100644
--- a/test/rss/test_setup_maker_atom_feed.rb
+++ b/test/rss/test_setup_maker_atom_feed.rb
@@ -299,7 +299,7 @@ module RSS
def test_setup_maker
encoding = "EUC-JP"
standalone = true
-
+
href = 'a.xsl'
type = 'text/xsl'
title = 'sample'
diff --git a/test/rss/test_syndication.rb b/test/rss/test_syndication.rb
index abd75e905ee..69d6f444648 100644
--- a/test/rss/test_syndication.rb
+++ b/test/rss/test_syndication.rb
@@ -8,28 +8,28 @@ require "rss/syndication"
module RSS
class TestSyndication < TestCase
-
+
def setup
@prefix = "sy"
@uri = "http://purl.org/rss/1.0/modules/syndication/"
-
+
@parents = %w(channel)
-
+
t = Time.iso8601("2000-01-01T12:00:05+00:00")
class << t
alias_method(:to_s, :iso8601)
end
-
+
@elems = {
:updatePeriod => "hourly",
:updateFrequency => "2",
:updateBase => t,
}
-
+
@sy_nodes = @elems.collect do |name, value|
"<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>"
end.join("\n")
-
+
@rss_source = make_RDF(<<-EOR, {@prefix => @uri})
#{make_channel(@sy_nodes)}
#{make_image()}
@@ -39,13 +39,13 @@ EOR
@rss = Parser.parse(@rss_source)
end
-
+
def test_parser
-
+
assert_nothing_raised do
Parser.parse(@rss_source)
end
-
+
@elems.each do |tag, value|
assert_too_much_tag(tag.to_s, "channel") do
Parser.parse(make_RDF(<<-EOR, {@prefix => @uri}))
@@ -58,20 +58,20 @@ EOR
end
end
-
+
def test_accessor
-
+
t = Time.iso8601("2003-01-01T12:00:23+09:00")
class << t
alias_method(:to_s, :iso8601)
end
-
+
new_value = {
:updatePeriod => "daily",
:updateFrequency => "11",
:updateBase => t,
}
-
+
@elems.each do |name, value|
value = value.to_i if name == :updateFrequency
@parents.each do |parent|
@@ -82,7 +82,7 @@ EOR
assert_equal(new_val, @rss.__send__(parent).__send__("sy_#{name}"))
end
end
-
+
%w(hourly daily weekly monthly yearly).each do |x|
@parents.each do |parent|
assert_nothing_raised do
@@ -90,7 +90,7 @@ EOR
end
end
end
-
+
%w(-2 0.3 -0.4).each do |x|
@parents.each do |parent|
assert_not_available_value("sy:updateBase", x) do
@@ -98,11 +98,11 @@ EOR
end
end
end
-
+
end
def test_to_s
-
+
@elems.each do |name, value|
excepted = "<#{@prefix}:#{name}>#{value}</#{@prefix}:#{name}>"
@parents.each do |parent|
@@ -110,7 +110,7 @@ EOR
@rss.__send__(parent).__send__("sy_#{name}_element"))
end
end
-
+
REXML::Document.new(@rss_source).root.each_element do |parent|
if @parents.include?(parent.name)
parent.each_element do |elem|
diff --git a/test/rss/test_taxonomy.rb b/test/rss/test_taxonomy.rb
index 5109f3d892e..0370555d878 100644
--- a/test/rss/test_taxonomy.rb
+++ b/test/rss/test_taxonomy.rb
@@ -8,7 +8,7 @@ require "rss/taxonomy"
module RSS
class TestTaxonomy < TestCase
-
+
def setup
@prefix = "taxo"
@uri = "http://purl.org/rss/1.0/modules/taxonomy/"
@@ -19,9 +19,9 @@ module RSS
@prefix => @uri,
@dc_prefix => @dc_uri,
}
-
+
@topics_parents = %w(channel item)
-
+
@topics_lis = [
"http://meerkat.oreillynet.com/?c=cat23",
"http://meerkat.oreillynet.com/?c=47",
@@ -81,7 +81,7 @@ module RSS
end
rv << "</#{@prefix}:topic>"
end
-
+
@rss_source = make_RDF(<<-EOR, @ns)
#{make_channel(@topics_node)}
#{make_image()}
@@ -97,7 +97,7 @@ EOR
assert_nothing_raised do
Parser.parse(@rss_source)
end
-
+
assert_too_much_tag("topics", "channel") do
Parser.parse(make_RDF(<<-EOR, @ns))
#{make_channel(@topics_node * 2)}
@@ -112,7 +112,7 @@ EOR
EOR
end
end
-
+
def test_accessor
topics = @rss.channel.taxo_topics
assert_equal(@topics_lis.sort,
@@ -136,7 +136,7 @@ EOR
end
end
end
-
+
def test_to_s
@topics_parents.each do |parent|
meth = "taxo_topics_element"
diff --git a/test/rss/test_to_s.rb b/test/rss/test_to_s.rb
index 66739591ea1..4b38737bef5 100644
--- a/test/rss/test_to_s.rb
+++ b/test/rss/test_to_s.rb
@@ -19,7 +19,7 @@ module RSS
"http://example.com/1",
"http://example.com/2",
]
-
+
setup_xml_declaration_info
setup_xml_stylesheet_infos
setup_channel_info
@@ -57,7 +57,7 @@ module RSS
assert_image10(@image_info, rss.image)
assert_textinput10(@textinput_info, rss.textinput)
end
-
+
def test_to_s_09
rss = RSS::Maker.make("0.91") do |maker|
setup_full(maker)
@@ -79,7 +79,7 @@ module RSS
assert_image09(@image_info, rss.image)
assert_textinput09(@textinput_info, rss.textinput)
end
-
+
def test_to_s_20
rss = RSS::Maker.make("2.0") do |maker|
setup_full(maker)
@@ -101,7 +101,7 @@ module RSS
assert_image20(@image_info, rss.image)
assert_textinput20(@textinput_info, rss.textinput)
end
-
+
private
def setup_xml_declaration_info
@version = "1.0"
@@ -278,13 +278,13 @@ module RSS
"updateBase" => Time.now - 3600,
}
end
-
+
def setup_content_info
@content_info = {
"encoded" => "<p>p</p>",
}
end
-
+
def setup_trackback_info
@trackback_info = {
"ping" => "http://example.com/tb.cgi?tb_id=XXX",
@@ -323,7 +323,7 @@ module RSS
def setup_channel(maker)
channel = maker.channel
info = @channel_info
-
+
%w(about title link description language copyright
managingEditor webMaster rating docs date
lastBuildDate generator ttl).each do |name|
@@ -341,7 +341,7 @@ module RSS
new_hour = skipHours.new_hour
new_hour.content = hour
end
-
+
cloud = channel.cloud
%w(domain port path registerProcedure protocol).each do |name|
cloud.__send__("#{name}=", info["cloud"][name])
@@ -352,7 +352,7 @@ module RSS
category.__send__("#{name}=", info["category"][name])
end
end
-
+
def setup_image(maker)
image = maker.image
info = @image_info
@@ -361,7 +361,7 @@ module RSS
image.__send__("#{name}=", info[name])
end
end
-
+
def setup_items(maker)
items = maker.items
@@ -370,7 +370,7 @@ module RSS
%w(title link description date author comments).each do |name|
item.__send__("#{name}=", info[name])
end
-
+
guid = item.guid
%w(isPermaLink content).each do |name|
guid.__send__("#{name}=", info["guid"][name])
@@ -410,7 +410,7 @@ module RSS
target.__send__("#{prefix}_#{name}=", @content_info[name])
end
end
-
+
def setup_dublin_core(target)
prefix = "dc"
%w(title description creator subject publisher
@@ -419,14 +419,14 @@ module RSS
target.__send__("#{prefix}_#{name}=", @dc_info[name])
end
end
-
+
def setup_syndicate(target)
prefix = "sy"
%w(updatePeriod updateFrequency updateBase).each do |name|
target.__send__("#{prefix}_#{name}=", @sy_info[name])
end
end
-
+
def setup_trackback(target)
target.trackback_ping = @trackback_info["ping"]
@trackback_info["abouts"].each do |about|
@@ -439,7 +439,7 @@ module RSS
def assert_channel10(attrs, channel)
_wrap_assertion do
n_attrs = normalized_attrs(attrs)
-
+
names = %w(about title link description)
assert_attributes(attrs, names, channel)
@@ -458,7 +458,7 @@ module RSS
assert_attributes(attrs, %w(resource), image)
end
end
-
+
def assert_channel10_textinput(attrs, textinput)
_wrap_assertion do
assert_attributes(attrs, %w(resource), textinput)
@@ -506,7 +506,7 @@ module RSS
copyright pubDate lastBuildDate docs
managingEditor webMaster)
assert_attributes(attrs, names, channel)
-
+
%w(skipHours skipDays).each do |name|
value = n_attrs[name]
if value
@@ -525,7 +525,7 @@ module RSS
end
end
end
-
+
def assert_channel09_skipHours(contents, skipHours)
_wrap_assertion do
hours = skipHours.hours
@@ -534,7 +534,7 @@ module RSS
end
end
end
-
+
def assert_image09(attrs, image)
_wrap_assertion do
names = %w(url link title description)
@@ -552,7 +552,7 @@ module RSS
end
end
end
-
+
def assert_textinput09(attrs, textinput)
_wrap_assertion do
names = %w(title description name link)
@@ -564,7 +564,7 @@ module RSS
def assert_channel20(attrs, channel)
_wrap_assertion do
n_attrs = normalized_attrs(attrs)
-
+
names = %w(title link description language copyright
managingEditor webMaster pubDate
lastBuildDate generator docs rating)
@@ -584,11 +584,11 @@ module RSS
def assert_channel20_skipDays(contents, skipDays)
assert_channel09_skipDays(contents, skipDays)
end
-
+
def assert_channel20_skipHours(contents, skipHours)
assert_channel09_skipHours(contents, skipHours)
end
-
+
def assert_channel20_cloud(attrs, cloud)
_wrap_assertion do
names = %w(domain path registerProcedure protocol)
@@ -596,7 +596,7 @@ module RSS
assert_attributes(attrs, names, cloud)
end
end
-
+
def assert_channel20_categories(attrs, categories)
_wrap_assertion do
names = %w(domain content)
@@ -605,7 +605,7 @@ module RSS
end
end
end
-
+
def assert_image20(attrs, image)
_wrap_assertion do
names = %w(url link title description)
@@ -639,20 +639,20 @@ module RSS
assert_attributes(attrs, %w(url content), source)
end
end
-
+
def assert_items20_enclosure(attrs, enclosure)
_wrap_assertion do
names = ["url", ["length", :integer], "type"]
assert_attributes(attrs, names, enclosure)
end
end
-
+
def assert_items20_categories(attrs, categories)
_wrap_assertion do
assert_channel20_categories(attrs, categories)
end
end
-
+
def assert_items20_guid(attrs, guid)
_wrap_assertion do
names = [["isPermaLink", :boolean], ["content"]]
diff --git a/test/rss/test_trackback.rb b/test/rss/test_trackback.rb
index 26812d9010c..433e884deb0 100644
--- a/test/rss/test_trackback.rb
+++ b/test/rss/test_trackback.rb
@@ -9,26 +9,26 @@ require "rss/trackback"
module RSS
class TestTrackBack < TestCase
-
+
def setup
@prefix = "trackback"
@uri = "http://madskills.com/public/xml/rss/module/trackback/"
-
+
@parents = %w(item)
-
+
@elems = {
:ping => "http://bar.com/tb.cgi?tb_id=rssplustrackback",
:about => "http://foo.com/trackback/tb.cgi?tb_id=20020923",
}
-
+
@content_nodes = @elems.collect do |name, value|
"<#{@prefix}:#{name} rdf:resource=\"#{CGI.escapeHTML(value.to_s)}\"/>"
end.join("\n")
-
+
@content_nodes2 = @elems.collect do |name, value|
"<#{@prefix}:#{name}>#{CGI.escapeHTML(value.to_s)}</#{@prefix}:#{name}>"
end.join("\n")
-
+
@rss_source = make_RDF(<<-EOR, {@prefix => @uri})
#{make_channel()}
#{make_image()}
@@ -77,14 +77,14 @@ EOR
end
end
-
+
def test_accessor
-
+
new_value = {
:ping => "http://baz.com/trackback/tb.cgi?tb_id=20030808",
:about => "http://hoge.com/trackback/tb.cgi?tb_id=90030808",
}
-
+
@elems.each do |name, value|
@parents.each do |parent|
accessor = "#{RSS::TRACKBACK_PREFIX}_#{name}"
@@ -104,11 +104,11 @@ EOR
assert_equal(new_value[name], target20.__send__(accessor))
end
end
-
+
end
def test_to_s
-
+
@elems.each do |name, value|
excepted = %Q!<#{@prefix}:#{name} rdf:resource="#{CGI.escapeHTML(value)}"/>!
@parents.each do |parent|
@@ -117,7 +117,7 @@ EOR
assert_equal(excepted, @rss.__send__(parent).__send__(meth))
end
end
-
+
REXML::Document.new(@rss_source).root.each_element do |parent|
if @parents.include?(parent.name)
parent.each_element do |elem|
@@ -127,9 +127,9 @@ EOR
end
end
end
-
+
end
-
+
end
end
diff --git a/test/rss/test_xml-stylesheet.rb b/test/rss/test_xml-stylesheet.rb
index b946af12944..cc19a38287e 100644
--- a/test/rss/test_xml-stylesheet.rb
+++ b/test/rss/test_xml-stylesheet.rb
@@ -7,7 +7,7 @@ require "rss/xml-stylesheet"
module RSS
class TestXMLStyleSheet < TestCase
-
+
def test_accessor
[
{:href => "a.xsl", :type => "text/xsl"},
@@ -17,7 +17,7 @@ module RSS
assert_xml_stylesheet_attrs(attrs, XMLStyleSheet.new(attrs))
end
end
-
+
def test_to_s
[
{:href => "a.xsl", :type => "text/xsl"},
@@ -39,7 +39,7 @@ module RSS
assert_xml_stylesheet(target, attrs, XMLStyleSheet.new(contents))
end
end
-
+
def test_bad_alternate
%w(a ___ ??? BAD_ALTERNATE).each do |value|
xss = XMLStyleSheet.new
@@ -53,7 +53,7 @@ module RSS
assert_nil(xss.alternate)
end
end
-
+
def test_parse
[
[{:href => "a.xsl", :type => "text/xsl"},],
@@ -92,7 +92,7 @@ module RSS
end
end
end
-
+
def parse_pi(pi)
/\A\s*<\?(\S+)([^(?:\?>)]+)\?>\s*\z/ =~ pi
target = $1
@@ -103,6 +103,6 @@ module RSS
end
[target, contents]
end
-
+
end
end
diff --git a/test/ruby/allpairs.rb b/test/ruby/allpairs.rb
index 393d0c3288c..6cb2729b199 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 4aba8a0bdef..6900d03b704 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 4486a784296..5da7ad95dc0 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 d72fe702afe..10fd8f11127 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 d21cad0851f..92c309241f5 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 6ac93e037a5..b3145be8b54 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 0f1d18a8e51..031efdd7d1c 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 9f48d30d1d9..6e442b564bd 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 2f4b0bfbbde..6dd40bed84a 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 536d358dd0c..6d64ccf72b8 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 d9fe5505fe9..7ed2abb5639 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 42b249d0dc5..1bd3df4c1ae 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 06f3b7c6e56..77084f216fa 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 678a74a1d04..91da8c03c11 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 71299181ecc..ce942a8528e 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 2f435f645a1..efdc20c186b 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 7d6794292b5..2d43a56ab24 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 e1f7299636a..37336a08a62 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 e5c9b77ac16..5dc3caf561e 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 8ffbe549d67..46133eff8ce 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 8322fb17226..cb0548ba66f 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 793771017ef..7058834fa60 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 bf3861e74da..ee9c2144f3a 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 a19a78e605f..f402da39077 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 48294c96946..45bc599314b 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 b61d3d39dba..0a4db06160c 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 f64b1842302..5887dbc3dc1 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 c0c386040ff..a842c31c3f6 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 df5bda450dc..5628317cb86 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
diff --git a/test/rubygems/gem_package_tar_test_case.rb b/test/rubygems/gem_package_tar_test_case.rb
index 756b30ef27a..08ee57d66bc 100644
--- a/test/rubygems/gem_package_tar_test_case.rb
+++ b/test/rubygems/gem_package_tar_test_case.rb
@@ -49,7 +49,7 @@ class TarTestCase < RubyGemTestCase
linkname 100
magic 6
version 2
- uname 32
+ uname 32
gname 32
devmajor 8
devminor 8
@@ -68,7 +68,7 @@ class TarTestCase < RubyGemTestCase
next
end
- assert_equal expected[offset, length], actual[offset, length],
+ assert_equal expected[offset, length], actual[offset, length],
"Field #{name} of the tar header differs."
offset += length
diff --git a/test/rubygems/insure_session.rb b/test/rubygems/insure_session.rb
index e56f9abcb8f..4ae706494a7 100644
--- a/test/rubygems/insure_session.rb
+++ b/test/rubygems/insure_session.rb
@@ -23,7 +23,7 @@ def install_session
puts
puts "with the appropriate admin privileges."
puts "*****************************************************************"
- puts
+ puts
exit
end
gem 'session'
diff --git a/test/rubygems/simple_gem.rb b/test/rubygems/simple_gem.rb
index a6f14bc3c71..9bcb45878c9 100644
--- a/test/rubygems/simple_gem.rb
+++ b/test/rubygems/simple_gem.rb
@@ -8,7 +8,7 @@
MD5SUM = "e3701f9db765a2358aef94c40ded71c8"
if $0 == __FILE__
require 'optparse'
-
+
options = {}
ARGV.options do |opts|
opts.on_tail("--help", "show this message") {puts opts; exit}
@@ -19,45 +19,45 @@
end
require 'rubygems'
- @directory = options[:directory] || Gem.dir
+ @directory = options[:directory] || Gem.dir
@force = options[:force]
-
- gem = Gem::Installer.new(__FILE__).install(@force, @directory)
+
+ gem = Gem::Installer.new(__FILE__).install(@force, @directory)
if options[:gen_rdoc]
Gem::DocManager.new(gem).generate_rdoc
end
end
__END__
---- !ruby/object:Gem::Specification
+--- !ruby/object:Gem::Specification
rubygems_version: "1.0"
name: testing
-version: !ruby/object:Gem::Version
+version: !ruby/object:Gem::Version
version: 1.2.3
date: 2004-03-18 22:01:52.859121 -05:00
-platform:
+platform:
summary: This exercise the gem testing stuff.
-require_paths:
+require_paths:
- lib
-files:
+files:
- lib/foo.rb
- lib/test
- lib/test.rb
- lib/test/wow.rb
autorequire: test
test_suite_file: foo
-requirements:
+requirements:
- a computer processor
----
--
+---
+-
size: 109
mode: 420
path: lib/foo.rb
--
+-
size: 0
mode: 420
path: lib/test.rb
--
+-
size: 15
mode: 420
path: lib/test/wow.rb
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index b1a9d9d0a29..fd9954018ca 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -400,7 +400,7 @@ class TestGem < RubyGemTestCase
def test_self_refresh
util_make_gems
- a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec"
+ a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec"
FileUtils.mv a1_spec, @tempdir
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb
index 016a6d06165..75babee39da 100644
--- a/test/rubygems/test_gem_commands_sources_command.rb
+++ b/test/rubygems/test_gem_commands_sources_command.rb
@@ -244,7 +244,7 @@ Will cause RubyGems to revert to legacy indexes, degrading performance.
assert_equal "source cache successfully updated\n", @ui.output
assert_equal '', @ui.error
end
-
+
def test_execute_update_legacy
@cmd.handle_options %w[--update]
@@ -269,6 +269,6 @@ source cache successfully updated
assert_equal expected, @ui.output
assert_equal '', @ui.error
end
-
+
end
diff --git a/test/rubygems/test_gem_dependency_installer.rb b/test/rubygems/test_gem_dependency_installer.rb
index 3a57c05e791..bf38c11c18a 100644
--- a/test/rubygems/test_gem_dependency_installer.rb
+++ b/test/rubygems/test_gem_dependency_installer.rb
@@ -14,7 +14,7 @@ class TestGemDependencyInstaller < RubyGemTestCase
fp.puts "#!/usr/bin/ruby"
end
@a1, @a1_gem = util_gem 'a', '1' do |s| s.executables << 'a_bin' end
- @aa1, @aa1_gem = util_gem 'aa', '1'
+ @aa1, @aa1_gem = util_gem 'aa', '1'
@b1, @b1_gem = util_gem 'b', '1' do |s|
s.add_dependency 'a'
diff --git a/test/rubygems/test_gem_package_tar_input.rb b/test/rubygems/test_gem_package_tar_input.rb
index 279026b1495..5e6fb2badd5 100644
--- a/test/rubygems/test_gem_package_tar_input.rb
+++ b/test/rubygems/test_gem_package_tar_input.rb
@@ -48,7 +48,7 @@ class TestGemPackageTarInput < TarTestCase
meta = @spec.to_yaml
f.write tar_file_header("metadata", "", 0644, meta.size)
- f.write meta + "\0" * (1024 - meta.size)
+ f.write meta + "\0" * (1024 - meta.size)
f.write "\0" * 1024
end
diff --git a/test/rubygems/test_gem_package_tar_writer.rb b/test/rubygems/test_gem_package_tar_writer.rb
index 4c2b475bf11..5f3e7efb6ff 100644
--- a/test/rubygems/test_gem_package_tar_writer.rb
+++ b/test/rubygems/test_gem_package_tar_writer.rb
@@ -46,7 +46,7 @@ class TestTarWriter < TarTestCase
def test_add_file_simple_padding
@tar_writer.add_file_simple 'x', 0, 100
- assert_headers_equal tar_file_header('x', '', 0, 100),
+ assert_headers_equal tar_file_header('x', '', 0, 100),
@io.string[0, 512]
assert_equal "\0" * 512, @io.string[512, 512]
@@ -61,7 +61,7 @@ class TestTarWriter < TarTestCase
end
def test_add_file_simple_size
- assert_raises Gem::Package::TarWriter::FileOverflow do
+ assert_raises Gem::Package::TarWriter::FileOverflow do
@tar_writer.add_file_simple("lib/foo/bar", 0, 10) do |io|
io.write "1" * 11
end
@@ -69,7 +69,7 @@ class TestTarWriter < TarTestCase
end
def test_add_file_unseekable
- assert_raises Gem::Package::NonSeekableIO do
+ assert_raises Gem::Package::NonSeekableIO do
Gem::Package::TarWriter.new(Object.new).add_file 'x', 0
end
end
diff --git a/test/rubygems/test_gem_source_index.rb b/test/rubygems/test_gem_source_index.rb
index 48760292c0f..977f2c2b59d 100644
--- a/test/rubygems/test_gem_source_index.rb
+++ b/test/rubygems/test_gem_source_index.rb
@@ -594,7 +594,7 @@ WARNING: Invalid .gemspec format in '#{spec_file}'
end
def test_refresh_bang
- a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec"
+ a1_spec = File.join @gemhome, "specifications", "#{@a1.full_name}.gemspec"
FileUtils.mv a1_spec, @tempdir
diff --git a/test/rubygems/test_gem_specification.rb b/test/rubygems/test_gem_specification.rb
index d40e6787cd9..79093ff3a5f 100644
--- a/test/rubygems/test_gem_specification.rb
+++ b/test/rubygems/test_gem_specification.rb
@@ -490,7 +490,7 @@ end
'i386-mswin32_80' => 'a-1-x86-mswin32-80',
'i386-mingw32' => 'a-1-x86-mingw32'
}
-
+
test_cases.each do |arch, expected|
util_set_arch arch
@a1.platform = 'current'
diff --git a/test/scanf/test_scanf.rb b/test/scanf/test_scanf.rb
index 2e9e10ba5d1..893b51e7360 100644
--- a/test/scanf/test_scanf.rb
+++ b/test/scanf/test_scanf.rb
@@ -240,8 +240,8 @@ module ScanfTests
[ "%*5f%*d %*d %s", "1.2e23 45 string", ["string"] ],
[ "%f %*d %s", "12.e23 45 string", ["12.e23".to_f, "string"] ],
[ "%5f %d %s", "1.2e23 string", ["1.2e2".to_f, 3, "string"] ],
- [ "%s %f %s %d %x%c%c%c%c",
- "float: 1.2e23 dec/hex: 135a23 abc",
+ [ "%s %f %s %d %x%c%c%c%c",
+ "float: 1.2e23 dec/hex: 135a23 abc",
["float:", "1.2e23".to_f, "dec/hex:", 135, "a23".hex, " ", "a", "b", "c" ] ],
# Testing 's'
@@ -305,7 +305,7 @@ class TestIOScanf
extend ScanfTests
tmpfilename = "#{Dir.tmpdir}/iotest.dat.#{$$}"
-
+
i = 1
self.tests.each do |test|
define_method("test_#{i}") do ||
diff --git a/test/scanf/test_scanfblocks.rb b/test/scanf/test_scanfblocks.rb
index 907a3c28382..aea5033a540 100644
--- a/test/scanf/test_scanfblocks.rb
+++ b/test/scanf/test_scanfblocks.rb
@@ -20,7 +20,7 @@ class TestScanfBlock < Test::Unit::TestCase
Brahms 1833
EOS
end
-
+
alias set_up setup
def test_str1
res = @str.scanf("%s%d") { |name, year| "#{name} was born in #{year}." }
@@ -63,7 +63,7 @@ alias set_up setup
"Brahms was born in 1833." ],res)
fh.close
ensure
- File.delete(fn)
+ File.delete(fn)
end
def test_io2
@@ -75,7 +75,7 @@ alias set_up setup
assert_equal(fh.scanf("%d%f%s") {}, [])
fh.close
ensure
- File.delete(fn)
+ File.delete(fn)
end
end
diff --git a/test/socket/test_nonblock.rb b/test/socket/test_nonblock.rb
index 665648a3582..4e7807fa955 100644
--- a/test/socket/test_nonblock.rb
+++ b/test/socket/test_nonblock.rb
@@ -109,7 +109,7 @@ class TestSocketNonblock < Test::Unit::TestCase
assert_raise(Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINVAL) { s2.recvfrom_nonblock(100) }
s2.send("aaa", 0, s1.getsockname)
IO.select [s1]
- mesg, sockaddr = s1.recvfrom_nonblock(100)
+ mesg, sockaddr = s1.recvfrom_nonblock(100)
assert_equal("aaa", mesg)
port, addr = Socket.unpack_sockaddr_in(sockaddr)
s2_port, s2_addr = Socket.unpack_sockaddr_in(s2.getsockname)
diff --git a/test/socket/test_unix.rb b/test/socket/test_unix.rb
index fdf0ce72ea1..e18f5d6e957 100644
--- a/test/socket/test_unix.rb
+++ b/test/socket/test_unix.rb
@@ -445,7 +445,7 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
serv = Socket.unix_server_socket(sockpath)
c = Socket.unix(sockpath)
s, = serv.accept
- c.sendmsg("a", 0, nil, [:SOCKET, Socket::SCM_CREDS, ""])
+ c.sendmsg("a", 0, nil, [:SOCKET, Socket::SCM_CREDS, ""])
msg, cliend_ai, rflags, cred = s.recvmsg
assert_equal("a", msg)
inspect = cred.inspect
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 1c19fad5c4c..0c1ae5dc48b 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -117,7 +117,7 @@ class TestStringIO < Test::Unit::TestCase
def test_isatty
assert_equal(false, StringIO.new("").isatty)
end
-
+
def test_path
assert_equal(nil, StringIO.new("").path)
end
@@ -134,7 +134,7 @@ class TestStringIO < Test::Unit::TestCase
def test_set_fcntl
assert_raise(NotImplementedError) { StringIO.new("").fcntl }
end
-
+
def test_close
f = StringIO.new("")
f.close
@@ -147,7 +147,7 @@ class TestStringIO < Test::Unit::TestCase
ensure
f.close unless f.closed?
end
-
+
def test_close_read
f = StringIO.new("")
f.close_read
@@ -161,7 +161,7 @@ class TestStringIO < Test::Unit::TestCase
ensure
f.close unless f.closed?
end
-
+
def test_close_write
f = StringIO.new("")
f.close_write
diff --git a/test/test_prime.rb b/test/test_prime.rb
index 0dad7cf987c..e7c025a55a6 100644
--- a/test/test_prime.rb
+++ b/test/test_prime.rb
@@ -6,15 +6,15 @@ class TestPrime < Test::Unit::TestCase
# The first 100 prime numbers
PRIMES = [
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37,
- 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,
- 89, 97, 101, 103, 107, 109, 113, 127, 131,
- 137, 139, 149, 151, 157, 163, 167, 173, 179,
- 181, 191, 193, 197, 199, 211, 223, 227, 229,
- 233, 239, 241, 251, 257, 263, 269, 271, 277,
- 281, 283, 293, 307, 311, 313, 317, 331, 337,
- 347, 349, 353, 359, 367, 373, 379, 383, 389,
- 397, 401, 409, 419, 421, 431, 433, 439, 443,
- 449, 457, 461, 463, 467, 479, 487, 491, 499,
+ 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,
+ 89, 97, 101, 103, 107, 109, 113, 127, 131,
+ 137, 139, 149, 151, 157, 163, 167, 173, 179,
+ 181, 191, 193, 197, 199, 211, 223, 227, 229,
+ 233, 239, 241, 251, 257, 263, 269, 271, 277,
+ 281, 283, 293, 307, 311, 313, 317, 331, 337,
+ 347, 349, 353, 359, 367, 373, 379, 383, 389,
+ 397, 401, 409, 419, 421, 431, 433, 439, 443,
+ 449, 457, 461, 463, 467, 479, 487, 491, 499,
503, 509, 521, 523, 541,
]
def test_each
@@ -36,7 +36,7 @@ class TestPrime < Test::Unit::TestCase
end
# Prime number theorem
- assert primes.length >= max/Math.log(max)
+ assert primes.length >= max/Math.log(max)
delta = 0.05
li = (2..max).step(delta).inject(0){|sum,x| sum + delta/Math.log(x)}
assert primes.length <= li
diff --git a/test/test_pstore.rb b/test/test_pstore.rb
index 678ffa4a629..e10ce906cb4 100644
--- a/test/test_pstore.rb
+++ b/test/test_pstore.rb
@@ -17,14 +17,14 @@ class PStoreTest < Test::Unit::TestCase
assert_nil @pstore[:bar]
end
end
-
+
def test_opening_new_file_in_readwrite_mode_should_result_in_empty_values
@pstore.transaction do
assert_nil @pstore[:foo]
assert_nil @pstore[:bar]
end
end
-
+
def test_data_should_be_loaded_correctly_when_in_readonly_mode
@pstore.transaction do
@pstore[:foo] = "bar"
@@ -33,7 +33,7 @@ class PStoreTest < Test::Unit::TestCase
assert_equal "bar", @pstore[:foo]
end
end
-
+
def test_data_should_be_loaded_correctly_when_in_readwrite_mode
@pstore.transaction do
@pstore[:foo] = "bar"
@@ -42,7 +42,7 @@ class PStoreTest < Test::Unit::TestCase
assert_equal "bar", @pstore[:foo]
end
end
-
+
def test_changes_after_commit_are_discarded
@pstore.transaction do
@pstore[:foo] = "bar"
@@ -53,7 +53,7 @@ class PStoreTest < Test::Unit::TestCase
assert_equal "bar", @pstore[:foo]
end
end
-
+
def test_changes_are_not_written_on_abort
@pstore.transaction do
@pstore[:foo] = "bar"
@@ -63,7 +63,7 @@ class PStoreTest < Test::Unit::TestCase
assert_nil @pstore[:foo]
end
end
-
+
def test_writing_inside_readonly_transaction_raises_error
assert_raise(PStore::Error) do
@pstore.transaction(true) do
diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb
index e6ee3d6b4d5..d48a8882c8a 100644
--- a/test/test_shellwords.rb
+++ b/test/test_shellwords.rb
@@ -15,21 +15,21 @@ class TestShellwords < Test::Unit::TestCase
assert_instance_of(Array, shellwords(@cmd))
assert_equal(4, shellwords(@cmd).length)
end
-
+
def test_unmatched_double_quote
bad_cmd = 'one two "three'
assert_raise ArgumentError do
shellwords(bad_cmd)
end
end
-
+
def test_unmatched_single_quote
bad_cmd = "one two 'three"
assert_raise ArgumentError do
shellwords(bad_cmd)
end
end
-
+
def test_unmatched_quotes
bad_cmd = "one '"'"''""'""
assert_raise ArgumentError do
diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb
index 0fe031bdeec..dfc4acd8d36 100644
--- a/test/uri/test_common.rb
+++ b/test/uri/test_common.rb
@@ -12,20 +12,20 @@ class TestCommon < Test::Unit::TestCase
end
def test_extract
- assert_equal(['http://example.com'],
+ assert_equal(['http://example.com'],
URI.extract('http://example.com'))
- assert_equal(['http://example.com'],
+ assert_equal(['http://example.com'],
URI.extract('(http://example.com)'))
- assert_equal(['http://example.com/foo)'],
+ assert_equal(['http://example.com/foo)'],
URI.extract('(http://example.com/foo)'))
- assert_equal(['http://example.jphttp://example.jp'],
+ assert_equal(['http://example.jphttp://example.jp'],
URI.extract('http://example.jphttp://example.jp'), "[ruby-list:36086]")
- assert_equal(['http://example.jphttp://example.jp'],
+ assert_equal(['http://example.jphttp://example.jp'],
URI.extract('http://example.jphttp://example.jp', ['http']), "[ruby-list:36086]")
- assert_equal(['http://', 'mailto:'].sort,
+ assert_equal(['http://', 'mailto:'].sort,
URI.extract('ftp:// http:// mailto: https://', ['http', 'mailto']).sort)
# reported by Doug Kearns <djkea2@mugca.its.monash.edu.au>
- assert_equal(['From:', 'mailto:xxx@xxx.xxx.xxx]'].sort,
+ assert_equal(['From:', 'mailto:xxx@xxx.xxx.xxx]'].sort,
URI.extract('From: XXX [mailto:xxx@xxx.xxx.xxx]').sort)
end
diff --git a/test/uri/test_ftp.rb b/test/uri/test_ftp.rb
index 6311be81b7c..0d76c4497b8 100644
--- a/test/uri/test_ftp.rb
+++ b/test/uri/test_ftp.rb
@@ -14,7 +14,7 @@ class TestFTP < Test::Unit::TestCase
exp = [
'ftp',
- 'user:pass', 'host.com', URI::FTP.default_port,
+ 'user:pass', 'host.com', URI::FTP.default_port,
'abc/def', nil,
]
ary = [
@@ -28,7 +28,7 @@ class TestFTP < Test::Unit::TestCase
end
def test_paths
- # If you think what's below is wrong, please read RubyForge bug 2055,
+ # If you think what's below is wrong, please read RubyForge bug 2055,
# RFC 1738 section 3.2.2, and RFC 2396.
u = URI.parse('ftp://ftp.example.com/foo/bar/file.ext')
assert(u.path == 'foo/bar/file.ext')
@@ -41,9 +41,9 @@ class TestFTP < Test::Unit::TestCase
def test_assemble
# uri/ftp is conservative and uses the older RFC 1738 rules, rather than
# assuming everyone else has implemented RFC 2396.
- uri = URI::FTP.build(['user:password', 'ftp.example.com', nil,
+ uri = URI::FTP.build(['user:password', 'ftp.example.com', nil,
'/path/file.zip', 'i'])
- assert(uri.to_s ==
+ assert(uri.to_s ==
'ftp://user:password@ftp.example.com/%2Fpath/file.zip;type=i')
end
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index 0d481c369af..fcaa5997247 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -19,9 +19,9 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::HTTP, @base_url)
exp = [
- 'http',
- nil, 'a', URI::HTTP.default_port,
- '/b/c/d;p',
+ 'http',
+ nil, 'a', URI::HTTP.default_port,
+ '/b/c/d;p',
'q',
nil
]
@@ -33,8 +33,8 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::FTP, url)
exp = [
- 'ftp',
- nil, 'ftp.is.co.za', URI::FTP.default_port,
+ 'ftp',
+ nil, 'ftp.is.co.za', URI::FTP.default_port,
'rfc/rfc1808.txt', nil,
]
ary = uri_to_ary(url)
@@ -44,8 +44,8 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::FTP, url)
exp = [
- 'ftp',
- nil, 'ftp.is.co.za', URI::FTP.default_port,
+ 'ftp',
+ nil, 'ftp.is.co.za', URI::FTP.default_port,
'/rfc/rfc1808.txt', nil,
]
ary = uri_to_ary(url)
@@ -56,7 +56,7 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::Generic, url)
exp = [
- 'gopher',
+ 'gopher',
nil, 'spinaltap.micro.umn.edu', nil, nil,
'/00/Weather/California/Los%20Angeles', nil,
nil,
@@ -70,9 +70,9 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::HTTP, url)
exp = [
- 'http',
- nil, 'www.math.uio.no', URI::HTTP.default_port,
- '/faq/compression-faq/part1.html',
+ 'http',
+ nil, 'www.math.uio.no', URI::HTTP.default_port,
+ '/faq/compression-faq/part1.html',
nil,
nil
]
@@ -84,7 +84,7 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::Generic, url)
exp = [
- 'mailto',
+ 'mailto',
'mduerst@ifi.unizh.ch',
[]
]
@@ -96,8 +96,8 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::Generic, url)
exp = [
- 'news',
- nil, nil, nil, nil,
+ 'news',
+ nil, nil, nil, nil,
nil, 'comp.infosystems.www.servers.unix',
nil,
nil
@@ -110,8 +110,8 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_kind_of(URI::Generic, url)
exp = [
- 'telnet',
- nil, 'melvyl.ucop.edu', nil, nil,
+ 'telnet',
+ nil, 'melvyl.ucop.edu', nil, nil,
'/', nil,
nil,
nil
diff --git a/test/uri/test_http.rb b/test/uri/test_http.rb
index 6c8e700b776..a323d43a79d 100644
--- a/test/uri/test_http.rb
+++ b/test/uri/test_http.rb
@@ -18,7 +18,7 @@ class TestHTTP < Test::Unit::TestCase
def test_parse
u = URI.parse('http://a')
assert_kind_of(URI::HTTP, u)
- assert_equal(['http',
+ assert_equal(['http',
nil, 'a', URI::HTTP.default_port,
'', nil, nil], uri_to_ary(u))
end
diff --git a/test/uri/test_ldap.rb b/test/uri/test_ldap.rb
index 0eaa113c946..14ef39242ef 100644
--- a/test/uri/test_ldap.rb
+++ b/test/uri/test_ldap.rb
@@ -38,47 +38,47 @@ class TestLDAP < Test::Unit::TestCase
# from RFC2255, section 6.
urls = {
'ldap:///o=University%20of%20Michigan,c=US' =>
- ['ldap', nil, URI::LDAP::DEFAULT_PORT,
- 'o=University%20of%20Michigan,c=US',
+ ['ldap', nil, URI::LDAP::DEFAULT_PORT,
+ 'o=University%20of%20Michigan,c=US',
nil, nil, nil, nil],
'ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US' =>
- ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT,
- 'o=University%20of%20Michigan,c=US',
+ ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT,
+ 'o=University%20of%20Michigan,c=US',
nil, nil, nil, nil],
'ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress' =>
- ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT,
+ ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT,
'o=University%20of%20Michigan,c=US',
'postalAddress', nil, nil, nil],
'ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)' =>
- ['ldap', 'host.com', 6666,
+ ['ldap', 'host.com', 6666,
'o=University%20of%20Michigan,c=US',
nil, 'sub', '(cn=Babs%20Jensen)', nil],
'ldap://ldap.itd.umich.edu/c=GB?objectClass?one' =>
- ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT,
- 'c=GB',
+ ['ldap', 'ldap.itd.umich.edu', URI::LDAP::DEFAULT_PORT,
+ 'c=GB',
'objectClass', 'one', nil, nil],
'ldap://ldap.question.com/o=Question%3f,c=US?mail' =>
- ['ldap', 'ldap.question.com', URI::LDAP::DEFAULT_PORT,
+ ['ldap', 'ldap.question.com', URI::LDAP::DEFAULT_PORT,
'o=Question%3f,c=US',
'mail', nil, nil, nil],
'ldap://ldap.netscape.com/o=Babsco,c=US??(int=%5c00%5c00%5c00%5c04)' =>
- ['ldap', 'ldap.netscape.com', URI::LDAP::DEFAULT_PORT,
+ ['ldap', 'ldap.netscape.com', URI::LDAP::DEFAULT_PORT,
'o=Babsco,c=US',
nil, '(int=%5c00%5c00%5c00%5c04)', nil, nil],
'ldap:///??sub??bindname=cn=Manager%2co=Foo' =>
- ['ldap', nil, URI::LDAP::DEFAULT_PORT,
+ ['ldap', nil, URI::LDAP::DEFAULT_PORT,
'',
nil, 'sub', nil, 'bindname=cn=Manager%2co=Foo'],
'ldap:///??sub??!bindname=cn=Manager%2co=Foo' =>
- ['ldap', nil, URI::LDAP::DEFAULT_PORT,
+ ['ldap', nil, URI::LDAP::DEFAULT_PORT,
'',
nil, 'sub', nil, '!bindname=cn=Manager%2co=Foo'],
}.each do |url, ary|
diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb
index 38715fcc9c3..04fb6fdadcc 100644
--- a/test/uri/test_mailto.rb
+++ b/test/uri/test_mailto.rb
@@ -29,46 +29,46 @@ class TestMailTo < Test::Unit::TestCase
# mailto:infobot@example.com?subject=current-issue
ok << ["mailto:infobot@example.com?subject=current-issue"]
ok[-1] << ["infobot@example.com", ["subject=current-issue"]]
- ok[-1] << {:to => "infobot@example.com",
+ ok[-1] << {:to => "infobot@example.com",
:headers => ["subject=current-issue"]}
# mailto:infobot@example.com?body=send%20current-issue
ok << ["mailto:infobot@example.com?body=send%20current-issue"]
ok[-1] << ["infobot@example.com", ["body=send%20current-issue"]]
- ok[-1] << {:to => "infobot@example.com",
+ ok[-1] << {:to => "infobot@example.com",
:headers => ["body=send%20current-issue"]}
# mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index
ok << ["mailto:infobot@example.com?body=send%20current-issue%0D%0Asend%20index"]
- ok[-1] << ["infobot@example.com",
+ ok[-1] << ["infobot@example.com",
["body=send%20current-issue%0D%0Asend%20index"]]
- ok[-1] << {:to => "infobot@example.com",
+ ok[-1] << {:to => "infobot@example.com",
:headers => ["body=send%20current-issue%0D%0Asend%20index"]}
# mailto:foobar@example.com?In-Reply-To=%3c3469A91.D10AF4C@example.com
ok << ["mailto:foobar@example.com?In-Reply-To=%3c3469A91.D10AF4C@example.com"]
- ok[-1] << ["foobar@example.com",
+ ok[-1] << ["foobar@example.com",
["In-Reply-To=%3c3469A91.D10AF4C@example.com"]]
- ok[-1] << {:to => "foobar@example.com",
+ ok[-1] << {:to => "foobar@example.com",
:headers => ["In-Reply-To=%3c3469A91.D10AF4C@example.com"]}
# mailto:majordomo@example.com?body=subscribe%20bamboo-l
ok << ["mailto:majordomo@example.com?body=subscribe%20bamboo-l"]
ok[-1] << ["majordomo@example.com", ["body=subscribe%20bamboo-l"]]
- ok[-1] << {:to => "majordomo@example.com",
+ ok[-1] << {:to => "majordomo@example.com",
:headers => ["body=subscribe%20bamboo-l"]}
# mailto:joe@example.com?cc=bob@example.com&body=hello
ok << ["mailto:joe@example.com?cc=bob@example.com&body=hello"]
ok[-1] << ["joe@example.com", ["cc=bob@example.com", "body=hello"]]
- ok[-1] << {:to => "joe@example.com",
+ ok[-1] << {:to => "joe@example.com",
:headers => ["cc=bob@example.com", "body=hello"]}
# mailto:?to=joe@example.com&cc=bob@example.com&body=hello
ok << ["mailto:?to=joe@example.com&cc=bob@example.com&body=hello"]
- ok[-1] << [nil,
+ ok[-1] << [nil,
["to=joe@example.com", "cc=bob@example.com", "body=hello"]]
- ok[-1] << {:headers => ["to=joe@example.com",
+ ok[-1] << {:headers => ["to=joe@example.com",
"cc=bob@example.com", "body=hello"]}
# mailto:gorby%25kremvax@example.com
@@ -79,7 +79,7 @@ class TestMailTo < Test::Unit::TestCase
# mailto:unlikely%3Faddress@example.com?blat=foop
ok << ["mailto:unlikely%3Faddress@example.com?blat=foop"]
ok[-1] << ["unlikely%3Faddress@example.com", ["blat=foop"]]
- ok[-1] << {:to => "unlikely%3Faddress@example.com",
+ ok[-1] << {:to => "unlikely%3Faddress@example.com",
:headers => ["blat=foop"]}
ok_all = ok.flatten.join("\0")
diff --git a/test/webrick/test_cookie.rb b/test/webrick/test_cookie.rb
index c8ded4c2dde..14771fd01cf 100644
--- a/test/webrick/test_cookie.rb
+++ b/test/webrick/test_cookie.rb
@@ -61,7 +61,7 @@ class TestWEBrickCookie < Test::Unit::TestCase
assert_equal("WILE_E_COYOTE", cookie.value)
assert_equal(1, cookie.version)
assert_equal("/acme", cookie.path)
-
+
data = %(Shipping="FedEx"; Version="1"; Path="/acme"; Secure)
cookie = WEBrick::Cookie.parse_set_cookie(data)
assert_equal("Shipping", cookie.name)
diff --git a/test/webrick/test_httpauth.rb b/test/webrick/test_httpauth.rb
index a6e29474b36..56f96235f1b 100644
--- a/test/webrick/test_httpauth.rb
+++ b/test/webrick/test_httpauth.rb
@@ -14,7 +14,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
server.mount_proc(path){|req, res|
WEBrick::HTTPAuth.basic_auth(req, res, realm){|user, pass|
user == "webrick" && pass == "supersecretpassword"
- }
+ }
res.body = "hoge"
}
http = Net::HTTP.new(addr, port)
diff --git a/test/webrick/test_httpproxy.rb b/test/webrick/test_httpproxy.rb
index 1f914e3a994..ab82ed8cd73 100644
--- a/test/webrick/test_httpproxy.rb
+++ b/test/webrick/test_httpproxy.rb
@@ -25,7 +25,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase
# Testing GET or POST to the proxy server
# Note that the proxy server works as the origin server.
# +------+
- # V |
+ # V |
# client -------> proxy ---+
# GET / POST GET / POST
#
@@ -176,7 +176,7 @@ class TestWEBrickHTTPProxy < Test::Unit::TestCase
# Testing GET or POST through the upstream proxy server
# Note that the upstream proxy server works as the origin server.
# +------+
- # V |
+ # V |
# client -------> proxy -------> proxy ---+
# GET / POST GET / POST GET / POST
#
diff --git a/test/webrick/test_httprequest.rb b/test/webrick/test_httprequest.rb
index 92ad1e79ca7..4a1db38bca8 100644
--- a/test/webrick/test_httprequest.rb
+++ b/test/webrick/test_httprequest.rb
@@ -79,7 +79,7 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase
Accept-Language: ja
Content-Type: text/plain
Content-Length: 7
- X-Empty-Header:
+ X-Empty-Header:
foobar
_end_of_message_
diff --git a/test/win32ole/test_folderitem2_invokeverb.rb b/test/win32ole/test_folderitem2_invokeverb.rb
index 07cb9802d68..5a5d475059f 100644
--- a/test/win32ole/test_folderitem2_invokeverb.rb
+++ b/test/win32ole/test_folderitem2_invokeverb.rb
@@ -32,7 +32,7 @@ if defined?(WIN32OLE)
# Search the 'Create Shortcut (&S)' string in Japanese.
# Yes, I know the string in the Windows 2000 Japanese Edition.
# But I do not know about the string in any other Windows.
- #
+ #
verbs = @fi2.verbs
verbs.extend(Enumerable)
@cp = WIN32OLE.codepage
@@ -40,7 +40,7 @@ if defined?(WIN32OLE)
WIN32OLE.codepage = 932
rescue
end
- @shortcut = verbs.collect{|verb|
+ @shortcut = verbs.collect{|verb|
verb.name
}.find {|name|
name.unpack("C*") == [131, 86, 131, 135, 129, 91, 131, 103, 131, 74, 131, 98, 131, 103, 130, 204, 141, 236, 144, 172, 40, 38, 83, 41]
diff --git a/test/win32ole/test_nil2vtempty.rb b/test/win32ole/test_nil2vtempty.rb
index 4be3902b6d9..8508ecdf971 100644
--- a/test/win32ole/test_nil2vtempty.rb
+++ b/test/win32ole/test_nil2vtempty.rb
@@ -26,7 +26,7 @@ if defined?(WIN32OLE)
rs = con.openSchema(4, [nil,nil,"DUMMY", "TABLE"])
assert(rs)
assert_equal("_Recordset", rs.ole_type.name)
-
+
rs = con.openSchema(4, [WIN32OLE_VARIANT::Empty, WIN32OLE_VARIANT::Empty, "DUMMY", "TABLE"])
assert(rs)
assert_equal("_Recordset", rs.ole_type.name)
diff --git a/test/win32ole/test_ole_methods.rb b/test/win32ole/test_ole_methods.rb
index ca1c03b0101..869828d22fc 100644
--- a/test/win32ole/test_ole_methods.rb
+++ b/test/win32ole/test_ole_methods.rb
@@ -9,7 +9,7 @@ require "test/unit"
if defined?(WIN32OLE)
class TestWIN32OLE_FOR_PROPERTYPUTREF < Test::Unit::TestCase
-
+
def setup
@obj = WIN32OLE.new('Scripting.Dictionary')
end
diff --git a/test/win32ole/test_win32ole.rb b/test/win32ole/test_win32ole.rb
index b946aa6ff08..18da3bec7aa 100644
--- a/test/win32ole/test_win32ole.rb
+++ b/test/win32ole/test_win32ole.rb
@@ -16,7 +16,7 @@ if defined?(WIN32OLE)
def test_convert_bignum
@dict1.add("a", 9999999999)
@dict1.add("b", 999999999)
- @dict1.add("c", @dict1.item("b") * 10 + 9)
+ @dict1.add("c", @dict1.item("b") * 10 + 9)
assert_equal(9999999999, @dict1.item("a"))
assert_equal(9999999999, @dict1.item("c"))
end
@@ -134,11 +134,11 @@ if defined?(WIN32OLE)
@dict1.add("ary2", [[1,2,"a"], [3,4,"b"]])
assert_equal([[1,2,"a"], [3,4,"b"]], @dict1["ary2"])
- @dict1.add("ary3", [[[1]]])
- assert_equal([[[1]]], @dict1["ary3"])
+ @dict1.add("ary3", [[[1]]])
+ assert_equal([[[1]]], @dict1["ary3"])
- @dict1.add("ary4", [[[1], [2], [3]], [[4], [5], [6]]])
- assert_equal([[[1],[2], [3]], [[4], [5], [6]]], @dict1["ary4"])
+ @dict1.add("ary4", [[[1], [2], [3]], [[4], [5], [6]]])
+ assert_equal([[[1],[2], [3]], [[4], [5], [6]]], @dict1["ary4"])
end
end
@@ -303,7 +303,7 @@ if defined?(WIN32OLE)
guid)
end
- #
+ #
# WIN32OLE.codepage is initialized according to Encoding.default_external.
#
# def test_s_codepage
@@ -342,7 +342,7 @@ if defined?(WIN32OLE)
assert_equal("\xA4\xA2".force_encoding("CP20932"), obj.value)
end
- WIN32OLE.codepage = cp
+ WIN32OLE.codepage = cp
file = fso.opentextfile(fname, 2, true)
file.write [0x3042].pack("U*").force_encoding("UTF-8")
file.close
@@ -353,7 +353,7 @@ if defined?(WIN32OLE)
assert_equal("\202\240", str)
# This test fail if codepage 20932 (euc) is not installed.
- begin
+ begin
WIN32OLE.codepage = 20932
rescue WIN32OLERuntimeError
end
diff --git a/test/win32ole/test_win32ole_event.rb b/test/win32ole/test_win32ole_event.rb
index dff9a68c9b6..7e7ee102222 100644
--- a/test/win32ole/test_win32ole_event.rb
+++ b/test/win32ole/test_win32ole_event.rb
@@ -63,7 +63,7 @@ if defined?(WIN32OLE_EVENT)
@db.close
10.times do |i|
WIN32OLE_EVENT.new(@db)
- GC.start
+ GC.start
message_loop
@db.open
message_loop
@@ -176,7 +176,7 @@ if defined?(WIN32OLE_EVENT)
ev.on_event('WillConnect'){|*args|
{:return => 1, :ConnectionString => CONNSTR}
}
- @db.connectionString = 'XXX'
+ @db.connectionString = 'XXX'
@db.open
assert(true)
end
@@ -186,7 +186,7 @@ if defined?(WIN32OLE_EVENT)
ev.on_event('WillConnect'){|*args|
{:ConnectionString => CONNSTR}
}
- @db.connectionString = 'XXX'
+ @db.connectionString = 'XXX'
@db.open
assert(true)
end
@@ -196,7 +196,7 @@ if defined?(WIN32OLE_EVENT)
ev.on_event('WillConnect'){|*args|
{'ConnectionString' => CONNSTR}
}
- @db.connectionString = 'XXX'
+ @db.connectionString = 'XXX'
@db.open
assert(true)
end
@@ -206,7 +206,7 @@ if defined?(WIN32OLE_EVENT)
ev.on_event('WillConnect'){|*args|
{'return' => 1, 'ConnectionString' => CONNSTR}
}
- @db.connectionString = 'XXX'
+ @db.connectionString = 'XXX'
@db.open
assert(true)
end
@@ -216,7 +216,7 @@ if defined?(WIN32OLE_EVENT)
ev.on_event('WillConnect'){|*args|
{0 => CONNSTR}
}
- @db.connectionString = 'XXX'
+ @db.connectionString = 'XXX'
@db.open
assert(true)
end
diff --git a/test/win32ole/test_win32ole_method.rb b/test/win32ole/test_win32ole_method.rb
index f2ed0c622cf..762ef1d7955 100644
--- a/test/win32ole/test_win32ole_method.rb
+++ b/test/win32ole/test_win32ole_method.rb
@@ -6,7 +6,7 @@ require "test/unit"
if defined?(WIN32OLE_METHOD)
class TestWIN32OLE_METHOD < Test::Unit::TestCase
-
+
def setup
ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "Shell")
@m_open = WIN32OLE_METHOD.new(ole_type, "open")
@@ -125,7 +125,7 @@ if defined?(WIN32OLE_METHOD)
def test_params
params = @m_browse_for_folder.params
assert_instance_of(Array, params)
- assert_equal(4, params.size)
+ assert_equal(4, params.size)
assert_instance_of(WIN32OLE_PARAM, params[0])
end
diff --git a/test/win32ole/test_win32ole_param.rb b/test/win32ole/test_win32ole_param.rb
index 1c866ca53ef..3b831c3937a 100644
--- a/test/win32ole/test_win32ole_param.rb
+++ b/test/win32ole/test_win32ole_param.rb
@@ -6,7 +6,7 @@ require "test/unit"
if defined?(WIN32OLE_PARAM)
class TestWIN32OLE_PARAM < Test::Unit::TestCase
-
+
def setup
ole_type = WIN32OLE_TYPE.new("Microsoft Internet Controls", "WebBrowser")
m_navigate = WIN32OLE_METHOD.new(ole_type, "Navigate")
diff --git a/test/win32ole/test_win32ole_type.rb b/test/win32ole/test_win32ole_type.rb
index f8ea525ea9c..8ecf2b2c27c 100644
--- a/test/win32ole/test_win32ole_type.rb
+++ b/test/win32ole/test_win32ole_type.rb
@@ -51,7 +51,7 @@ if defined?(WIN32OLE_TYPE)
assert_equal(0, ole_type.helpcontext)
assert_equal([], ole_type.variables)
assert(ole_type.ole_methods.select{|m|/NameSpace/i =~ m.name}.size > 0)
-
+
ole_type2 = WIN32OLE_TYPE.new("{13709620-C279-11CE-A49E-444553540000}", "Shell")
assert_instance_of(WIN32OLE_TYPE, ole_type)
assert_equal(ole_type.name, ole_type2.name)
@@ -184,7 +184,7 @@ if defined?(WIN32OLE_TYPE)
assert_equal(1, otype.size)
otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
assert_equal(1, otype.size)
- otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
assert_equal(1, otype.size)
end
@@ -197,7 +197,7 @@ if defined?(WIN32OLE_TYPE)
assert_equal(0, otype.size)
otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
assert_equal(1, otype.size)
- otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
assert_equal(0, otype.size)
end
@@ -210,7 +210,7 @@ if defined?(WIN32OLE_TYPE)
assert_equal(0, otype.size)
otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
assert_equal(1, otype.size)
- otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
assert_equal(1, otype.size)
end
@@ -223,7 +223,7 @@ if defined?(WIN32OLE_TYPE)
assert_equal(0, otype.size)
otype = ole_types.select{|t| t.name == "DWebBrowserEvents2"}
assert_equal(1, otype.size)
- otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
+ otype = ole_types.select{|t| t.name == "DWebBrowserEvents"}
assert_equal(0, otype.size)
end
diff --git a/test/win32ole/test_win32ole_variable.rb b/test/win32ole/test_win32ole_variable.rb
index 43529d3bad8..5fdcb07e4c3 100644
--- a/test/win32ole/test_win32ole_variable.rb
+++ b/test/win32ole/test_win32ole_variable.rb
@@ -6,7 +6,7 @@ require "test/unit"
if defined?(WIN32OLE_VARIABLE)
class TestWIN32OLE_VARIABLE < Test::Unit::TestCase
-
+
def setup
ole_type = WIN32OLE_TYPE.new("Microsoft Shell Controls And Automation", "ShellSpecialFolderConstants")
@var1 = ole_type.variables.find {|v| v.name == 'ssfDESKTOP'}
diff --git a/test/win32ole/test_win32ole_variant.rb b/test/win32ole/test_win32ole_variant.rb
index af3876837d2..7bf6caac49f 100644
--- a/test/win32ole/test_win32ole_variant.rb
+++ b/test/win32ole/test_win32ole_variant.rb
@@ -102,7 +102,7 @@ if defined?(WIN32OLE_VARIANT)
assert_equal(0, obj.value)
assert_equal(WIN32OLE::VARIANT::VT_UI4, obj.vartype)
-
+
if defined?(WIN32OLE::VARIANT::VT_I8)
obj = WIN32OLE_VARIANT.new(nil, WIN32OLE::VARIANT::VT_I8)
assert_equal(0, obj.value)
@@ -114,7 +114,7 @@ if defined?(WIN32OLE_VARIANT)
assert_equal(0, obj.value)
assert_equal(WIN32OLE::VARIANT::VT_UI8, obj.vartype)
end
-
+
obj = WIN32OLE_VARIANT.new(nil, WIN32OLE::VARIANT::VT_INT)
assert_equal(0, obj.value)
assert_equal(WIN32OLE::VARIANT::VT_INT, obj.vartype)
@@ -251,7 +251,7 @@ if defined?(WIN32OLE_VARIANT)
assert_equal(5, obj.value)
assert_equal(WIN32OLE::VARIANT::VT_UINT|WIN32OLE::VARIANT::VT_BYREF, obj.vartype)
end
-
+
# This test is failed in cygwin.
# The tagVARIANT definition has no union member pllVal in cygwin.
def test_s_new_with_i8_byref
@@ -263,7 +263,7 @@ if defined?(WIN32OLE_VARIANT)
STDERR.puts("\n#{__FILE__}:#{__LINE__}:#{self.class.name}.test_s_new_with_i8_byref is skipped")
end
end
-
+
# This test is failed in cygwin.
# The tagVARIANT definition has no union member pullVal in cygwin.
def test_s_new_with_ui8_byref
@@ -319,7 +319,7 @@ if defined?(WIN32OLE_VARIANT)
obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_BYREF)
assert_equal(WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_ARRAY, obj.vartype)
assert_equal([[0, 0, 0],[0, 0, 0]], obj.value)
-
+
obj = WIN32OLE_VARIANT.array([2,3], WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_ARRAY)
assert_instance_of(WIN32OLE_VARIANT, obj)
assert_equal(WIN32OLE::VARIANT::VT_I4|WIN32OLE::VARIANT::VT_ARRAY, obj.vartype)
@@ -383,7 +383,7 @@ if defined?(WIN32OLE_VARIANT)
end
def test_conversion_str2cy
- begin
+ begin
WIN32OLE.locale = 0x0411 # set locale Japanese
obj = WIN32OLE_VARIANT.new("\\10,000", WIN32OLE::VARIANT::VT_CY)
assert_equal("10000", obj.value)
@@ -464,7 +464,7 @@ if defined?(WIN32OLE_VARIANT)
obj = WIN32OLE_VARIANT.new(["abc", "123"], vartype)
assert_equal(vartype, obj.vartype)
assert_equal(["abc", "123"], obj.value)
-
+
vartype = WIN32OLE::VARIANT::VT_ARRAY|WIN32OLE::VARIANT::VT_BYREF|WIN32OLE::VARIANT::VT_BSTR
obj = WIN32OLE_VARIANT.new(["abc", "123"], vartype)
assert_equal(vartype, obj.vartype)
diff --git a/test/win32ole/test_word.rb b/test/win32ole/test_word.rb
index d5b2d91812e..e2ca6d4d5c0 100644
--- a/test/win32ole/test_word.rb
+++ b/test/win32ole/test_word.rb
@@ -38,7 +38,7 @@ if defined?(WIN32OLE)
@obj = WIN32OLE.new('Word.Application')
rescue WIN32OLERuntimeError
@obj = nil
- if !$skipped
+ if !$skipped
$skipped = true
end
end
diff --git a/test/xmlrpc/test_datetime.rb b/test/xmlrpc/test_datetime.rb
index 528e0805fcd..0a84904f65a 100644
--- a/test/xmlrpc/test_datetime.rb
+++ b/test/xmlrpc/test_datetime.rb
@@ -67,10 +67,10 @@ class Test_DateTime < Test::Unit::TestCase
def test_set_exception
dt = createDateTime()
-
+
assert_raise(ArgumentError) { dt.year = 4.5 }
assert_nothing_raised(ArgumentError) { dt.year = -2000 }
-
+
assert_raise(ArgumentError) { dt.month = 0 }
assert_raise(ArgumentError) { dt.month = 13 }
assert_nothing_raised(ArgumentError) { dt.month = 7 }
@@ -99,7 +99,7 @@ class Test_DateTime < Test::Unit::TestCase
def test_to_a
y, m, d, h, mi, s = 1970, 3, 24, 12, 0, 5
dt = XMLRPC::DateTime.new(y, m, d, h, mi, s)
- a = dt.to_a
+ a = dt.to_a
assert_instance_of(Array, a)
assert_equal(6, a.size, "Returned array has wrong size")
@@ -115,8 +115,8 @@ class Test_DateTime < Test::Unit::TestCase
def test_to_time1
y, m, d, h, mi, s = 1970, 3, 24, 12, 0, 5
dt = XMLRPC::DateTime.new(y, m, d, h, mi, s)
- time = dt.to_time
-
+ time = dt.to_time
+
assert_not_nil(time)
assert_equal(y, time.year)
@@ -130,15 +130,15 @@ class Test_DateTime < Test::Unit::TestCase
def test_to_time2
dt = createDateTime()
dt.year = 1969
-
+
assert_nil(dt.to_time)
end
def test_to_date1
y, m, d, h, mi, s = 1970, 3, 24, 12, 0, 5
dt = XMLRPC::DateTime.new(y, m, d, h, mi, s)
- date = dt.to_date
-
+ date = dt.to_date
+
assert_equal(y, date.year)
assert_equal(m, date.month)
assert_equal(d, date.day)
@@ -147,7 +147,7 @@ class Test_DateTime < Test::Unit::TestCase
def test_to_date2
dt = createDateTime()
dt.year = 666
-
+
assert_equal(666, dt.to_date.year)
end
diff --git a/test/xmlrpc/test_features.rb b/test/xmlrpc/test_features.rb
index 377d539f267..0f867068ef7 100644
--- a/test/xmlrpc/test_features.rb
+++ b/test/xmlrpc/test_features.rb
@@ -29,7 +29,7 @@ class Test_Features < Test::Unit::TestCase
XMLRPC::XMLWriter.each_installed_writer do |writer|
c = XMLRPC::Create.new(writer)
- str = c.methodCall("test", *@params)
+ str = c.methodCall("test", *@params)
XMLRPC::XMLParser.each_installed_parser do |parser|
para = nil
diff --git a/test/xmlrpc/test_marshal.rb b/test/xmlrpc/test_marshal.rb
index 38bc8c646f4..267b43e2e22 100644
--- a/test/xmlrpc/test_marshal.rb
+++ b/test/xmlrpc/test_marshal.rb
@@ -42,7 +42,7 @@ class Test_Marshal < Test::Unit::TestCase
end
def test_parser_values
- v1 = [
+ v1 = [
1, -7778, # integers
1.0, 0.0, -333.0, 2343434343.0, # floats
false, true, true, false, # booleans
@@ -72,9 +72,9 @@ class Test_Marshal < Test::Unit::TestCase
assert_equal( v3_exp, m.load_response(m.dump_response(v3)) )
pers = m.load_response(m.dump_response(person))
-
+
assert( pers.is_a?(Person) )
- assert( person.name == pers.name )
+ assert( person.name == pers.name )
end
# missing, Date, Time, DateTime
diff --git a/test/xmlrpc/test_parser.rb b/test/xmlrpc/test_parser.rb
index 44ca1f88b74..1c50eaed46e 100644
--- a/test/xmlrpc/test_parser.rb
+++ b/test/xmlrpc/test_parser.rb
@@ -7,16 +7,16 @@ module GenericParserTest
def datafile(base)
File.join(File.dirname(__FILE__), "data", base)
end
-
+
def load_data(name)
[File.read(datafile(name) + ".xml"), YAML.load(File.read(datafile(name) + ".expected"))]
end
def setup
@xml1, @expected1 = load_data('xml1')
- @xml2, @expected2 = load_data('bug_covert')
- @xml3, @expected3 = load_data('bug_bool')
- @xml4, @expected4 = load_data('value')
+ @xml2, @expected2 = load_data('bug_covert')
+ @xml3, @expected3 = load_data('bug_bool')
+ @xml4, @expected4 = load_data('value')
@cdata_xml, @cdata_expected = load_data('bug_cdata')
@@ -27,7 +27,7 @@ module GenericParserTest
end
# test parseMethodResponse --------------------------------------------------
-
+
def test_parseMethodResponse1
assert_equal(@expected1, @p.parseMethodResponse(@xml1))
end
@@ -67,7 +67,7 @@ module GenericParserTest
end
end
-# create test class for each installed parser
+# create test class for each installed parser
XMLRPC::XMLParser.each_installed_parser do |parser|
klass = parser.class
name = klass.to_s.split("::").last
diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb
index 38cfe2f8967..47fa5487c3c 100644
--- a/test/xmlrpc/test_webrick_server.rb
+++ b/test/xmlrpc/test_webrick_server.rb
@@ -18,9 +18,9 @@ class Test_Webrick < Test::Unit::TestCase
if b == 0
raise XMLRPC::FaultException.new(1, "division by zero")
else
- a / b
+ a / b
end
- end
+ end
s.set_default_handler do |name, *args|
raise XMLRPC::FaultException.new(-99, "Method #{name} missing" +
@@ -34,13 +34,13 @@ class Test_Webrick < Test::Unit::TestCase
def setup_http_server(port, use_ssl)
option = {
- :Port => port,
+ :Port => port,
:SSLEnable => use_ssl,
}
if use_ssl
require 'webrick/https'
option.update(
- :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
+ :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
:SSLCertName => []
)
end
diff --git a/test/xmlrpc/webrick_testing.rb b/test/xmlrpc/webrick_testing.rb
index 2ca52bad22b..05c334045ee 100644
--- a/test/xmlrpc/webrick_testing.rb
+++ b/test/xmlrpc/webrick_testing.rb
@@ -5,19 +5,19 @@ module WEBrick_Testing
def initialize() super(self) end
def <<(*args) end
end
-
+
def start_server(config={})
raise "already started" if @__server
@__started = false
@__server_thread = Thread.new {
@__server = WEBrick::HTTPServer.new(
- {
+ {
:Logger => DummyLog.new,
:AccessLog => [],
:StartCallback => proc { @__started = true }
}.update(config))
- yield @__server
+ yield @__server
@__server.start
@__started = false
}
diff --git a/test/yaml/test_yaml.rb b/test/yaml/test_yaml.rb
index 837f34722f9..4f612ebaefe 100644
--- a/test/yaml/test_yaml.rb
+++ b/test/yaml/test_yaml.rb
@@ -21,7 +21,7 @@ class YAML_Unit_Tests < Test::Unit::TestCase
assert_equal( obj, YAML::load( obj.to_yaml ) )
assert_equal( obj, YAML::parse( obj.to_yaml ).transform )
assert_equal( obj, YAML::load(
- obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true )
+ obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true )
) )
end
@@ -133,7 +133,7 @@ EOY
def test_spec_simple_map_with_nested_sequences
# Simple mapping with nested sequences
assert_to_yaml(
- { 'american' =>
+ { 'american' =>
[ 'Boston Red Sox', 'Detroit Tigers', 'New York Yankees' ],
'national' =>
[ 'New York Mets', 'Chicago Cubs', 'Atlanta Braves' ] }, <<EOY
@@ -171,7 +171,7 @@ EOY
def test_spec_sequence_of_sequences
# Simple sequence with inline sequences
assert_parse_only(
- [
+ [
[ 'name', 'hr', 'avg' ],
[ 'Mark McGwire', 65, 0.278 ],
[ 'Sammy Sosa', 63, 0.288 ]
@@ -241,11 +241,11 @@ EOY
assert_to_yaml(
[{"arrival"=>"EDI", "departure"=>"LAX", "fareref"=>"DOGMA", "currency"=>"GBP"}, {"arrival"=>"MEL", "departure"=>"SYD", "fareref"=>"MADF", "currency"=>"AUD"}, {"arrival"=>"MCO", "departure"=>"JFK", "fareref"=>"DFSF", "currency"=>"USD"}], <<EOY
- -
+ -
&F fareref: DOGMA
&C currency: GBP
&D departure: LAX
- &A arrival: EDI
+ &A arrival: EDI
- { *F: MADF, *C: AUD, *D: SYD, *A: MEL }
- { *F: DFSF, *C: USD, *D: JFK, *A: MCO }
EOY
@@ -285,12 +285,12 @@ EOY
? # PLAY SCHEDULE
- Detroit Tigers
- Chicago Cubs
-:
+:
- 2001-07-23
? [ New York Yankees,
Atlanta Braves ]
-: [ 2001-07-02, 2001-08-12,
+: [ 2001-07-02, 2001-08-12,
2001-08-14 ]
EOY
)
@@ -352,9 +352,9 @@ EOY
def test_spec_sequence_shortcuts
# Sequence shortcuts combined
- assert_parse_only(
+ assert_parse_only(
[
- [
+ [
[ [ 'one' ] ],
[ 'two', 'three' ],
{ 'four' => nil },
@@ -440,7 +440,7 @@ quoted: "\\
scalar.\\n"
EOY
)
- end
+ end
def test_spec_type_int
assert_parse_only(
@@ -678,7 +678,7 @@ EOY
def test_spec_force_implicit
# Force implicit
- assert_parse_only(
+ assert_parse_only(
{ 'integer' => 12, 'also int' => 12, 'string' => '12' }, <<EOY
integer: 12
also int: ! "12"
@@ -705,7 +705,7 @@ EOY
assert_equal( doc['pool'].type_id, 'x-private:ball' )
assert_equal( doc['pool'].transform.value, { 'number' => 8, 'color' => 'black' } )
when 1
- assert_equal( doc['bearing'].type_id, 'x-private:ball' )
+ assert_equal( doc['bearing'].type_id, 'x-private:ball' )
assert_equal( doc['bearing'].transform.value, { 'material' => 'steel' } )
end
doc_ct += 1
@@ -734,7 +734,7 @@ EOY
def test_spec_override_anchor
# Override anchor
a001 = "The alias node below is a repeated use of this value.\n"
- assert_parse_only(
+ assert_parse_only(
{ 'anchor' => 'This scalar has an anchor.', 'override' => a001, 'alias' => a001 }, <<EOY
anchor : &A001 This scalar has an anchor.
override : &A001 >
@@ -758,7 +758,7 @@ picture: !binary |
Pz7Y6OjuDg4J+fn5OTk6enp
56enmleECcgggoBADs=
-hmm: !somewhere.com,2002/type |
+hmm: !somewhere.com,2002/type |
family above is short for
http://somewhere.com/type
EOY
@@ -843,7 +843,7 @@ EOY
def test_spec_builtin_map
# Assortment of mappings
- assert_parse_only(
+ assert_parse_only(
{ 'empty' => {}, 'in-line' => { 'one' => 1, 'two' => 2 },
'spanning' => { 'one' => 1, 'two' => 2 },
'nested' => { 'first' => 'First entry', 'second' =>
@@ -945,9 +945,9 @@ EOY
str1 = "This has one newline.\n"
str2 = "This has no newline."
str3 = "This has two newlines.\n\n"
- assert_parse_only(
- { 'clipped' => str1, 'same as "clipped" above' => str1,
- 'stripped' => str2, 'same as "stripped" above' => str2,
+ assert_parse_only(
+ { 'clipped' => str1, 'same as "clipped" above' => str1,
+ 'stripped' => str2, 'same as "stripped" above' => str2,
'kept' => str3, 'same as "kept" above' => str3 }, <<EOY
clipped: |
This has one newline.
@@ -967,7 +967,7 @@ same as "kept" above: "This has two newlines.\\n\\n"
EOY
)
end
-
+
def test_spec_span_single_quote
assert_parse_only( {"third"=>"a single quote ' must be escaped.", "second"=>"! : \\ etc. can be used freely.", "is same as"=>"this contains six spaces\nand one line break", "empty"=>"", "span"=>"this contains six spaces\nand one line break"}, <<EOY
empty: ''
@@ -975,7 +975,7 @@ second: '! : \\ etc. can be used freely.'
third: 'a single quote '' must be escaped.'
span: 'this contains
six spaces
-
+
and one
line break'
is same as: "this contains six spaces\\nand one line break"
@@ -1000,9 +1000,9 @@ EOY
def test_spec_builtin_time
# Time
assert_parse_only(
- { "space separated" => mktime( 2001, 12, 14, 21, 59, 43, ".10", "-05:00" ),
- "canonical" => mktime( 2001, 12, 15, 2, 59, 43, ".10" ),
- "date (noon UTC)" => Date.new( 2002, 12, 14),
+ { "space separated" => mktime( 2001, 12, 14, 21, 59, 43, ".10", "-05:00" ),
+ "canonical" => mktime( 2001, 12, 15, 2, 59, 43, ".10" ),
+ "date (noon UTC)" => Date.new( 2002, 12, 14),
"valid iso8601" => mktime( 2001, 12, 14, 21, 59, 43, ".10", "-05:00" ) }, <<EOY
canonical: 2001-12-15T02:59:43.1Z
valid iso8601: 2001-12-14t21:59:43.10-05:00
@@ -1015,7 +1015,7 @@ EOY
def test_spec_builtin_binary
arrow_gif = "GIF89a\f\000\f\000\204\000\000\377\377\367\365\365\356\351\351\345fff\000\000\000\347\347\347^^^\363\363\355\216\216\216\340\340\340\237\237\237\223\223\223\247\247\247\236\236\236iiiccc\243\243\243\204\204\204\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371\377\376\371!\376\016Made with GIMP\000,\000\000\000\000\f\000\f\000\000\005, \216\2010\236\343@\024\350i\020\304\321\212\010\034\317\200M$z\357\3770\205p\270\2601f\r\e\316\001\303\001\036\020' \202\n\001\000;"
assert_parse_only(
- { 'canonical' => arrow_gif, 'base64' => arrow_gif,
+ { 'canonical' => arrow_gif, 'base64' => arrow_gif,
'description' => "The binary value above is a tiny arrow encoded as a gif image.\n" }, <<EOY
canonical: !binary "\\
R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOf\\
@@ -1041,7 +1041,7 @@ EOY
end
def test_ruby_regexp
# Test Ruby regular expressions
- assert_to_yaml(
+ assert_to_yaml(
{ 'simple' => /a.b/, 'complex' => %r'\A"((?:[^"]|\")+)"',
'case-insensitive' => /George McFly/i }, <<EOY
case-insensitive: !ruby/regexp "/George McFly/i"
@@ -1078,8 +1078,8 @@ EOY
book_struct = Struct::new( "BookStruct", :author, :title, :year, :isbn )
assert_to_yaml(
[ book_struct.new( "Yukihiro Matsumoto", "Ruby in a Nutshell", 2002, "0-596-00214-9" ),
- book_struct.new( [ 'Dave Thomas', 'Andy Hunt' ], "The Pickaxe", 2002,
- book_struct.new( "This should be the ISBN", "but I have another struct here", 2002, "None" )
+ book_struct.new( [ 'Dave Thomas', 'Andy Hunt' ], "The Pickaxe", 2002,
+ book_struct.new( "This should be the ISBN", "but I have another struct here", 2002, "None" )
) ], <<EOY
- !ruby/struct:BookStruct
:author: Yukihiro Matsumoto
@@ -1109,7 +1109,7 @@ EOY
def test_ruby_rational
assert_to_yaml( Rational(1, 2), <<EOY )
---- !ruby/object:Rational
+--- !ruby/object:Rational
numerator: 1
denominator: 2
EOY
@@ -1121,7 +1121,7 @@ EOY
def test_ruby_complex
assert_to_yaml( Complex(3, 4), <<EOY )
---- !ruby/object:Complex
+--- !ruby/object:Complex
image: 4
real: 3
EOY
@@ -1143,7 +1143,7 @@ EOY
#
def test_document
y = YAML::Stream.new( :Indent => 2, :UseVersion => 0 )
- y.add(
+ y.add(
{ 'hi' => 'hello', 'map' =>
{ 'good' => 'two' },
'time' => Time.now,
diff --git a/test/yaml/test_yamlstore.rb b/test/yaml/test_yamlstore.rb
index 7a3d90469eb..69302095e5d 100644
--- a/test/yaml/test_yamlstore.rb
+++ b/test/yaml/test_yamlstore.rb
@@ -17,14 +17,14 @@ class YAMLStoreTest < Test::Unit::TestCase
assert_nil @yamlstore[:bar]
end
end
-
+
def test_opening_new_file_in_readwrite_mode_should_result_in_empty_values
@yamlstore.transaction do
assert_nil @yamlstore[:foo]
assert_nil @yamlstore[:bar]
end
end
-
+
def test_data_should_be_loaded_correctly_when_in_readonly_mode
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@@ -33,7 +33,7 @@ class YAMLStoreTest < Test::Unit::TestCase
assert_equal "bar", @yamlstore[:foo]
end
end
-
+
def test_data_should_be_loaded_correctly_when_in_readwrite_mode
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@@ -42,7 +42,7 @@ class YAMLStoreTest < Test::Unit::TestCase
assert_equal "bar", @yamlstore[:foo]
end
end
-
+
def test_changes_after_commit_are_discarded
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@@ -53,7 +53,7 @@ class YAMLStoreTest < Test::Unit::TestCase
assert_equal "bar", @yamlstore[:foo]
end
end
-
+
def test_changes_are_not_written_on_abort
@yamlstore.transaction do
@yamlstore[:foo] = "bar"
@@ -63,7 +63,7 @@ class YAMLStoreTest < Test::Unit::TestCase
assert_nil @yamlstore[:foo]
end
end
-
+
def test_writing_inside_readonly_transaction_raises_error
assert_raise(PStore::Error) do
@yamlstore.transaction(true) do