From d6859a7216fbe40f523fd80f85a06fa3e23070bb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 16 Dec 2007 23:53:45 +0000 Subject: Add tests for html_escape, and remove an unneeded backslash (closes #10511) [fxn] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8422 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/erb_util_test.rb | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 actionpack/test/template/erb_util_test.rb (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/erb_util_test.rb b/actionpack/test/template/erb_util_test.rb new file mode 100644 index 0000000000..3aff987b22 --- /dev/null +++ b/actionpack/test/template/erb_util_test.rb @@ -0,0 +1,56 @@ +require "#{File.dirname(__FILE__)}/../abstract_unit" + +class ErbUtilTest < Test::Unit::TestCase + include ERB::Util + + def test_amp + assert_equal '&', html_escape('&') + end + + def test_quot + assert_equal '"', html_escape('"') + end + + def test_lt + assert_equal '<', html_escape('<') + end + + def test_gt + assert_equal '>', html_escape('>') + end + + def test_rest_in_ascii + (0..127).to_a.map(&:chr).each do |chr| + next if %w(& " < >).include?(chr) + assert_equal chr, html_escape(chr) + end + end +end +require "#{File.dirname(__FILE__)}/../abstract_unit" + +class ErbUtilTest < Test::Unit::TestCase + include ERB::Util + + def test_amp + assert_equal '&', html_escape('&') + end + + def test_quot + assert_equal '"', html_escape('"') + end + + def test_lt + assert_equal '<', html_escape('<') + end + + def test_gt + assert_equal '>', html_escape('>') + end + + def test_rest_in_ascii + (0..127).to_a.map(&:chr).each do |chr| + next if %w(& " < >).include?(chr) + assert_equal chr, html_escape(chr) + end + end +end \ No newline at end of file -- cgit v1.2.3