test/sass/engine_test.rb in sass-3.4.24 vs test/sass/engine_test.rb in sass-3.4.25

- old
+ new

@@ -286,14 +286,14 @@ end def test_exception_line to_render = <<SASS rule - :prop val + prop: val // comment! - :broken + broken: SASS begin Sass::Engine.new(to_render).render rescue Sass::SyntaxError => err assert_equal(5, err.sass_line) @@ -303,14 +303,14 @@ end def test_exception_location to_render = <<SASS rule - :prop val + prop: val // comment! - :broken + broken: SASS begin Sass::Engine.new(to_render, :filename => FAKE_FILE_NAME, :line => (__LINE__-7)).render rescue Sass::SyntaxError => err assert_equal(FAKE_FILE_NAME, err.sass_filename) @@ -747,26 +747,26 @@ assert_equal("foo {\n bar: /baz/boom; }\n", render(%Q{foo\n bar: /baz/boom})) end def test_basic_multiline_selector assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n", - render("#foo #bar,\n#baz #boom\n :foo bar")) + render("#foo #bar,\n#baz #boom\n foo: bar")) assert_equal("#foo #bar,\n#foo #baz {\n foo: bar; }\n", - render("#foo\n #bar,\n #baz\n :foo bar")) + render("#foo\n #bar,\n #baz\n foo: bar")) assert_equal("#foo,\n#bar {\n foo: bar; }\n #foo #baz,\n #bar #baz {\n foo: bar; }\n", - render("#foo,\n#bar\n :foo bar\n #baz\n :foo bar")) + render("#foo,\n#bar\n foo: bar\n #baz\n foo: bar")) assert_equal("#foo #bar, #baz #boom { foo: bar; }\n", - render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compact)) + render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compact)) assert_equal("#foo #bar,#baz #boom{foo:bar}\n", - render("#foo #bar,\n#baz #boom\n :foo bar", :style => :compressed)) + render("#foo #bar,\n#baz #boom\n foo: bar", :style => :compressed)) assert_equal("#foo #bar,\n#baz #boom {\n foo: bar; }\n", - render("#foo #bar,,\n,#baz #boom,\n :foo bar")) + render("#foo #bar,,\n,#baz #boom,\n foo: bar")) assert_equal("#bip #bop {\n foo: bar; }\n", - render("#bip #bop,, ,\n :foo bar")) + render("#bip #bop,, ,\n foo: bar")) end def test_complex_multiline_selector renders_correctly "multiline" end @@ -781,11 +781,11 @@ else assert(false, "SyntaxError not raised for :property_syntax => :old") end begin - render("a\n :b c", :property_syntax => :new) + silence_warnings {render("a\n :b c", :property_syntax => :new)} assert_equal(2, e.sass_line) rescue Sass::SyntaxError => e assert_equal("Illegal property syntax: can't use old syntax when :property_syntax => :new is set.", e.message) else @@ -804,57 +804,57 @@ end def test_directive assert_equal("@a b;\n", render("@a b")) - assert_equal("@a {\n b: c; }\n", render("@a\n :b c")) - assert_equal("@a { b: c; }\n", render("@a\n :b c", :style => :compact)) - assert_equal("@a {\n b: c;\n}\n", render("@a\n :b c", :style => :expanded)) - assert_equal("@a{b:c}\n", render("@a\n :b c", :style => :compressed)) + assert_equal("@a {\n b: c; }\n", render("@a\n b: c")) + assert_equal("@a { b: c; }\n", render("@a\n b: c", :style => :compact)) + assert_equal("@a {\n b: c;\n}\n", render("@a\n b: c", :style => :expanded)) + assert_equal("@a{b:c}\n", render("@a\n b: c", :style => :compressed)) assert_equal("@a {\n b: c;\n d: e; }\n", - render("@a\n :b c\n :d e")) + render("@a\n b: c\n d: e")) assert_equal("@a { b: c; d: e; }\n", - render("@a\n :b c\n :d e", :style => :compact)) + render("@a\n b: c\n d: e", :style => :compact)) assert_equal("@a {\n b: c;\n d: e;\n}\n", - render("@a\n :b c\n :d e", :style => :expanded)) + render("@a\n b: c\n d: e", :style => :expanded)) assert_equal("@a{b:c;d:e}\n", - render("@a\n :b c\n :d e", :style => :compressed)) + render("@a\n b: c\n d: e", :style => :compressed)) assert_equal("@a {\n #b {\n c: d; } }\n", - render("@a\n #b\n :c d")) + render("@a\n #b\n c: d")) assert_equal("@a { #b { c: d; } }\n", - render("@a\n #b\n :c d", :style => :compact)) + render("@a\n #b\n c: d", :style => :compact)) assert_equal("@a {\n #b {\n c: d;\n }\n}\n", - render("@a\n #b\n :c d", :style => :expanded)) + render("@a\n #b\n c: d", :style => :expanded)) assert_equal("@a{#b{c:d}}\n", - render("@a\n #b\n :c d", :style => :compressed)) + render("@a\n #b\n c: d", :style => :compressed)) assert_equal("@a {\n #b {\n a: b; }\n #b #c {\n d: e; } }\n", - render("@a\n #b\n :a b\n #c\n :d e")) + render("@a\n #b\n a: b\n #c\n d: e")) assert_equal("@a { #b { a: b; }\n #b #c { d: e; } }\n", - render("@a\n #b\n :a b\n #c\n :d e", :style => :compact)) + render("@a\n #b\n a: b\n #c\n d: e", :style => :compact)) assert_equal("@a {\n #b {\n a: b;\n }\n #b #c {\n d: e;\n }\n}\n", - render("@a\n #b\n :a b\n #c\n :d e", :style => :expanded)) + render("@a\n #b\n a: b\n #c\n d: e", :style => :expanded)) assert_equal("@a{#b{a:b}#b #c{d:e}}\n", - render("@a\n #b\n :a b\n #c\n :d e", :style => :compressed)) + render("@a\n #b\n a: b\n #c\n d: e", :style => :compressed)) assert_equal("@a {\n #foo,\n #bar {\n b: c; } }\n", - render("@a\n #foo, \n #bar\n :b c")) + render("@a\n #foo, \n #bar\n b: c")) assert_equal("@a { #foo, #bar { b: c; } }\n", - render("@a\n #foo, \n #bar\n :b c", :style => :compact)) + render("@a\n #foo, \n #bar\n b: c", :style => :compact)) assert_equal("@a {\n #foo,\n #bar {\n b: c;\n }\n}\n", - render("@a\n #foo, \n #bar\n :b c", :style => :expanded)) + render("@a\n #foo, \n #bar\n b: c", :style => :expanded)) assert_equal("@a{#foo,#bar{b:c}}\n", - render("@a\n #foo, \n #bar\n :b c", :style => :compressed)) + render("@a\n #foo, \n #bar\n b: c", :style => :compressed)) to_render = <<END @a - :b c + b: c #d - :e f - :g h + e: f + g: h END rendered = <<END @a { b: c; #d { e: f; } g: h; } @@ -1139,11 +1139,11 @@ black { color: #000; } CSS =foo($a: #FFF) - :color $a + color: $a white +foo black +foo(#000) SASS @@ -1163,13 +1163,13 @@ padding: 2px; margin: 3px; } CSS $a: 5px =foo($a, $b: 1px, $c: 3px + $b) - :color $a - :padding $b - :margin $c + color: $a + padding: $b + margin: $c one +foo(#fff) two +foo(#fff, 2px) three @@ -2596,33 +2596,33 @@ assert_equal(<<RESULT, render(<<SOURCE)) .box { border-style: solid; } RESULT .box - :border - //:color black - :style solid + border: + //color: black + style: solid SOURCE assert_equal(<<RESULT, render(<<SOURCE)) .box { - /* :color black */ + /* color: black */ border-style: solid; } RESULT .box - :border - /* :color black - :style solid + border: + /* color: black + style: solid SOURCE assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed)) .box{border-style:solid} RESULT .box - :border - /*:color black - :style solid + border: + /*color: black + style: solid SOURCE end def test_compressed_comment_beneath_directive assert_equal(<<RESULT, render(<<SOURCE, :style => :compressed)) @@ -3392,10 +3392,16 @@ end private def assert_hash_has(hash, expected) - expected.each {|k, v| assert_equal(v, hash[k])} + expected.each do |k, v| + if v.nil? + assert_nil(hash[k]) + else + assert_equal(v, hash[k]) + end + end end def assert_renders_encoded(css, sass) result = render(sass) assert_equal css.encoding, result.encoding