sass 3.3.0 → 3.4.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -1
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/CONTRIBUTING.md +148 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +76 -62
  7. data/Rakefile +104 -24
  8. data/VERSION +1 -1
  9. data/VERSION_DATE +1 -1
  10. data/VERSION_NAME +1 -1
  11. data/bin/sass +1 -1
  12. data/bin/scss +1 -1
  13. data/extra/sass-spec-ref.sh +32 -0
  14. data/extra/update_watch.rb +1 -1
  15. data/lib/sass/cache_stores/filesystem.rb +9 -5
  16. data/lib/sass/cache_stores/memory.rb +4 -5
  17. data/lib/sass/callbacks.rb +2 -2
  18. data/lib/sass/css.rb +12 -13
  19. data/lib/sass/deprecation.rb +55 -0
  20. data/lib/sass/engine.rb +106 -70
  21. data/lib/sass/environment.rb +39 -19
  22. data/lib/sass/error.rb +17 -20
  23. data/lib/sass/exec/base.rb +199 -0
  24. data/lib/sass/exec/sass_convert.rb +283 -0
  25. data/lib/sass/exec/sass_scss.rb +440 -0
  26. data/lib/sass/exec.rb +5 -771
  27. data/lib/sass/features.rb +9 -2
  28. data/lib/sass/importers/base.rb +8 -3
  29. data/lib/sass/importers/filesystem.rb +30 -38
  30. data/lib/sass/logger/base.rb +8 -2
  31. data/lib/sass/logger/delayed.rb +50 -0
  32. data/lib/sass/logger.rb +8 -3
  33. data/lib/sass/media.rb +1 -4
  34. data/lib/sass/plugin/compiler.rb +224 -90
  35. data/lib/sass/plugin/configuration.rb +38 -22
  36. data/lib/sass/plugin/merb.rb +2 -2
  37. data/lib/sass/plugin/rack.rb +3 -3
  38. data/lib/sass/plugin/rails.rb +1 -1
  39. data/lib/sass/plugin/staleness_checker.rb +4 -4
  40. data/lib/sass/plugin.rb +6 -5
  41. data/lib/sass/script/css_lexer.rb +1 -1
  42. data/lib/sass/script/css_parser.rb +2 -3
  43. data/lib/sass/script/css_variable_warning.rb +52 -0
  44. data/lib/sass/script/functions.rb +739 -318
  45. data/lib/sass/script/lexer.rb +134 -54
  46. data/lib/sass/script/parser.rb +252 -56
  47. data/lib/sass/script/tree/funcall.rb +13 -6
  48. data/lib/sass/script/tree/interpolation.rb +127 -4
  49. data/lib/sass/script/tree/list_literal.rb +31 -4
  50. data/lib/sass/script/tree/literal.rb +4 -0
  51. data/lib/sass/script/tree/node.rb +21 -3
  52. data/lib/sass/script/tree/operation.rb +54 -1
  53. data/lib/sass/script/tree/selector.rb +26 -0
  54. data/lib/sass/script/tree/string_interpolation.rb +59 -38
  55. data/lib/sass/script/tree/variable.rb +1 -1
  56. data/lib/sass/script/tree.rb +1 -0
  57. data/lib/sass/script/value/base.rb +17 -14
  58. data/lib/sass/script/value/bool.rb +0 -5
  59. data/lib/sass/script/value/color.rb +78 -42
  60. data/lib/sass/script/value/helpers.rb +119 -2
  61. data/lib/sass/script/value/list.rb +0 -15
  62. data/lib/sass/script/value/map.rb +1 -1
  63. data/lib/sass/script/value/null.rb +0 -5
  64. data/lib/sass/script/value/number.rb +112 -31
  65. data/lib/sass/script/value/string.rb +102 -13
  66. data/lib/sass/script/value.rb +0 -1
  67. data/lib/sass/script.rb +3 -3
  68. data/lib/sass/scss/css_parser.rb +24 -4
  69. data/lib/sass/scss/parser.rb +290 -383
  70. data/lib/sass/scss/rx.rb +17 -9
  71. data/lib/sass/scss/static_parser.rb +306 -4
  72. data/lib/sass/scss.rb +0 -2
  73. data/lib/sass/selector/abstract_sequence.rb +35 -18
  74. data/lib/sass/selector/comma_sequence.rb +114 -19
  75. data/lib/sass/selector/pseudo.rb +266 -0
  76. data/lib/sass/selector/sequence.rb +146 -40
  77. data/lib/sass/selector/simple.rb +22 -33
  78. data/lib/sass/selector/simple_sequence.rb +122 -39
  79. data/lib/sass/selector.rb +57 -197
  80. data/lib/sass/shared.rb +2 -2
  81. data/lib/sass/source/map.rb +31 -14
  82. data/lib/sass/source/position.rb +4 -4
  83. data/lib/sass/stack.rb +2 -8
  84. data/lib/sass/supports.rb +10 -13
  85. data/lib/sass/tree/at_root_node.rb +1 -0
  86. data/lib/sass/tree/charset_node.rb +1 -1
  87. data/lib/sass/tree/comment_node.rb +1 -1
  88. data/lib/sass/tree/css_import_node.rb +9 -1
  89. data/lib/sass/tree/directive_node.rb +8 -2
  90. data/lib/sass/tree/error_node.rb +18 -0
  91. data/lib/sass/tree/extend_node.rb +1 -1
  92. data/lib/sass/tree/function_node.rb +9 -0
  93. data/lib/sass/tree/import_node.rb +6 -5
  94. data/lib/sass/tree/keyframe_rule_node.rb +15 -0
  95. data/lib/sass/tree/node.rb +5 -3
  96. data/lib/sass/tree/prop_node.rb +6 -7
  97. data/lib/sass/tree/rule_node.rb +26 -11
  98. data/lib/sass/tree/visitors/check_nesting.rb +56 -32
  99. data/lib/sass/tree/visitors/convert.rb +59 -44
  100. data/lib/sass/tree/visitors/cssize.rb +34 -30
  101. data/lib/sass/tree/visitors/deep_copy.rb +6 -1
  102. data/lib/sass/tree/visitors/extend.rb +15 -13
  103. data/lib/sass/tree/visitors/perform.rb +87 -50
  104. data/lib/sass/tree/visitors/set_options.rb +15 -1
  105. data/lib/sass/tree/visitors/to_css.rb +72 -43
  106. data/lib/sass/util/multibyte_string_scanner.rb +0 -2
  107. data/lib/sass/util/normalized_map.rb +0 -1
  108. data/lib/sass/util/subset_map.rb +2 -3
  109. data/lib/sass/util.rb +334 -154
  110. data/lib/sass/version.rb +7 -7
  111. data/lib/sass.rb +10 -8
  112. data/test/sass/cache_test.rb +62 -20
  113. data/test/sass/callbacks_test.rb +1 -1
  114. data/test/sass/compiler_test.rb +24 -11
  115. data/test/sass/conversion_test.rb +241 -50
  116. data/test/sass/css2sass_test.rb +73 -5
  117. data/test/sass/css_variable_test.rb +132 -0
  118. data/test/sass/encoding_test.rb +219 -0
  119. data/test/sass/engine_test.rb +343 -260
  120. data/test/sass/exec_test.rb +12 -2
  121. data/test/sass/extend_test.rb +333 -44
  122. data/test/sass/functions_test.rb +353 -260
  123. data/test/sass/importer_test.rb +40 -21
  124. data/test/sass/logger_test.rb +1 -1
  125. data/test/sass/more_results/more_import.css +1 -1
  126. data/test/sass/more_templates/more1.sass +10 -10
  127. data/test/sass/more_templates/more_import.sass +2 -2
  128. data/test/sass/plugin_test.rb +24 -21
  129. data/test/sass/results/compact.css +1 -1
  130. data/test/sass/results/complex.css +4 -4
  131. data/test/sass/results/expanded.css +1 -1
  132. data/test/sass/results/import.css +1 -1
  133. data/test/sass/results/import_charset_ibm866.css +2 -2
  134. data/test/sass/results/mixins.css +17 -17
  135. data/test/sass/results/nested.css +1 -1
  136. data/test/sass/results/parent_ref.css +2 -2
  137. data/test/sass/results/script.css +5 -5
  138. data/test/sass/results/scss_import.css +1 -1
  139. data/test/sass/script_conversion_test.rb +71 -39
  140. data/test/sass/script_test.rb +714 -123
  141. data/test/sass/scss/css_test.rb +213 -30
  142. data/test/sass/scss/rx_test.rb +8 -4
  143. data/test/sass/scss/scss_test.rb +766 -22
  144. data/test/sass/source_map_test.rb +263 -95
  145. data/test/sass/superselector_test.rb +210 -0
  146. data/test/sass/templates/_partial.sass +1 -1
  147. data/test/sass/templates/basic.sass +10 -10
  148. data/test/sass/templates/bork1.sass +1 -1
  149. data/test/sass/templates/bork5.sass +1 -1
  150. data/test/sass/templates/compact.sass +10 -10
  151. data/test/sass/templates/complex.sass +187 -187
  152. data/test/sass/templates/compressed.sass +10 -10
  153. data/test/sass/templates/expanded.sass +10 -10
  154. data/test/sass/templates/import.sass +2 -2
  155. data/test/sass/templates/importee.sass +3 -3
  156. data/test/sass/templates/mixins.sass +22 -22
  157. data/test/sass/templates/multiline.sass +4 -4
  158. data/test/sass/templates/nested.sass +13 -13
  159. data/test/sass/templates/parent_ref.sass +12 -12
  160. data/test/sass/templates/script.sass +70 -70
  161. data/test/sass/templates/scss_import.scss +2 -1
  162. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  163. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  164. data/test/sass/templates/subdir/subdir.sass +3 -3
  165. data/test/sass/templates/units.sass +10 -10
  166. data/test/sass/test_helper.rb +1 -1
  167. data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
  168. data/test/sass/util/normalized_map_test.rb +1 -1
  169. data/test/sass/util/subset_map_test.rb +2 -2
  170. data/test/sass/util_test.rb +46 -45
  171. data/test/sass/value_helpers_test.rb +5 -7
  172. data/test/sass-spec.yml +3 -0
  173. data/test/test_helper.rb +7 -6
  174. data/vendor/listen/CHANGELOG.md +1 -228
  175. data/vendor/listen/Gemfile +5 -15
  176. data/vendor/listen/README.md +111 -77
  177. data/vendor/listen/Rakefile +0 -42
  178. data/vendor/listen/lib/listen/adapter.rb +195 -82
  179. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  180. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  181. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  182. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  183. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  184. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  185. data/vendor/listen/lib/listen/listener.rb +135 -37
  186. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  187. data/vendor/listen/lib/listen/version.rb +1 -1
  188. data/vendor/listen/lib/listen.rb +33 -19
  189. data/vendor/listen/listen.gemspec +6 -0
  190. data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
  191. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  192. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  193. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  194. data/vendor/listen/spec/listen_spec.rb +15 -21
  195. data/vendor/listen/spec/spec_helper.rb +4 -0
  196. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  197. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  198. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  199. metadata +310 -300
  200. data/CONTRIBUTING +0 -3
  201. data/ext/mkrf_conf.rb +0 -27
  202. data/lib/sass/script/value/deprecated_false.rb +0 -55
  203. data/lib/sass/scss/script_lexer.rb +0 -15
  204. data/lib/sass/scss/script_parser.rb +0 -25
  205. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  206. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  207. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  208. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
data/lib/sass/version.rb CHANGED
@@ -8,7 +8,7 @@ module Sass
8
8
  # if it was installed from Git.
9
9
  module Version
10
10
  # Returns a hash representing the version of Sass.
11
- # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums.
11
+ # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Integers.
12
12
  # The `:name` key has the name of the version.
13
13
  # The `:string` key contains a human-readable string representation of the version.
14
14
  # The `:number` key is the major, minor, and teeny keys separated by periods.
@@ -41,7 +41,7 @@ module Sass
41
41
  # :prerelease_number => 1
42
42
  # }
43
43
  #
44
- # @return [{Symbol => String/Fixnum}] The version hash
44
+ # @return [{Symbol => String/Integer}] The version hash
45
45
  # @comment
46
46
  # rubocop:disable ClassVars
47
47
  def version
@@ -85,20 +85,20 @@ module Sass
85
85
  private
86
86
 
87
87
  def revision_number
88
- if File.exists?(Sass::Util.scope('REVISION'))
88
+ if File.exist?(Sass::Util.scope('REVISION'))
89
89
  rev = File.read(Sass::Util.scope('REVISION')).strip
90
90
  return rev unless rev =~ /^([a-f0-9]+|\(.*\))$/ || rev == '(unknown)'
91
91
  end
92
92
 
93
- return unless File.exists?(Sass::Util.scope('.git/HEAD'))
93
+ return unless File.exist?(Sass::Util.scope('.git/HEAD'))
94
94
  rev = File.read(Sass::Util.scope('.git/HEAD')).strip
95
95
  return rev unless rev =~ /^ref: (.*)$/
96
96
 
97
97
  ref_name = $1
98
98
  ref_file = Sass::Util.scope(".git/#{ref_name}")
99
99
  info_file = Sass::Util.scope(".git/info/refs")
100
- return File.read(ref_file).strip if File.exists?(ref_file)
101
- return unless File.exists?(info_file)
100
+ return File.read(ref_file).strip if File.exist?(ref_file)
101
+ return unless File.exist?(info_file)
102
102
  File.open(info_file) do |f|
103
103
  f.each do |l|
104
104
  sha, ref = l.strip.split("\t", 2)
@@ -110,7 +110,7 @@ module Sass
110
110
  end
111
111
 
112
112
  def version_date
113
- return unless File.exists?(Sass::Util.scope('VERSION_DATE'))
113
+ return unless File.exist?(Sass::Util.scope('VERSION_DATE'))
114
114
  DateTime.parse(File.read(Sass::Util.scope('VERSION_DATE')).strip)
115
115
  end
116
116
  end
data/lib/sass.rb CHANGED
@@ -1,11 +1,6 @@
1
1
  dir = File.dirname(__FILE__)
2
2
  $LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
3
3
 
4
- # This is necessary to set so that the Haml code that tries to load Sass
5
- # knows that Sass is indeed loading,
6
- # even if there's some crazy autoload stuff going on.
7
- SASS_BEGUN_TO_LOAD = true unless defined?(SASS_BEGUN_TO_LOAD)
8
-
9
4
  require 'sass/version'
10
5
 
11
6
  # The module that contains everything Sass-related:
@@ -52,7 +47,7 @@ module Sass
52
47
  #
53
48
  # @param contents [String] The contents of the Sass file.
54
49
  # @param options [{Symbol => Object}] An options hash;
55
- # see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
50
+ # see {file:SASS_REFERENCE.md#Options the Sass options documentation}
56
51
  # @raise [Sass::SyntaxError] if there's an error in the document
57
52
  # @raise [Encoding::UndefinedConversionError] if the source encoding
58
53
  # cannot be converted to UTF-8
@@ -74,7 +69,7 @@ module Sass
74
69
  #
75
70
  # @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
76
71
  # @param options [{Symbol => Object}] An options hash;
77
- # see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
72
+ # see {file:SASS_REFERENCE.md#Options the Sass options documentation}
78
73
  # @return [String] The compiled CSS.
79
74
  #
80
75
  # @overload compile_file(filename, css_filename, options = {})
@@ -82,7 +77,7 @@ module Sass
82
77
  #
83
78
  # @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
84
79
  # @param options [{Symbol => Object}] An options hash;
85
- # see {file:SASS_REFERENCE.md#sass_options the Sass options documentation}
80
+ # see {file:SASS_REFERENCE.md#Options the Sass options documentation}
86
81
  # @param css_filename [String] The location to which to write the compiled CSS.
87
82
  def self.compile_file(filename, *args)
88
83
  options = args.last.is_a?(Hash) ? args.pop : {}
@@ -105,3 +100,10 @@ require 'sass/engine'
105
100
  require 'sass/plugin' if defined?(Merb::Plugins)
106
101
  require 'sass/railtie'
107
102
  require 'sass/features'
103
+
104
+ if Sass::Util.ruby1?
105
+ Sass::Util.sass_warn(
106
+ "DEPRECATION WARNING:\n" +
107
+ "Sass 3.5 will no longer support Ruby #{RUBY_VERSION}.\n" +
108
+ "Please upgrade to Ruby 2.0.0 or greater as soon as possible.\n")
109
+ end
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require File.dirname(__FILE__) + '/test_helper'
4
4
  require 'sass/engine'
5
5
 
6
- class CacheTest < Test::Unit::TestCase
6
+ class CacheTest < MiniTest::Test
7
7
  @@cache_dir = "tmp/file_cache"
8
8
 
9
9
  def setup
@@ -18,42 +18,42 @@ class CacheTest < Test::Unit::TestCase
18
18
  def test_file_cache_writes_a_file
19
19
  file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
20
20
  file_store.store("asdf/foo.scssc", "fakesha1", root_node)
21
- assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
21
+ assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
22
22
  end
23
23
 
24
24
  def test_file_cache_reads_a_file
25
25
  file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
26
- assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
26
+ assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
27
27
  file_store.store("asdf/foo.scssc", "fakesha1", root_node)
28
- assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
28
+ assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
29
29
  assert_kind_of Sass::Tree::RootNode, file_store.retrieve("asdf/foo.scssc", "fakesha1")
30
30
  end
31
31
 
32
32
  def test_file_cache_miss_returns_nil
33
33
  file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
34
- assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
34
+ assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
35
35
  assert_nil file_store.retrieve("asdf/foo.scssc", "fakesha1")
36
36
  end
37
37
 
38
38
  def test_sha_change_invalidates_cache_and_cleans_up
39
39
  file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
40
- assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
40
+ assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
41
41
  file_store.store("asdf/foo.scssc", "fakesha1", root_node)
42
- assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
42
+ assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
43
43
  assert_nil file_store.retrieve("asdf/foo.scssc", "differentsha1")
44
- assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
44
+ assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
45
45
  end
46
46
 
47
47
  def test_version_change_invalidates_cache_and_cleans_up
48
48
  file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
49
- assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
49
+ assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
50
50
  file_store.store("asdf/foo.scssc", "fakesha1", root_node)
51
- assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
51
+ assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
52
52
  real_version = Sass::VERSION
53
53
  begin
54
54
  Sass::VERSION.replace("a different version")
55
55
  assert_nil file_store.retrieve("asdf/foo.scssc", "fakesha1")
56
- assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
56
+ assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
57
57
  ensure
58
58
  Sass::VERSION.replace(real_version)
59
59
  end
@@ -66,17 +66,52 @@ class CacheTest < Test::Unit::TestCase
66
66
  assert_equal an_object, cache.retrieve("an_object", "")
67
67
  end
68
68
 
69
- class Unmarshalable
70
- def _dump(_)
71
- raise 'Unmarshalable'
72
- end
69
+ def test_cache_node_with_unmarshalable_option
70
+ engine_with_unmarshalable_options("foo {a: b + c}").to_tree
73
71
  end
74
72
 
75
- def test_cache_node_with_unmarshalable_option
76
- engine = Sass::Engine.new("foo {a: b + c}",
77
- :syntax => :scss, :object => Unmarshalable.new, :filename => 'file.scss',
78
- :importer => Sass::Importers::Filesystem.new(absolutize('templates')))
79
- engine.to_tree
73
+ # Regression tests
74
+
75
+ def test_cache_mixin_def_splat_sass_node_with_unmarshalable_option
76
+ engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
77
+ =color($args...)
78
+ color: red
79
+ SASS
80
+ end
81
+
82
+ def test_cache_mixin_def_splat_scss_node_with_unmarshalable_option
83
+ engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
84
+ @mixin color($args...) {
85
+ color: red;
86
+ }
87
+ SCSS
88
+ end
89
+
90
+ def test_cache_function_splat_sass_node_with_unmarshalable_option
91
+ engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
92
+ @function color($args...)
93
+ @return red
94
+ SASS
95
+ end
96
+
97
+ def test_cache_function_splat_scss_node_with_unmarshalable_option
98
+ engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
99
+ @function color($args...) {
100
+ @return red;
101
+ }
102
+ SCSS
103
+ end
104
+
105
+ def test_cache_include_splat_sass_node_with_unmarshalable_option
106
+ engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
107
+ @include color($args..., $kwargs...)
108
+ SASS
109
+ end
110
+
111
+ def test_cache_include_splat_scss_node_with_unmarshalable_option
112
+ engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
113
+ @include color($args..., $kwargs...);
114
+ SCSS
80
115
  end
81
116
 
82
117
  private
@@ -86,4 +121,11 @@ class CacheTest < Test::Unit::TestCase
86
121
  div { @include color(red); }
87
122
  SCSS
88
123
  end
124
+
125
+ def engine_with_unmarshalable_options(src, options={})
126
+ Sass::Engine.new(src, {
127
+ :syntax => :scss, :object => Class.new.new, :filename => 'file.scss',
128
+ :importer => Sass::Importers::Filesystem.new(absolutize('templates'))
129
+ }.merge(options))
130
+ end
89
131
  end
@@ -26,7 +26,7 @@ module ClassLevelCallerBack
26
26
  end
27
27
  end
28
28
 
29
- class SassCallbacksTest < Test::Unit::TestCase
29
+ class SassCallbacksTest < MiniTest::Test
30
30
  def test_simple_callback
31
31
  cb = CallerBack.new
32
32
  there = false
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
  require File.dirname(__FILE__) + '/../test_helper'
4
4
  require 'sass/plugin'
5
5
  require 'sass/plugin/compiler'
6
6
 
7
- class CompilerTest < Test::Unit::TestCase
7
+ class CompilerTest < MiniTest::Test
8
8
  class FakeListener
9
9
  attr_accessor :options
10
10
  attr_accessor :directories
@@ -18,7 +18,7 @@ class CompilerTest < Test::Unit::TestCase
18
18
  @start_called = false
19
19
  reset_events!
20
20
  end
21
-
21
+
22
22
  def fire_events!(*args)
23
23
  @on_filesystem_event.call(@modified, @added, @removed)
24
24
  reset_events!
@@ -47,7 +47,11 @@ class CompilerTest < Test::Unit::TestCase
47
47
 
48
48
  # used for Listen >= 2.0
49
49
  def start
50
- @thread = Thread.new {@run_during_start.call(self) if @run_during_start}
50
+ parent = Thread.current
51
+ @thread = Thread.new do
52
+ @run_during_start.call(self) if @run_during_start
53
+ parent.raise Interrupt
54
+ end
51
55
  end
52
56
 
53
57
  def stop
@@ -82,9 +86,18 @@ class CompilerTest < Test::Unit::TestCase
82
86
 
83
87
  private
84
88
  def create_listener(*args, &on_filesystem_event)
85
- @fake_listener = FakeListener.new(*args, &on_filesystem_event)
86
- @fake_listener.on_start!(&run_during_start)
87
- @fake_listener
89
+ if Sass::Util.listen_geq_2?
90
+ args.pop if args.last.is_a?(Hash)
91
+ args.map do |dir|
92
+ @fake_listener = FakeListener.new(*args, &on_filesystem_event)
93
+ @fake_listener.on_start!(&run_during_start)
94
+ @fake_listener
95
+ end
96
+ else
97
+ @fake_listener = FakeListener.new(*args, &on_filesystem_event)
98
+ @fake_listener.on_start!(&run_during_start)
99
+ @fake_listener
100
+ end
88
101
  end
89
102
  end
90
103
 
@@ -174,12 +187,12 @@ class CompilerTest < Test::Unit::TestCase
174
187
  directories = nil
175
188
  c = watcher do |listener|
176
189
  directories = listener.directories
177
- listener.removed "/asdf/foobar/sass/foo.scss"
190
+ listener.removed File.expand_path("./foo.scss")
178
191
  listener.fire_events!
179
192
  end
180
- c.watch([["/asdf/foobar/sass/foo.scss", "/asdf/foobar/css/foo.css", nil]])
181
- assert directories.include?("/asdf/foobar/sass"), directories.inspect
182
- assert_equal "/asdf/foobar/css/foo.css", c.deleted_css_files.first, "the corresponding css file was not deleted"
193
+ c.watch([[File.expand_path("./foo.scss"), File.expand_path("./foo.css"), nil]])
194
+ assert directories.include?(File.expand_path(".")), directories.inspect
195
+ assert_equal File.expand_path("./foo.css"), c.deleted_css_files.first, "the corresponding css file was not deleted"
183
196
  assert_equal [], c.update_stylesheets_called_with[1], "the sass file should not have been compiled"
184
197
  end
185
198