diff options
author | xibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-08 06:56:17 +0000 |
---|---|---|
committer | xibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-08 06:56:17 +0000 |
commit | edb68694b8c2a36704257470631792dad498bf87 (patch) | |
tree | 4a5b480250a0c2d9a6e41181205bb18241d52d72 /test/cgi | |
parent | f822c523fbb639275e42fda3403e1495733f00ff (diff) | |
download | ruby-edb68694b8c2a36704257470631792dad498bf87.tar.gz |
* test/cgi/test_cgi_core.rb: Add test for CGI#header.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/cgi')
-rw-r--r-- | test/cgi/test_cgi_core.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/cgi/test_cgi_core.rb b/test/cgi/test_cgi_core.rb index 08a8d383de..123caf7acd 100644 --- a/test/cgi/test_cgi_core.rb +++ b/test/cgi/test_cgi_core.rb @@ -329,7 +329,7 @@ class CGICoreTest < Test::Unit::TestCase end - def test_cgi_core_htmltype + def test_cgi_core_htmltype_header @environ = { 'REQUEST_METHOD' => 'GET', } @@ -337,26 +337,32 @@ class CGICoreTest < Test::Unit::TestCase ## no htmltype cgi = CGI.new assert_raise(NoMethodError) do cgi.doctype end + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) ## html3 cgi = CGI.new('html3') expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">' assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) ## html4 cgi = CGI.new('html4') expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) ## html4 transitional cgi = CGI.new('html4Tr') expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">' assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) ## html4 frameset cgi = CGI.new('html4Fr') expected = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">' assert_equal(expected, cgi.doctype) + assert_equal("Content-Type: text/html\r\n\r\n",cgi.header) ## html5 cgi = CGI.new('html5') expected = '<!DOCTYPE HTML>' assert_equal(expected, cgi.doctype) + assert_match(/^<HEADER><\/HEADER>$/i,cgi.header) end |