1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

100% RCov (except for action_view_mods, of course).

git-svn-id: svn://hamptoncatlin.com/haml/trunk@265 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2006-12-25 00:17:02 +00:00
parent 8895413d4e
commit 3978a0d2df

View file

@ -5,10 +5,34 @@ require File.dirname(__FILE__) + '/../../lib/sass'
require 'sass/engine'
class SassEngineTest < Test::Unit::TestCase
EXCEPTION_MAP = {
"!a = 1 + " => "Syntax error:\n1 +",
"!a = 1 + 2 +" => "Syntax error:\n1 + 2 +",
"!a = #aaa - a" => "Undefined operation:\n#afafaf minus a",
"!a = #aaa / a" => "Undefined operation:\n#afafaf div a",
"!a = #aaa * a" => "Undefined operation:\n#afafaf times a",
"!a = #aaa % a" => "Undefined operation:\n#afafaf mod a",
"!a = 1 - a" => "Undefined operation:\n1 minus a",
"!a = 1 * a" => "Undefined operation:\n1 times a",
"!a = 1 / a" => "Undefined operation:\n1 div a",
"!a = 1 % a" => "Undefined operation:\n1 mod a",
}
def test_basic_render
renders_correctly "basic"
end
def test_exceptions
EXCEPTION_MAP.each do |key, value|
val_lines = value.split("\n")
begin
Sass::Engine.new(key).render
rescue RuntimeError => res_lines; end
val_lines.zip(res_lines.to_s.split("\n")) { |val, res| assert_equal(val, res) }
end
end
private
def renders_correctly(name)
sass_file = load_file(name, "sass")