summaryrefslogtreecommitdiff
path: root/test/cgi/test_cgi_core.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 01:19:18 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-09 01:19:18 +0000
commit556f8054938060c2021a49b60f44fd6b679e446e (patch)
tree2cbeae130691fcb9878c4cab6db6f108c13b1d5b /test/cgi/test_cgi_core.rb
parent8a1463bebaa9541d8b7a05cddb77d155704a067e (diff)
* test/cgi/test_cgi_core.rb: removed obsoleted condition for Ruby 1.8.
* test/cgi/test_cgi_header.rb: ditto. * test/cgi/test_cgi_multipart.rb: ditto. * test/cgi/test_cgi_tag_helper.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/cgi/test_cgi_core.rb')
-rw-r--r--test/cgi/test_cgi_core.rb65
1 files changed, 2 insertions, 63 deletions
diff --git a/test/cgi/test_cgi_core.rb b/test/cgi/test_cgi_core.rb
index 123caf7acda..274d088f0f6 100644
--- a/test/cgi/test_cgi_core.rb
+++ b/test/cgi/test_cgi_core.rb
@@ -31,7 +31,7 @@ class CGICoreTest < Test::Unit::TestCase
}
ENV.update(@environ)
cgi = CGI.new
- assert_equal(["a","b","c","d"],cgi.keys.sort) if RUBY_VERSION>="1.9"
+ assert_equal(["a","b","c","d"],cgi.keys.sort)
assert_equal("",cgi["d"])
end
@@ -48,27 +48,6 @@ class CGICoreTest < Test::Unit::TestCase
## cgi[]
assert_equal('123', cgi['id'])
assert_equal('@h =~ /^$/', cgi['str'])
- ## cgi[][], cgi[].first, cgi[].to_ary (obsolete 1.9)
- if RUBY_VERSION<"1.9"
- $stderr = StringIO.new
- begin
- assert_equal('123', cgi['id'][0])
- assert_equal('456', cgi['id'][1])
- assert_equal('', cgi['id'][2])
- assert_nil(cgi['id'][3])
- assert_equal('@h =~ /^$/', cgi['str'][0])
- assert_nil(cgi['str'][1])
- assert_equal('123', cgi['id'].first)
- assert_equal('123', cgi['id'].last) # should be '' ?
- id1, id2, id3 = cgi['id']
- assert_equal(['123', '456', ''], [id1, id2, id3])
- str1, = cgi['str']
- assert_equal('@h =~ /^$/', str1)
- assert_not_same(str1, cgi['str']) # necessary?
- ensure
- $stderr = STDERR
- end
- end
## cgi.params
assert_equal(['123', '456', ''], cgi.params['id'])
assert_equal(['@h =~ /^$/'], cgi.params['str'])
@@ -199,48 +178,8 @@ class CGICoreTest < Test::Unit::TestCase
}
ENV.update(@environ)
cgi = CGI.new
- ## jis, euc, sjis string
- jis_str = "\e$B8+$m!\"?M$,%4%_$N$h$&$@\e(B"
+ ## euc string
euc_str = "\270\253\244\355\241\242\277\315\244\254\245\264\245\337\244\316\244\350\244\246\244\300"
- sjis_str = "\214\251\202\353\201A\220l\202\252\203S\203~\202\314\202\346\202\244\202\276"
- if RUBY_VERSION<"1.9"
- ## iso-2022-jp
- options = { 'charset'=>'iso-2022-jp' }
- $stdout = StringIO.new
- cgi.out(options) { euc_str }
- assert_equal('ja', options['language'])
- actual = $stdout.string
- expected = "Content-Type: text/html; charset=iso-2022-jp\r\n" +
- "Content-Length: 28\r\n" +
- "Content-Language: ja\r\n" +
- "\r\n" +
- jis_str
- assert_equal(expected,actual)
- ## euc-jp
- options = { 'charset'=>'EUC-JP' }
- $stdout = StringIO.new
- cgi.out(options) { euc_str }
- assert_equal('ja', options['language'])
- actual = $stdout.string
- expected = "Content-Type: text/html; charset=EUC-JP\r\n" +
- "Content-Length: 22\r\n" +
- "Content-Language: ja\r\n" +
- "\r\n" +
- euc_str
- assert_equal(expected, actual)
- ## shift_jis
- options = { 'charset'=>'Shift_JIS' }
- $stdout = StringIO.new
- cgi.out(options) { euc_str }
- assert_equal('ja', options['language'])
- actual = $stdout.string
- expected = "Content-Type: text/html; charset=Shift_JIS\r\n" +
- "Content-Length: 22\r\n" +
- "Content-Language: ja\r\n" +
- "\r\n" +
- sjis_str
- assert_equal(expected, actual)
- end
## utf8 (not converted)
options = { 'charset'=>'utf8' }
$stdout = StringIO.new