[Sass] Make script_test use values of the proper type for script environments.

This commit is contained in:
Nathan Weizenbaum 2009-03-24 00:56:55 -07:00
parent 73ea6dd6a9
commit 0bdf726c31
1 changed files with 8 additions and 2 deletions

View File

@ -110,12 +110,12 @@ WARN
private
def resolve(str, opts = {}, environment = {})
def resolve(str, opts = {}, environment = env)
munge_filename opts
eval(str, opts, environment).to_s
end
def eval(str, opts = {}, environment = {})
def eval(str, opts = {}, environment = env)
munge_filename opts
Sass::Script.parse(str, opts[:line] || 1,
opts[:offset] || 0, opts[:filename]).perform(environment)
@ -141,6 +141,12 @@ WARN
$stderr = the_real_stderr
end
def env(hash = {})
env = Sass::Environment.new
hash.each {|k, v| env.set_var(k, v)}
env
end
def test_number_printing
assert_equal "1", eval("1")
assert_equal "1", eval("1.0")