test/sass/engine_test.rb in sass-3.2.0.alpha.278 vs test/sass/engine_test.rb in sass-3.2.0.alpha.291
- old
+ new
@@ -91,11 +91,11 @@
"=a($foo bar)" => 'Invalid CSS after "($foo ": expected ")", was "bar)"',
"=foo\n bar: baz\n+foo" => ["Properties are only allowed within rules, directives, mixin includes, or other properties.", 2],
"a-\#{$b\n c: d" => ['Invalid CSS after "a-#{$b": expected "}", was ""', 1],
"=a($b: 1, $c)" => "Required argument $c must come before any optional arguments.",
"=a($b: 1)\n a: $b\ndiv\n +a(1,2)" => "Mixin a takes 1 argument but 2 were passed.",
- "=a($b: 1)\n a: $b\ndiv\n +a(1,$c: 3)" => "Mixin a doesn't have an argument named $c",
+ "=a($b: 1)\n a: $b\ndiv\n +a(1,$c: 3)" => "Mixin a doesn't have an argument named $c.",
"=a($b)\n a: $b\ndiv\n +a" => "Mixin a is missing argument $b.",
"@function foo()\n 1 + 2" => "Functions can only contain variable declarations and control directives.",
"@function foo()\n foo: bar" => "Functions can only contain variable declarations and control directives.",
"@function foo()\n foo: bar\n @return 3" => ["Functions can only contain variable declarations and control directives.", 2],
"@function foo\n @return 1" => ['Invalid CSS after "": expected "(", was ""', 1],
@@ -103,14 +103,14 @@
"@function foo(b)\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was "b)"', 1],
"@function foo(,)\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was ",)"', 1],
"@function foo($)\n @return 1" => ['Invalid CSS after "(": expected variable (e.g. $foo), was "$)"', 1],
"@function foo()\n @return" => 'Invalid @return: expected expression.',
"@function foo()\n @return 1\n $var: val" => 'Illegal nesting: Nothing may be nested beneath return directives.',
- "@function foo($a)\n @return 1\na\n b: foo()" => 'Function foo is missing argument $a',
- "@function foo()\n @return 1\na\n b: foo(2)" => 'Wrong number of arguments (1 for 0) for `foo\'',
- "@function foo()\n @return 1\na\n b: foo($a: 1)" => "Function foo doesn't have an argument named $a",
- "@function foo()\n @return 1\na\n b: foo($a: 1, $b: 2)" => "Function foo doesn't have the following arguments: $a, $b",
+ "@function foo($a)\n @return 1\na\n b: foo()" => 'Function foo is missing argument $a.',
+ "@function foo()\n @return 1\na\n b: foo(2)" => 'Function foo takes 0 arguments but 1 was passed.',
+ "@function foo()\n @return 1\na\n b: foo($a: 1)" => "Function foo doesn't have an argument named $a.",
+ "@function foo()\n @return 1\na\n b: foo($a: 1, $b: 2)" => "Function foo doesn't have the following arguments: $a, $b.",
"@return 1" => '@return may only be used within a function.',
"@if true\n @return 1" => '@return may only be used within a function.',
"@mixin foo\n @return 1\n@include foo" => ['@return may only be used within a function.', 2],
"@else\n a\n b: c" => ["@else must come after @if.", 1],
"@if false\n@else foo" => "Invalid else directive '@else foo': expected 'if <expr>'.",
@@ -120,11 +120,11 @@
"c\n d: $b-foo" => 'Undefined variable: "$b-foo".',
"c\n d: $b_foo" => 'Undefined variable: "$b_foo".',
'@for $a from "foo" to 1' => '"foo" is not an integer.',
'@for $a from 1 to "2"' => '"2" is not an integer.',
'@for $a from 1 to "foo"' => '"foo" is not an integer.',
- '@for $a from 1 to 1.232323' => '1.232 is not an integer.',
+ '@for $a from 1 to 1.232323' => '1.23232 is not an integer.',
'@for $a from 1px to 3em' => "Incompatible units: 'em' and 'px'.",
'@if' => "Invalid if directive '@if': expected expression.",
'@while' => "Invalid while directive '@while': expected expression.",
'@debug' => "Invalid debug directive '@debug': expected expression.",
%Q{@debug "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath debug directives.",
@@ -1292,11 +1292,11 @@
bar
a: plus($var2: bar)
SASS
flunk("Expected exception")
rescue Sass::SyntaxError => e
- assert_equal("Function plus is missing argument $var1", e.message)
+ assert_equal("Function plus is missing argument $var1.", e.message)
end
def test_function_with_extra_argument
render(<<SASS)
@function plus($var1, $var2)
@@ -1305,11 +1305,11 @@
bar
a: plus($var1: foo, $var2: bar, $var3: baz)
SASS
flunk("Expected exception")
rescue Sass::SyntaxError => e
- assert_equal("Function plus doesn't have an argument named $var3", e.message)
+ assert_equal("Function plus doesn't have an argument named $var3.", e.message)
end
def test_function_with_positional_and_keyword_argument
render(<<SASS)
@function plus($var1, $var2)
@@ -1318,11 +1318,11 @@
bar
a: plus(foo, bar, $var2: baz)
SASS
flunk("Expected exception")
rescue Sass::SyntaxError => e
- assert_equal("Function plus was passed argument $var2 both by position and by name", e.message)
+ assert_equal("Function plus was passed argument $var2 both by position and by name.", e.message)
end
def test_function_with_keyword_before_positional_argument
render(<<SASS)
@function plus($var1, $var2)
@@ -1331,11 +1331,11 @@
bar
a: plus($var2: foo, bar)
SASS
flunk("Expected exception")
rescue Sass::SyntaxError => e
- assert_equal("Positional arguments must come before keyword arguments", e.message)
+ assert_equal("Positional arguments must come before keyword arguments.", e.message)
end
def test_function_with_if
assert_equal(<<CSS, render(<<SASS))
bar {
@@ -1757,11 +1757,11 @@
SASS
end
def test_loud_comment_is_evaluated
assert_equal <<CSS, render(<<SASS)
-/* Hue: 327.216deg */
+/* Hue: 327.21649deg */
CSS
/*!
Hue: \#{hue(#f836a0)}
SASS
end
@@ -2870,15 +2870,17 @@
assert_equal original_filename, engine.options[:original_filename]
assert_equal original_filename, importer.engine("imported").options[:original_filename]
end
def test_deprecated_PRECISION
- assert_warning(<<END) {assert_equal 1000.0, Sass::Script::Number::PRECISION}
+ assert_warning(<<END) {assert_equal 100_000.0, Sass::Script::Number::PRECISION}
Sass::Script::Number::PRECISION is deprecated and will be removed in a future release. Use Sass::Script::Number.precision_factor instead.
END
end
+
def test_changing_precision
+ old_precision = Sass::Script::Number.precision
begin
Sass::Script::Number.precision = 8
assert_equal <<CSS, render(<<SASS)
div {
maximum: 1.00000001;
@@ -2887,10 +2889,10 @@
div
maximum : 1.00000001
too-much: 1.000000001
SASS
ensure
- Sass::Script::Number.precision = 3
+ Sass::Script::Number.precision = old_precision
end
end
def test_content
assert_equal <<CSS, render(<<SASS)