public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Add line-number testing to Haml as well.
nex3 (author)
Thu Apr 24 13:47:59 -0700 2008
commit  22a22689e52fa6cb5ce67056ce5d98bb5d28a015
tree    94c7a119f78489f8b7a58bdb68678a5efd3d0010
parent  6f6562b119abf533b4f98511d46176264684d59f
...
2
3
4
 
 
 
 
5
6
7
...
20
21
22
23
 
24
25
26
...
333
334
335
336
 
 
 
 
337
338
339
...
2
3
4
5
6
7
8
9
10
11
...
24
25
26
 
27
28
29
30
...
337
338
339
 
340
341
342
343
344
345
346
0
@@ -2,6 +2,10 @@
0
 require File.dirname(__FILE__) + '/test_helper'
0
 
0
 class EngineTest < Test::Unit::TestCase
0
+ # A map of erroneous Sass documents to the error messages they should produce.
0
+ # The error messages may be arrays;
0
+ # if so, the second element should be the line number that should be reported for the error.
0
+ # If this isn't provided, the tests will assume the line number should be the last line of the document.
0
   EXCEPTION_MAP = {
0
     "!!!\n a" => "Illegal nesting: nesting within a header command is illegal.",
0
     "a\n b" => "Illegal nesting: nesting within plain text is illegal.",
0
@@ -20,7 +24,7 @@ END
0
     "%p\n a" => "1 space was used for indentation. Haml must be indented using two spaces.",
0
     "%p\n a" => "3 spaces were used for indentation. Haml must be indented using two spaces.",
0
     "%p\n a" => "4 spaces were used for indentation. Haml must be indented using two spaces.",
0
- ":a\n b" => 'Filter "a" is not defined.',
0
+ ":a\n b" => ['Filter "a" is not defined.', 1],
0
     ":a= b" => 'Invalid filter name ":a= b".',
0
     "." => "Illegal element: classes and ids must have values.",
0
     ".#" => "Illegal element: classes and ids must have values.",
0
@@ -333,7 +337,10 @@ END
0
       begin
0
         render(key)
0
       rescue Haml::Error => err
0
- assert_equal(value, err.message)
0
+ value = [value] unless value.is_a?(Array)
0
+
0
+ assert_equal(value.first, err.message, "Line: #{key}")
0
+ assert_equal(value[1] || key.split("\n").length, err.backtrace[0].gsub('(haml):', '').to_i, "Line: #{key}")
0
       else
0
         assert(false, "Haml::Error not raised for\n#{key}")
0
       end

Comments

    No one has commented yet.