sass 3.1.10 → 3.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.10
1
+ 3.1.11
@@ -108,7 +108,7 @@ module Sass
108
108
  # @return [(String, Symbol)] A filename-syntax pair.
109
109
  def find_real_file(dir, name)
110
110
  for (f,s) in possible_files(remove_root(name))
111
- path = (dir == ".") ? f : "#{dir}/#{f}"
111
+ path = (dir == "." || Pathname.new(f).absolute?) ? f : "#{dir}/#{f}"
112
112
  if full_path = Dir[path].first
113
113
  full_path.gsub!(REDUNDANT_DIRECTORY,File::SEPARATOR)
114
114
  return full_path, s
data/lib/sass/plugin.rb CHANGED
@@ -92,14 +92,10 @@ module Sass
92
92
  # the second is the location of the CSS file that it should be compiled to.
93
93
  # @see #update_stylesheets
94
94
  def force_update_stylesheets(individual_files = [])
95
- old_options = options
96
- self.options = options.dup
97
- options[:never_update] = false
98
- options[:always_update] = true
99
- options[:cache] = false
100
- update_stylesheets(individual_files)
101
- ensure
102
- self.options = old_options
95
+ Compiler.new(options.dup.merge(
96
+ :never_update => false,
97
+ :always_update => true,
98
+ :cache => false)).update_stylesheets(individual_files)
103
99
  end
104
100
 
105
101
  # All other method invocations are proxied to the \{#compiler}.
@@ -38,7 +38,7 @@ module Sass::Plugin
38
38
  self.options.merge!(options)
39
39
  end
40
40
 
41
- # Register a callback to be run before stylesheets are mass-updated.
41
+ # Register a callback to be run after stylesheets are mass-updated.
42
42
  # This is run whenever \{#update\_stylesheets} is called,
43
43
  # unless the \{file:SASS_REFERENCE.md#never_update-option `:never_update` option}
44
44
  # is enabled.
@@ -51,6 +51,22 @@ module Sass::Plugin
51
51
  # the second is the target CSS file.
52
52
  define_callback :updating_stylesheets
53
53
 
54
+ # Register a callback to be run after a single stylesheet is updated.
55
+ # The callback is only run if the stylesheet is really updated;
56
+ # if the CSS file is fresh, this won't be run.
57
+ #
58
+ # Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
59
+ # is enabled, this callback won't be run
60
+ # when an exception CSS file is being written.
61
+ # To run an action for those files, use \{#on\_compilation\_error}.
62
+ #
63
+ # @yield [template, css]
64
+ # @yieldparam template [String]
65
+ # The location of the Sass/SCSS file being updated.
66
+ # @yieldparam css [String]
67
+ # The location of the CSS file being generated.
68
+ define_callback :updated_stylesheet
69
+
54
70
  # Register a callback to be run before a single stylesheet is updated.
55
71
  # The callback is only run if the stylesheet is guaranteed to be updated;
56
72
  # if the CSS file is fresh, this won't be run.
@@ -67,6 +83,13 @@ module Sass::Plugin
67
83
  # The location of the CSS file being generated.
68
84
  define_callback :updating_stylesheet
69
85
 
86
+ def on_updating_stylesheet_with_deprecation_warning(&block)
87
+ Sass::Util.sass_warn("Sass::Compiler#on_updating_stylesheet callback is deprecated and will be removed in a future release. Use Sass::Compiler#on_updated_stylesheet instead, which is run after stylesheet compilation.")
88
+ on_updating_stylesheet_without_deprecation_warning(&block)
89
+ end
90
+ alias_method :on_updating_stylesheet_without_deprecation_warning, :on_updating_stylesheet
91
+ alias_method :on_updating_stylesheet, :on_updating_stylesheet_with_deprecation_warning
92
+
70
93
  # Register a callback to be run when Sass decides not to update a stylesheet.
71
94
  # In particular, the callback is run when Sass finds that
72
95
  # the template file and none of its dependencies
@@ -160,28 +183,25 @@ module Sass::Plugin
160
183
  # The first string in each pair is the location of the Sass/SCSS file,
161
184
  # the second is the location of the CSS file that it should be compiled to.
162
185
  def update_stylesheets(individual_files = [])
163
- run_updating_stylesheets individual_files
164
186
  Sass::Plugin.checked_for_updates = true
165
187
  staleness_checker = StalenessChecker.new(engine_options)
166
188
 
167
- individual_files.each do |t, c|
168
- if options[:always_update] || staleness_checker.stylesheet_needs_update?(c, t)
169
- update_stylesheet(t, c)
170
- end
171
- end
172
-
173
189
  template_location_array.each do |template_location, css_location|
174
-
175
190
  Dir.glob(File.join(template_location, "**", "[^_]*.s[ca]ss")).sort.each do |file|
176
191
  # Get the relative path to the file
177
192
  name = file.sub(template_location.to_s.sub(/\/*$/, '/'), "")
178
193
  css = css_filename(name, css_location)
194
+ individual_files << [file, css]
195
+ end
196
+ end
179
197
 
180
- if options[:always_update] || staleness_checker.stylesheet_needs_update?(css, file)
181
- update_stylesheet file, css
182
- else
183
- run_not_updating_stylesheet file, css
184
- end
198
+ run_updating_stylesheets individual_files
199
+
200
+ individual_files.each do |file, css|
201
+ if options[:always_update] || staleness_checker.stylesheet_needs_update?(css, file)
202
+ update_stylesheet(file, css)
203
+ else
204
+ run_not_updating_stylesheet(file, css)
185
205
  end
186
206
  end
187
207
  end
@@ -318,18 +338,23 @@ module Sass::Plugin
318
338
  engine_opts = engine_options(:css_filename => css, :filename => filename)
319
339
  result = Sass::Engine.for_file(filename, engine_opts).render
320
340
  rescue Exception => e
341
+ compilation_error_occured = true
321
342
  run_compilation_error e, filename, css
322
343
  result = Sass::SyntaxError.exception_to_css(e, options)
323
344
  else
324
345
  run_updating_stylesheet filename, css
325
346
  end
326
347
 
327
- # Finally, write the file
348
+ write_file(css, result)
349
+ run_updated_stylesheet(filename, css) unless compilation_error_occured
350
+ end
351
+
352
+ def write_file(css, content)
328
353
  flag = 'w'
329
354
  flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
330
355
  File.open(css, flag) do |file|
331
- file.set_encoding(result.encoding) unless Sass::Util.ruby1_8?
332
- file.print(result)
356
+ file.set_encoding(content.encoding) unless Sass::Util.ruby1_8?
357
+ file.print(content)
333
358
  end
334
359
  end
335
360
 
@@ -31,8 +31,6 @@ module Sass
31
31
  # @return [{Symbol => Object}]
32
32
  def options
33
33
  @options ||= default_options.dup
34
- @options[:cache_store] ||= Sass::CacheStores::Filesystem.new(@options[:cache_location])
35
- @options
36
34
  end
37
35
 
38
36
  # Sets the options hash.
@@ -88,7 +88,12 @@ module Sass
88
88
  opts(Functions::EvaluationContext.new(environment.options).send(ruby_name, *args))
89
89
  end
90
90
  rescue ArgumentError => e
91
- raise e unless e.backtrace.any? {|t| t =~ /:in `(block in )?(#{name}|perform)'$/}
91
+ # If this is a legitimate Ruby-raised argument error, re-raise it.
92
+ # Otherwise, it's an error in the user's stylesheet, so wrap it.
93
+ if e.message =~ /^wrong number of arguments \(\d+ for \d+\)/ &&
94
+ e.backtrace[0] !~ /:in `(block in )?#{ruby_name}'$/
95
+ raise e
96
+ end
92
97
  raise Sass::SyntaxError.new("#{e.message} for `#{name}'")
93
98
  end
94
99
 
@@ -93,7 +93,7 @@ module Sass::Script
93
93
  # \{#adjust_color adjust-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\]}
94
94
  # : Increase or decrease any of the components of a color.
95
95
  #
96
- # \{#scale_color scale-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\]}
96
+ # \{#scale_color scale-color($color, \[$red\], \[$green\], \[$blue\], \[$saturation\], \[$lightness\], \[$alpha\]}
97
97
  # : Fluidly scale one or more components of a color.
98
98
  #
99
99
  # \{#change_color change-color($color, \[$red\], \[$green\], \[$blue\], \[$hue\], \[$saturation\], \[$lightness\], \[$alpha\]}
@@ -182,7 +182,11 @@ module Sass
182
182
  interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect}) and return interp
183
183
  return unless e = #{sub}
184
184
  while tok = try_tok(#{ops.map {|o| o.inspect}.join(', ')})
185
- interp = try_op_before_interp(tok, e) and return interp
185
+ if interp = try_op_before_interp(tok, e)
186
+ return interp unless other_interp = try_ops_after_interp(#{ops.inspect}, #{name.inspect}, interp)
187
+ return other_interp
188
+ end
189
+
186
190
  line = @lexer.line
187
191
  e = Operation.new(e, assert_expr(#{sub.inspect}), tok.type)
188
192
  e.line = line
@@ -217,7 +221,10 @@ RUBY
217
221
  return unless e = interpolation
218
222
  arr = [e]
219
223
  while tok = try_tok(:comma)
220
- interp = try_op_before_interp(tok, e) and return interp
224
+ if interp = try_op_before_interp(tok, e)
225
+ return interp unless other_interp = try_ops_after_interp([:comma], :expr, interp)
226
+ return other_interp
227
+ end
221
228
  arr << assert_expr(:interpolation)
222
229
  end
223
230
  arr.size == 1 ? arr.first : node(List.new(arr, :comma), line)
@@ -235,15 +242,15 @@ RUBY
235
242
  interpolation(interp)
236
243
  end
237
244
 
238
- def try_ops_after_interp(ops, name)
245
+ def try_ops_after_interp(ops, name, prev = nil)
239
246
  return unless @lexer.after_interpolation?
240
247
  return unless op = try_tok(*ops)
241
- interp = try_op_before_interp(op) and return interp
248
+ interp = try_op_before_interp(op, prev) and return interp
242
249
 
243
250
  wa = @lexer.whitespace?
244
251
  str = Script::String.new(Lexer::OPERATORS_REVERSE[op.type])
245
252
  str.line = @lexer.line
246
- interp = Script::Interpolation.new(nil, str, assert_expr(name), !:wb, wa, :originally_text)
253
+ interp = Script::Interpolation.new(prev, str, assert_expr(name), !:wb, wa, :originally_text)
247
254
  interp.line = @lexer.line
248
255
  return interp
249
256
  end
@@ -770,7 +770,7 @@ MESSAGE
770
770
  end
771
771
 
772
772
  def interp_ident(start = IDENT)
773
- return unless val = tok(start) || interpolation
773
+ return unless val = tok(start) || interpolation || tok(IDENT_HYPHEN_INTERP)
774
774
  res = [val]
775
775
  while val = tok(NAME) || interpolation
776
776
  res << val
data/lib/sass/scss/rx.rb CHANGED
@@ -112,6 +112,7 @@ module Sass
112
112
  INTERP_START = /#\{/
113
113
  MOZ_ANY = quote(":-moz-any(", Regexp::IGNORECASE)
114
114
 
115
+ IDENT_HYPHEN_INTERP = /-(?=#\{)/
115
116
  STRING1_NOINTERP = /\"((?:[^\n\r\f\\"#]|#(?!\{)|\\#{NL}|#{ESCAPE})*)\"/
116
117
  STRING2_NOINTERP = /\'((?:[^\n\r\f\\'#]|#(?!\{)|\\#{NL}|#{ESCAPE})*)\'/
117
118
  STRING_NOINTERP = /#{STRING1_NOINTERP}|#{STRING2_NOINTERP}/
@@ -17,11 +17,11 @@ class Sass::Tree::Visitors::CheckNesting < Sass::Tree::Visitors::Base
17
17
  raise e
18
18
  end
19
19
 
20
- PARENT_CLASSES = [ Sass::Tree::EachNode, Sass::Tree::ForNode, Sass::Tree::IfNode,
21
- Sass::Tree::ImportNode, Sass::Tree::MixinNode, Sass::Tree::WhileNode]
20
+ CONTROL_NODES = [Sass::Tree::EachNode, Sass::Tree::ForNode, Sass::Tree::IfNode, Sass::Tree::WhileNode]
21
+ SCRIPT_NODES = [Sass::Tree::ImportNode, Sass::Tree::MixinNode] + CONTROL_NODES
22
22
  def visit_children(parent)
23
23
  old_parent = @parent
24
- @parent = parent unless is_any_of?(parent, PARENT_CLASSES)
24
+ @parent = parent unless is_any_of?(parent, SCRIPT_NODES)
25
25
  old_real_parent, @real_parent = @real_parent, parent
26
26
  super
27
27
  ensure
@@ -48,9 +48,9 @@ class Sass::Tree::Visitors::CheckNesting < Sass::Tree::Visitors::Base
48
48
  "@charset may only be used at the root of a document." unless parent.is_a?(Sass::Tree::RootNode)
49
49
  end
50
50
 
51
- INVALID_EXTEND_PARENTS = [Sass::Tree::RuleNode, Sass::Tree::MixinDefNode]
51
+ VALID_EXTEND_PARENTS = [Sass::Tree::RuleNode, Sass::Tree::MixinDefNode]
52
52
  def invalid_extend_parent?(parent, child)
53
- unless is_any_of?(parent, INVALID_EXTEND_PARENTS)
53
+ unless is_any_of?(parent, VALID_EXTEND_PARENTS)
54
54
  "Extend directives may only be used within rules."
55
55
  end
56
56
  end
@@ -59,23 +59,22 @@ class Sass::Tree::Visitors::CheckNesting < Sass::Tree::Visitors::Base
59
59
  "Functions may only be defined at the root of a document." unless parent.is_a?(Sass::Tree::RootNode)
60
60
  end
61
61
 
62
- INVALID_FUNCTION_CHILDREN = [
63
- Sass::Tree::CommentNode, Sass::Tree::DebugNode, Sass::Tree::EachNode,
64
- Sass::Tree::ForNode, Sass::Tree::IfNode, Sass::Tree::ReturnNode,
65
- Sass::Tree::VariableNode, Sass::Tree::WarnNode, Sass::Tree::WhileNode
66
- ]
62
+ VALID_FUNCTION_CHILDREN = [
63
+ Sass::Tree::CommentNode, Sass::Tree::DebugNode, Sass::Tree::ReturnNode,
64
+ Sass::Tree::VariableNode, Sass::Tree::WarnNode
65
+ ] + CONTROL_NODES
67
66
  def invalid_function_child?(parent, child)
68
- unless is_any_of?(child, INVALID_FUNCTION_CHILDREN)
67
+ unless is_any_of?(child, VALID_FUNCTION_CHILDREN)
69
68
  "Functions can only contain variable declarations and control directives."
70
69
  end
71
70
  end
72
71
 
73
- INVALID_IMPORT_PARENTS = [
72
+ VALID_IMPORT_PARENTS = [
74
73
  Sass::Tree::IfNode, Sass::Tree::ForNode, Sass::Tree::WhileNode,
75
74
  Sass::Tree::EachNode, Sass::Tree::MixinDefNode
76
75
  ]
77
76
  def invalid_import_parent?(parent, child)
78
- if is_any_of?(@real_parent, INVALID_IMPORT_PARENTS)
77
+ if is_any_of?(@real_parent, VALID_IMPORT_PARENTS)
79
78
  return "Import directives may not be used within control directives or mixins."
80
79
  end
81
80
  return if parent.is_a?(Sass::Tree::RootNode)
@@ -98,17 +97,17 @@ class Sass::Tree::Visitors::CheckNesting < Sass::Tree::Visitors::Base
98
97
  "Mixins may only be defined at the root of a document." unless parent.is_a?(Sass::Tree::RootNode)
99
98
  end
100
99
 
101
- INVALID_PROP_CHILDREN = [Sass::Tree::CommentNode, Sass::Tree::PropNode]
100
+ VALID_PROP_CHILDREN = [Sass::Tree::CommentNode, Sass::Tree::PropNode, Sass::Tree::MixinNode] + CONTROL_NODES
102
101
  def invalid_prop_child?(parent, child)
103
- unless is_any_of?(child, INVALID_PROP_CHILDREN)
102
+ unless is_any_of?(child, VALID_PROP_CHILDREN)
104
103
  "Illegal nesting: Only properties may be nested beneath properties."
105
104
  end
106
105
  end
107
106
 
108
- INVALID_PROP_PARENTS = [Sass::Tree::RuleNode, Sass::Tree::PropNode,
109
- Sass::Tree::MixinDefNode, Sass::Tree::DirectiveNode]
107
+ VALID_PROP_PARENTS = [Sass::Tree::RuleNode, Sass::Tree::PropNode,
108
+ Sass::Tree::MixinDefNode, Sass::Tree::DirectiveNode]
110
109
  def invalid_prop_parent?(parent, child)
111
- unless is_any_of?(parent, INVALID_PROP_PARENTS)
110
+ unless is_any_of?(parent, VALID_PROP_PARENTS)
112
111
  "Properties are only allowed within rules, directives, or other properties." + child.pseudo_class_selector_message
113
112
  end
114
113
  end
data/lib/sass/util.rb CHANGED
@@ -467,7 +467,8 @@ MSG
467
467
  # We allow any printable ASCII characters but double quotes in the charset decl
468
468
  bin = str.dup.force_encoding("BINARY")
469
469
  encoding = Sass::Util::ENCODINGS_TO_CHECK.find do |enc|
470
- bin =~ Sass::Util::CHARSET_REGEXPS[enc]
470
+ re = Sass::Util::CHARSET_REGEXPS[enc]
471
+ re && bin =~ re
471
472
  end
472
473
  charset, bom = $1, $2
473
474
  if charset
@@ -508,6 +509,8 @@ MSG
508
509
  Regexp.new(/\A(?:#{_enc("\uFEFF", e)})?#{
509
510
  _enc('@charset "', e)}(.*?)#{_enc('"', e)}|\A(#{
510
511
  _enc("\uFEFF", e)})/)
512
+ rescue Encoding::ConverterNotFound => _
513
+ nil # JRuby on Java 5 doesn't support UTF-32
511
514
  rescue
512
515
  # /\A@charset "(.*?)"/
513
516
  Regexp.new(/\A#{_enc('@charset "', e)}(.*?)#{_enc('"', e)}/)
@@ -1203,6 +1203,18 @@ bar
1203
1203
  SASS
1204
1204
  end
1205
1205
 
1206
+ def test_control_directive_in_nested_property
1207
+ assert_equal(<<CSS, render(<<SASS))
1208
+ foo {
1209
+ a-b: c; }
1210
+ CSS
1211
+ foo
1212
+ a:
1213
+ @if true
1214
+ b: c
1215
+ SASS
1216
+ end
1217
+
1206
1218
  def test_interpolation
1207
1219
  assert_equal("a-1 {\n b-2-3: c-3; }\n", render(<<SASS))
1208
1220
  $a: 1
@@ -176,10 +176,17 @@ CSS
176
176
  file_system_importer
177
177
  )
178
178
  end
179
+
179
180
  def fixture_dir
180
181
  File.join(File.dirname(__FILE__), "fixtures")
181
182
  end
183
+
182
184
  def fixture_file(path)
183
185
  File.join(fixture_dir, path)
184
186
  end
187
+
188
+ def test_absolute_files_across_template_locations
189
+ importer = Sass::Importers::Filesystem.new(absolutize 'templates')
190
+ assert_not_nil importer.mtime(absolutize('more_templates/more1.sass'), {})
191
+ end
185
192
  end
@@ -183,6 +183,7 @@ CSS
183
183
 
184
184
  def test_updating_stylesheets_callback
185
185
  # Should run even when there's nothing to update
186
+ Sass::Plugin.options[:template_location] = nil
186
187
  assert_callback :updating_stylesheets, []
187
188
  end
188
189
 
@@ -196,25 +197,25 @@ CSS
196
197
  assert_no_callback :updating_stylesheets
197
198
  end
198
199
 
199
- def test_updating_stylesheet_callback_for_updated_template
200
+ def test_updated_stylesheet_callback_for_updated_template
200
201
  Sass::Plugin.options[:always_update] = false
201
202
  touch 'basic'
202
- assert_no_callback :updating_stylesheet, template_loc("complex"), tempfile_loc("complex") do
203
+ assert_no_callback :updated_stylesheet, template_loc("complex"), tempfile_loc("complex") do
203
204
  assert_callbacks(
204
- [:updating_stylesheet, template_loc("basic"), tempfile_loc("basic")],
205
- [:updating_stylesheet, template_loc("import"), tempfile_loc("import")])
205
+ [:updated_stylesheet, template_loc("basic"), tempfile_loc("basic")],
206
+ [:updated_stylesheet, template_loc("import"), tempfile_loc("import")])
206
207
  end
207
208
  end
208
209
 
209
- def test_updating_stylesheet_callback_for_fresh_template
210
+ def test_updated_stylesheet_callback_for_fresh_template
210
211
  Sass::Plugin.options[:always_update] = false
211
- assert_no_callback :updating_stylesheet
212
+ assert_no_callback :updated_stylesheet
212
213
  end
213
214
 
214
- def test_updating_stylesheet_callback_for_error_template
215
+ def test_updated_stylesheet_callback_for_error_template
215
216
  Sass::Plugin.options[:always_update] = false
216
217
  touch 'bork1'
217
- assert_no_callback :updating_stylesheet
218
+ assert_no_callback :updated_stylesheet
218
219
  end
219
220
 
220
221
  def test_not_updating_stylesheet_callback_for_fresh_template
@@ -226,8 +227,8 @@ CSS
226
227
  Sass::Plugin.options[:always_update] = false
227
228
  assert_callback :not_updating_stylesheet, template_loc("complex"), tempfile_loc("complex") do
228
229
  assert_no_callbacks(
229
- [:updating_stylesheet, template_loc("basic"), tempfile_loc("basic")],
230
- [:updating_stylesheet, template_loc("import"), tempfile_loc("import")])
230
+ [:updated_stylesheet, template_loc("basic"), tempfile_loc("basic")],
231
+ [:updated_stylesheet, template_loc("import"), tempfile_loc("import")])
231
232
  end
232
233
  end
233
234
 
@@ -347,9 +348,11 @@ CSS
347
348
 
348
349
  def assert_callback(name, *expected_args)
349
350
  run = false
351
+ received_args = nil
350
352
  Sass::Plugin.send("on_#{name}") do |*args|
351
- run ||= expected_args.zip(args).all? do |ea, a|
352
- ea.respond_to?(:call) ? ea.call(a) : ea == a
353
+ received_args = args
354
+ run ||= expected_args.zip(received_args).all? do |ea, ra|
355
+ ea.respond_to?(:call) ? ea.call(ra) : ea == ra
353
356
  end
354
357
  end
355
358
 
@@ -359,7 +362,7 @@ CSS
359
362
  check_for_updates!
360
363
  end
361
364
 
362
- assert run, "Expected #{name} callback to be run with arguments:\n #{expected_args.inspect}"
365
+ assert run, "Expected #{name} callback to be run with arguments:\n #{expected_args.inspect}\nHowever, it got:\n #{received_args.inspect}"
363
366
  end
364
367
 
365
368
  def assert_no_callback(name, *unexpected_args)
@@ -223,6 +223,8 @@ RUBY
223
223
  assert_renders '#{1 + 2}, #{3 + 4}'
224
224
  assert_renders '#{1 + 2} ,#{3 + 4}'
225
225
  assert_renders '#{1 + 2},#{3 + 4}'
226
+ assert_renders '#{1 + 2}, #{3 + 4}, #{5 + 6}'
227
+ assert_renders '3, #{3 + 4}, 11'
226
228
 
227
229
  assert_renders '3 / #{3 + 4}'
228
230
  assert_renders '3 /#{3 + 4}'
@@ -7,6 +7,14 @@ module Sass::Script::Functions::UserFunctions
7
7
  val.options[:foo]
8
8
  Sass::Script::String.new("Options defined!")
9
9
  end
10
+
11
+ def arg_error
12
+ assert_options
13
+ end
14
+ end
15
+
16
+ module Sass::Script::Functions
17
+ include Sass::Script::Functions::UserFunctions
10
18
  end
11
19
 
12
20
  class SassScriptTest < Test::Unit::TestCase
@@ -130,6 +138,8 @@ class SassScriptTest < Test::Unit::TestCase
130
138
  assert_equal '3, 7', resolve('#{1 + 2}, #{3 + 4}')
131
139
  assert_equal '3 ,7', resolve('#{1 + 2} ,#{3 + 4}')
132
140
  assert_equal '3,7', resolve('#{1 + 2},#{3 + 4}')
141
+ assert_equal '3, 7, 11', resolve('#{1 + 2}, #{3 + 4}, #{5 + 6}')
142
+ assert_equal '3, 7, 11', resolve('3, #{3 + 4}, 11')
133
143
 
134
144
  assert_equal '3 / 7', resolve('3 / #{3 + 4}')
135
145
  assert_equal '3 /7', resolve('3 /#{3 + 4}')
@@ -414,6 +424,14 @@ SASS
414
424
  assert_raise_message(Sass::SyntaxError, "() isn't a valid CSS value.") {resolve("nth(append((), ()), 1)")}
415
425
  end
416
426
 
427
+ def test_deep_argument_error_not_unwrapped
428
+ assert_raise_message(ArgumentError, 'wrong number of arguments (0 for 1)') {resolve("arg-error()")}
429
+ end
430
+
431
+ def test_shallow_argument_error_unwrapped
432
+ assert_raise_message(Sass::SyntaxError, "wrong number of arguments (1 for 0) for `arg-error'") {resolve("arg-error(1)")}
433
+ end
434
+
417
435
  # Regression Tests
418
436
 
419
437
  def test_funcall_has_higher_precedence_than_color_name
@@ -1095,6 +1095,15 @@ SCSS
1095
1095
 
1096
1096
  # Regression
1097
1097
 
1098
+ def test_prop_name_interpolation_after_hyphen
1099
+ assert_equal <<CSS, render(<<SCSS)
1100
+ a {
1101
+ -foo-bar: b; }
1102
+ CSS
1103
+ a { -\#{"foo"}-bar: b; }
1104
+ SCSS
1105
+ end
1106
+
1098
1107
  def test_star_plus_and_parent
1099
1108
  assert_equal <<CSS, render(<<SCSS)
1100
1109
  * + html foo {
@@ -3,6 +3,6 @@ $:.unshift test_dir unless $:.include?(test_dir)
3
3
 
4
4
  class Test::Unit::TestCase
5
5
  def absolutize(file)
6
- "#{File.dirname(__FILE__)}/#{file}"
6
+ File.expand_path("#{File.dirname(__FILE__)}/#{file}")
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 10
10
- version: 3.1.10
9
+ - 11
10
+ version: 3.1.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Weizenbaum
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-10-06 00:00:00 -07:00
20
+ date: 2011-11-28 00:00:00 -08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency