#!/usr/bin/env ruby require File.dirname(__FILE__) + '/test_helper' class ScssTest < Test::Unit::TestCase include ScssTestHelper ## One-Line Comments def test_one_line_comments assert_equal < e assert_equal < e assert_equal "Mixins may only be defined at the root of a document.", e.message assert_equal 2, e.sass_line end def test_imports_only_at_toplevel render < e assert_equal "Import directives may only be used at the root of a document.", e.message assert_equal 2, e.sass_line end def test_rules_beneath_properties render < e assert_equal 'Illegal nesting: Only properties may be nested beneath properties.', e.message assert_equal 3, e.sass_line end def test_uses_property_exception_with_star_hack render <; } SCSS assert(false, "Expected syntax error") rescue Sass::SyntaxError => e assert_equal 'Invalid CSS after " *bar:baz ": expected ";", was "; }"', e.message assert_equal 2, e.sass_line end def test_uses_property_exception_with_space_after_name render <; } SCSS assert(false, "Expected syntax error") rescue Sass::SyntaxError => e assert_equal 'Invalid CSS after " bar: baz ": expected ";", was "; }"', e.message assert_equal 2, e.sass_line end def test_uses_property_exception_with_non_identifier_after_name render <; } SCSS assert(false, "Expected syntax error") rescue Sass::SyntaxError => e assert_equal 'Invalid CSS after " bar:1px ": expected ";", was "; }"', e.message assert_equal 2, e.sass_line end def test_uses_property_exception_with_equals render <; } SCSS assert(false, "Expected syntax error") rescue Sass::SyntaxError => e assert_equal "Expected expression, was lt token.", e.message assert_equal 2, e.sass_line end def test_uses_property_exception_when_followed_by_open_bracket render < e assert_equal 'Invalid CSS after " bar:{baz: ": expected expression (e.g. 1px, bold) or "{", was ".fail} }"', e.message assert_equal 2, e.sass_line end def test_script_error render < e assert_equal "Expected expression, was plus token.", e.message assert_equal 2, e.sass_line end def test_multiline_script_error render < e assert_equal "Expected expression, was plus token.", e.message assert_equal 3, e.sass_line end end