Skip to content

Commit

Permalink
Fix some incorrect precision tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Aug 10, 2012
1 parent 80ec312 commit 6bc7c36
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions test/sass/engine_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class SassEngineTest < Test::Unit::TestCase
'@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.",
Expand Down Expand Up @@ -1759,7 +1759,7 @@ def test_loud_comment_in_compressed_mode

def test_loud_comment_is_evaluated
assert_equal <<CSS, render(<<SASS)
/* Hue: 327.216deg */
/* Hue: 327.21649deg */
CSS
/*!
Hue: \#{hue(#f836a0)}
Expand Down Expand Up @@ -2872,11 +2872,13 @@ def test_original_filename_set
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)
Expand All @@ -2889,7 +2891,7 @@ def test_changing_precision
too-much: 1.000000001
SASS
ensure
Sass::Script::Number.precision = 3
Sass::Script::Number.precision = old_precision
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/sass/results/script.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#times { num-num: 7; num-col: #7496b8; col-num: #092345; col-col: #243648; }

#div { num-num: 3.333; num-num2: 3.333; col-num: #092345; col-col: #0b0d0f; comp: 1px; }
#div { num-num: 3.33333; num-num2: 3.33333; col-num: #092345; col-col: #0b0d0f; comp: 1px; }

#mod { num-num: 2; col-col: #0f0e05; col-num: #020001; }

Expand Down
4 changes: 2 additions & 2 deletions test/sass/results/units.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
b {
foo: 5px;
bar: 24px;
baz: 66.667%;
baz: 66.66667%;
many-units: 32em;
mm: 15mm;
pc: 2pc;
pt: -72pt;
inches: 2in;
more-inches: 3.5in;
mixed: 2.042in; }
mixed: 2.04167in; }
2 changes: 1 addition & 1 deletion test/sass/script_conversion_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_number
assert_renders "12px"
assert_renders "12.45px"

assert_equal "12.346", render("12.345678901")
assert_equal "12.34568", render("12.345678901")
end

def test_string
Expand Down
2 changes: 1 addition & 1 deletion test/sass/script_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_rgba_number_math
end

def test_rgba_rounding
assert_equal "rgba(10, 1, 0, 0.123)", resolve("rgba(10.0, 1.23456789, 0.0, 0.1234567)")
assert_equal "rgba(10, 1, 0, 0.12346)", resolve("rgba(10.0, 1.23456789, 0.0, 0.1234567)")
end

def test_compressed_colors
Expand Down

0 comments on commit 6bc7c36

Please sign in to comment.