From 6a9570be688cc19e60ea7713ceb4474a93bc6b72 Mon Sep 17 00:00:00 2001 From: Nathan Weizenbaum Date: Tue, 28 Sep 2010 20:06:47 -0700 Subject: [PATCH] [Haml] Clean up the encoding tests. --- test/haml/engine_test.rb | 203 ++++++--------------------------------- 1 file changed, 28 insertions(+), 175 deletions(-) diff --git a/test/haml/engine_test.rb b/test/haml/engine_test.rb index 0eab5732..58076b16 100755 --- a/test/haml/engine_test.rb +++ b/test/haml/engine_test.rb @@ -1701,15 +1701,23 @@ HTML HAML end - def test_different_coding_comment_than_encoding - assert_renders_encoded(<bâr

-

föö

-HTML --# coding: ibm866 -%p bâr -%p föö -HAML + def test_coding_comments + assert_valid_encoding_comment("-# coding: ibm866") + assert_valid_encoding_comment("-# CodINg: IbM866") + assert_valid_encoding_comment("-#coding:ibm866") + assert_valid_encoding_comment("-# CodINg= ibm866") + assert_valid_encoding_comment("-# foo BAR FAOJcoding: ibm866") + assert_valid_encoding_comment("-# coding: ibm866 ASFJ (&(&#!$") + assert_valid_encoding_comment("-# -*- coding: ibm866") + assert_valid_encoding_comment("-# coding: ibm866 -*- coding: blah") + assert_valid_encoding_comment("-# -*- coding: ibm866 -*-") + assert_valid_encoding_comment("-# -*- encoding: ibm866 -*-") + assert_valid_encoding_comment('-# -*- coding: "ibm866" -*-') + assert_valid_encoding_comment("-#-*-coding:ibm866-*-") + assert_valid_encoding_comment("-#-*-coding:ibm866-*-") + assert_valid_encoding_comment("-# -*- foo: bar; coding: ibm866; baz: bang -*-") + assert_valid_encoding_comment("-# foo bar coding: baz -*- coding: ibm866 -*-") + assert_valid_encoding_comment("-# -*- coding: ibm866 -*- foo bar coding: baz") end def test_different_coding_than_system @@ -1719,176 +1727,21 @@ HTML %p тАЬ HAML end - - def test_case_insensitive_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# CodINg: IbM866 -%p bâr -%p föö -HAML - end - - def test_whitespace_insensitive_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --#coding:ibm866 -%p bâr -%p föö -HAML - end - - def test_equals_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# CodINg= ibm866 -%p bâr -%p föö -HAML - end - - def test_prefixed_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# foo BAR FAOJcoding: ibm866 -%p bâr -%p föö -HAML - end - - def test_suffixed_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# coding: ibm866 ASFJ (&(&#!$ -%p bâr -%p föö -HAML - end - - def test_emacs_prefixed_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# -*- coding: ibm866 -%p bâr -%p föö -HAML - end - - def test_emacs_suffixed_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# coding: ibm866 -*- coding: blah -%p bâr -%p föö -HAML - end - - def test_emacs_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# -*- coding: ibm866 -*- -%p bâr -%p föö -HAML - end - - def test_emacs_encoding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# -*- encoding: ibm866 -*- -%p bâr -%p föö -HAML - end - - def test_quoted_emacs_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# -*- coding: "ibm866" -*- -%p bâr -%p föö -HAML - end - - def test_whitespace_insensitive_emacs_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --#-*-coding:ibm866-*- -%p bâr -%p föö -HAML - end - - def test_whitespace_insensitive_emacs_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --#-*-coding:ibm866-*- -%p bâr -%p föö -HAML - end - - def test_one_of_several_emacs_comments - assert_renders_encoded(<bâr

-

föö

-HTML --# -*- foo: bar; coding: ibm866; baz: bang -*- -%p bâr -%p föö -HAML - end - - def test_prefixed_emacs_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# foo bar coding: baz -*- coding: ibm866 -*- -%p bâr -%p föö -HAML - end - - def test_suffixed_emacs_coding_comment - assert_renders_encoded(<bâr

-

föö

-HTML --# -*- coding: ibm866 -*- foo bar coding: baz -%p bâr -%p föö -HAML - end - end private + def assert_valid_encoding_comment(comment) + assert_renders_encoded(<bâr

+

föö

+HTML +#{comment} +%p bâr +%p föö +HAML + end + def assert_converts_template_properly engine = Haml::Engine.new(< "utf-8") %p bâr