test/sass/functions_test.rb in haml-edge-2.3.179 vs test/sass/functions_test.rb in haml-edge-2.3.180
- old
+ new
@@ -11,10 +11,14 @@
end
def user_defined
Sass::Script::String.new("I'm a user-defined string!")
end
+
+ def _preceding_underscore
+ Sass::Script::String.new("I'm another user-defined string!")
+ end
end
class SassFunctionTest < Test::Unit::TestCase
# Tests taken from:
# http://www.w3.org/Style/CSS/Test/CSS3/Color/20070927/html4/t040204-hsl-h-rotating-b.htm
@@ -463,11 +467,34 @@
def tets_complement_tests_types
assert_error_message("\"foo\" is not a color for `complement'", "complement(\"foo\")")
end
+ def test_unquote
+ assert_equal('foo', evaluate('unquote("foo")'))
+ assert_equal('foo', evaluate('unquote(foo)'))
+ end
+
+ def test_unquote_tests_type
+ assert_error_message("#ff0000 is not a string for `unquote'", "unquote(#f00)")
+ end
+
+ def test_quote
+ assert_equal('"foo"', evaluate('quote(foo)'))
+ assert_equal('"foo"', evaluate('quote("foo")'))
+ end
+
+ def test_quote_tests_type
+ assert_error_message("#ff0000 is not a string for `quote'", "quote(#f00)")
+ end
+
def test_user_defined_function
assert_equal("I'm a user-defined string!", evaluate("user_defined()"))
+ end
+
+ def test_user_defined_function_with_preceding_underscore
+ assert_equal("I'm another user-defined string!", evaluate("_preceding_underscore()"))
+ assert_equal("I'm another user-defined string!", evaluate("-preceding-underscore()"))
end
def test_options_on_new_literals_fails
assert_error_message(<<MSG, "call-options-on-new-literal()")
The #options attribute is not set on this Sass::Script::String.