diff --git a/test/sass/engine_test.rb b/test/sass/engine_test.rb index ba84c371..c08079fc 100755 --- a/test/sass/engine_test.rb +++ b/test/sass/engine_test.rb @@ -1745,6 +1745,22 @@ SASS end end + def test_warn_with_imports + expected_warning = < :compact, :load_paths => [File.dirname(__FILE__) + "/templates"] + end + end + # Regression tests def test_parens_in_mixins diff --git a/test/sass/plugin_test.rb b/test/sass/plugin_test.rb index d9425462..d4c8cc78 100755 --- a/test/sass/plugin_test.rb +++ b/test/sass/plugin_test.rb @@ -14,7 +14,7 @@ class SassPluginTest < Test::Unit::TestCase FileUtils.mkdir tempfile_loc FileUtils.mkdir tempfile_loc(nil,"more_") set_plugin_opts - Sass::Plugin.update_stylesheets + update_all_stylesheets! reset_mtimes end @@ -34,21 +34,21 @@ class SassPluginTest < Test::Unit::TestCase def test_no_update File.delete(tempfile_loc('basic')) assert_needs_update 'basic' - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_stylesheet_updated 'basic' end def test_update_needed_when_modified touch 'basic' assert_needs_update 'basic' - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_stylesheet_updated 'basic' end def test_update_needed_when_dependency_modified touch 'basic' assert_needs_update 'import' - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_stylesheet_updated 'basic' assert_stylesheet_updated 'import' end @@ -56,7 +56,7 @@ class SassPluginTest < Test::Unit::TestCase def test_update_needed_when_scss_dependency_modified touch 'scss_importee' assert_needs_update 'import' - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_stylesheet_updated 'scss_importee' assert_stylesheet_updated 'import' end @@ -64,14 +64,14 @@ class SassPluginTest < Test::Unit::TestCase def test_scss_update_needed_when_dependency_modified touch 'basic' assert_needs_update 'scss_import' - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_stylesheet_updated 'basic' assert_stylesheet_updated 'scss_import' end def test_full_exception_handling File.delete(tempfile_loc('bork1')) - Sass::Plugin.update_stylesheets + update_all_stylesheets! File.open(tempfile_loc('bork1')) do |file| assert_equal(< tempfile_loc, template_loc(nil,'more_') => tempfile_loc(nil,'more_') } - Sass::Plugin.update_stylesheets + update_all_stylesheets! ['more1', 'more_import'].each { |name| assert_renders_correctly(name, :prefix => 'more_') } end @@ -111,7 +111,7 @@ CSS template_loc => tempfile_loc, template_loc(nil,'more_') => tempfile_loc(nil,'more_') } - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_renders_correctly('more1_with_line_comments', 'more1', :prefix => 'more_') end @@ -157,7 +157,7 @@ CSS def test_updating_stylesheets_callback_with_individual_files files = [[template_loc("basic"), tempfile_loc("basic")]] - assert_callback(:updating_stylesheets, files) {Sass::Plugin.update_stylesheets(files)} + assert_callback(:updating_stylesheets, files) {Haml::Util.silence_haml_warnings{Sass::Plugin.update_stylesheets(files)}} end def test_updating_stylesheets_callback_with_never_update @@ -248,7 +248,7 @@ CSS touch 'basic', 'more_' assert_needs_update "import" - Sass::Plugin.update_stylesheets + update_all_stylesheets! assert_renders_correctly("import") ensure FileUtils.mv(template_loc("basic", "more_"), template_loc("basic")) @@ -299,7 +299,7 @@ CSS if block_given? yield else - Sass::Plugin.update_stylesheets + update_all_stylesheets! end assert run, "Expected #{name} callback to be run with arguments:\n #{expected_args.inspect}" @@ -322,17 +322,17 @@ CSS if block_given? yield else - Sass::Plugin.update_stylesheets + update_all_stylesheets! end end def assert_callbacks(*args) - return Sass::Plugin.update_stylesheets if args.empty? + return update_all_stylesheets! if args.empty? assert_callback(*args.pop) {assert_callbacks(*args)} end def assert_no_callbacks(*args) - return Sass::Plugin.update_stylesheets if args.empty? + return update_all_stylesheets! if args.empty? assert_no_callback(*args.pop) {assert_no_callbacks(*args)} end @@ -340,6 +340,12 @@ CSS Sass::Plugin.instance_variable_set('@_sass_callbacks', {}) end + def update_all_stylesheets! + Haml::Util.silence_haml_warnings do + Sass::Plugin.update_stylesheets + end + end + def assert_needs_update(name) assert(Sass::Plugin.stylesheet_needs_update?(tempfile_loc(name), template_loc(name)), "Expected #{template_loc(name)} to need an update.") diff --git a/test/sass/results/warn.css b/test/sass/results/warn.css new file mode 100644 index 00000000..e69de29b diff --git a/test/sass/results/warn_imported.css b/test/sass/results/warn_imported.css new file mode 100644 index 00000000..e69de29b diff --git a/test/sass/templates/warn.sass b/test/sass/templates/warn.sass new file mode 100644 index 00000000..514c44a2 --- /dev/null +++ b/test/sass/templates/warn.sass @@ -0,0 +1,3 @@ +@warn "In the main file" +@import warn_imported.sass ++emits-a-warning diff --git a/test/sass/templates/warn_imported.sass b/test/sass/templates/warn_imported.sass new file mode 100644 index 00000000..493bd8af --- /dev/null +++ b/test/sass/templates/warn_imported.sass @@ -0,0 +1,4 @@ +@warn "Imported" + +=emits-a-warning + @warn "In an imported mixin"