sass 3.2.19 → 3.3.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CONTRIBUTING +1 -1
  2. data/MIT-LICENSE +2 -2
  3. data/README.md +13 -14
  4. data/REVISION +1 -1
  5. data/Rakefile +4 -6
  6. data/VERSION +1 -1
  7. data/VERSION_DATE +1 -1
  8. data/VERSION_NAME +1 -1
  9. data/bin/sass +1 -6
  10. data/bin/sass-convert +1 -6
  11. data/bin/scss +1 -6
  12. data/lib/sass/cache_stores/base.rb +0 -2
  13. data/lib/sass/cache_stores/chain.rb +1 -1
  14. data/lib/sass/cache_stores/filesystem.rb +3 -6
  15. data/lib/sass/callbacks.rb +1 -1
  16. data/lib/sass/css.rb +1 -1
  17. data/lib/sass/engine.rb +4 -11
  18. data/lib/sass/error.rb +2 -2
  19. data/lib/sass/exec.rb +10 -40
  20. data/lib/sass/importers/filesystem.rb +15 -52
  21. data/lib/sass/logger/log_level.rb +3 -3
  22. data/lib/sass/media.rb +4 -1
  23. data/lib/sass/plugin.rb +1 -2
  24. data/lib/sass/plugin/compiler.rb +18 -40
  25. data/lib/sass/plugin/staleness_checker.rb +5 -21
  26. data/lib/sass/railtie.rb +0 -1
  27. data/lib/sass/script/funcall.rb +8 -62
  28. data/lib/sass/script/functions.rb +457 -557
  29. data/lib/sass/script/lexer.rb +30 -25
  30. data/lib/sass/script/list.rb +1 -2
  31. data/lib/sass/script/literal.rb +18 -0
  32. data/lib/sass/script/null.rb +1 -4
  33. data/lib/sass/script/operation.rb +1 -0
  34. data/lib/sass/script/parser.rb +35 -42
  35. data/lib/sass/script/string.rb +1 -1
  36. data/lib/sass/script/unary_operation.rb +3 -8
  37. data/lib/sass/scss/parser.rb +14 -33
  38. data/lib/sass/scss/rx.rb +10 -3
  39. data/lib/sass/selector.rb +16 -19
  40. data/lib/sass/selector/sequence.rb +7 -16
  41. data/lib/sass/selector/simple.rb +1 -1
  42. data/lib/sass/selector/simple_sequence.rb +15 -25
  43. data/lib/sass/tree/comment_node.rb +2 -2
  44. data/lib/sass/tree/import_node.rb +2 -9
  45. data/lib/sass/tree/visitors/check_nesting.rb +2 -3
  46. data/lib/sass/tree/visitors/convert.rb +4 -9
  47. data/lib/sass/tree/visitors/cssize.rb +15 -36
  48. data/lib/sass/tree/visitors/perform.rb +20 -23
  49. data/lib/sass/tree/visitors/set_options.rb +0 -8
  50. data/lib/sass/tree/visitors/to_css.rb +1 -0
  51. data/lib/sass/util.rb +2 -120
  52. data/lib/sass/util/multibyte_string_scanner.rb +8 -29
  53. data/test/sass/conversion_test.rb +8 -33
  54. data/test/sass/css2sass_test.rb +0 -19
  55. data/test/sass/engine_test.rb +17 -129
  56. data/test/sass/extend_test.rb +24 -169
  57. data/test/sass/functions_test.rb +73 -93
  58. data/test/sass/plugin_test.rb +11 -72
  59. data/test/sass/script_conversion_test.rb +0 -14
  60. data/test/sass/script_test.rb +1 -40
  61. data/test/sass/scss/css_test.rb +3 -44
  62. data/test/sass/scss/scss_test.rb +3 -134
  63. data/test/sass/util_test.rb +0 -93
  64. data/vendor/listen/CHANGELOG.md +2 -83
  65. data/vendor/listen/Gemfile +1 -8
  66. data/vendor/listen/Guardfile +1 -1
  67. data/vendor/listen/LICENSE +1 -1
  68. data/vendor/listen/README.md +5 -8
  69. data/vendor/listen/lib/listen.rb +5 -7
  70. data/vendor/listen/lib/listen/adapter.rb +29 -76
  71. data/vendor/listen/lib/listen/adapters/darwin.rb +10 -11
  72. data/vendor/listen/lib/listen/adapters/linux.rb +30 -33
  73. data/vendor/listen/lib/listen/adapters/polling.rb +1 -2
  74. data/vendor/listen/lib/listen/adapters/windows.rb +21 -27
  75. data/vendor/listen/lib/listen/directory_record.rb +10 -63
  76. data/vendor/listen/lib/listen/listener.rb +0 -22
  77. data/vendor/listen/lib/listen/multi_listener.rb +0 -22
  78. data/vendor/listen/lib/listen/version.rb +1 -1
  79. data/vendor/listen/listen.gemspec +4 -0
  80. data/vendor/listen/spec/listen/adapter_spec.rb +4 -45
  81. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -6
  82. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -6
  83. data/vendor/listen/spec/listen/adapters/windows_spec.rb +1 -7
  84. data/vendor/listen/spec/listen/directory_record_spec.rb +4 -91
  85. data/vendor/listen/spec/listen/listener_spec.rb +0 -14
  86. data/vendor/listen/spec/listen/multi_listener_spec.rb +1 -19
  87. data/vendor/listen/spec/spec_helper.rb +3 -6
  88. data/vendor/listen/spec/support/adapter_helper.rb +212 -125
  89. data/vendor/listen/spec/support/listeners_helper.rb +1 -13
  90. data/vendor/listen/spec/support/platform_helper.rb +0 -4
  91. metadata +113 -105
  92. checksums.yaml +0 -7
  93. data/lib/sass/util/test.rb +0 -10
  94. data/test/sass/exec_test.rb +0 -86
  95. data/test/sass/results/cached_import_option.css +0 -3
  96. data/test/sass/templates/_cached_import_option_partial.scss +0 -1
  97. data/test/sass/templates/_same_name_different_partiality.scss +0 -1
  98. data/test/sass/templates/bork5.sass +0 -3
  99. data/test/sass/templates/cached_import_option.scss +0 -3
  100. data/test/sass/templates/same_name_different_ext.sass +0 -2
  101. data/test/sass/templates/same_name_different_ext.scss +0 -1
  102. data/test/sass/templates/same_name_different_partiality.scss +0 -1
  103. data/test/sass/templates/subdir/import_up1.scss +0 -1
  104. data/test/sass/templates/subdir/import_up2.scss +0 -1
  105. data/vendor/listen/CONTRIBUTING.md +0 -38
  106. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -112
  107. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  108. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  109. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
@@ -50,14 +50,6 @@ class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
50
50
  yield
51
51
  end
52
52
 
53
- def visit_import(node)
54
- # We have no good way of propagating the new options through an Engine
55
- # instance, so we just null it out. This also lets us avoid caching an
56
- # imported Engine along with the importing source tree.
57
- node.imported_file = nil
58
- yield
59
- end
60
-
61
53
  def visit_mixindef(node)
62
54
  node.args.each do |k, v|
63
55
  k.options = @options
@@ -160,6 +160,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
160
160
 
161
161
  to_return = ''
162
162
  old_spaces = ' ' * @tabs
163
+ spaces = ' ' * (@tabs + 1)
163
164
  if node.style != :compressed
164
165
  if node.options[:debug_info] && !@in_directive
165
166
  to_return << visit(debug_info_rule(node.debug_info, node.options)) << "\n"
@@ -3,7 +3,6 @@ require 'set'
3
3
  require 'enumerator'
4
4
  require 'stringio'
5
5
  require 'rbconfig'
6
- require 'thread'
7
6
 
8
7
  require 'sass/root'
9
8
  require 'sass/util/subset_map'
@@ -257,33 +256,6 @@ module Sass
257
256
  arr
258
257
  end
259
258
 
260
- # Returns a sub-array of `minuend` containing only elements that are also in
261
- # `subtrahend`. Ensures that the return value has the same order as
262
- # `minuend`, even on Rubinius where that's not guaranteed by {Array#-}.
263
- #
264
- # @param minuend [Array]
265
- # @param subtrahend [Array]
266
- # @return [Array]
267
- def array_minus(minuend, subtrahend)
268
- return minuend - subtrahend unless rbx?
269
- set = Set.new(minuend) - subtrahend
270
- minuend.select {|e| set.include?(e)}
271
- end
272
-
273
- # Returns a string description of the character that caused an
274
- # `Encoding::UndefinedConversionError`.
275
- #
276
- # @param [Encoding::UndefinedConversionError]
277
- # @return [String]
278
- def undefined_conversion_error_char(e)
279
- # Rubinius (as of 2.0.0.rc1) pre-quotes the error character.
280
- return e.error_char if rbx?
281
- # JRuby (as of 1.7.2) doesn't have an error_char field on
282
- # Encoding::UndefinedConversionError.
283
- return e.error_char.dump unless jruby?
284
- e.message[/^"[^"]+"/] #"
285
- end
286
-
287
259
  # Asserts that `value` falls within `range` (inclusive), leaving
288
260
  # room for slight floating-point errors.
289
261
  #
@@ -326,9 +298,7 @@ module Sass
326
298
  # @param entry [String] An entry in the `#caller` list, or a similarly formatted string
327
299
  # @return [[String, Fixnum, (String, nil)]] An array containing the filename, line, and method name of the caller.
328
300
  # The method name may be nil
329
- def caller_info(entry = nil)
330
- # JRuby evaluates `caller` incorrectly when it's in an actual default argument.
331
- entry ||= caller[1]
301
+ def caller_info(entry = caller[1])
332
302
  info = entry.scan(/^(.*?):(-?.*?)(?::.*`(.+)')?$/).first
333
303
  info[1] = info[1].to_i
334
304
  # This is added by Rubinius to designate a block, but we don't care about it.
@@ -407,7 +377,6 @@ module Sass
407
377
  #
408
378
  # @param msg [String]
409
379
  def sass_warn(msg)
410
- msg = msg + "\n" unless ruby1?
411
380
  Sass.logger.warn(msg)
412
381
  end
413
382
 
@@ -490,27 +459,6 @@ module Sass
490
459
  RUBY_ENGINE == "ironruby"
491
460
  end
492
461
 
493
- # Whether or not this is running on Rubinius.
494
- #
495
- # @return [Boolean]
496
- def rbx?
497
- RUBY_ENGINE == "rbx"
498
- end
499
-
500
- # Whether or not this is running on JRuby.
501
- #
502
- # @return [Boolean]
503
- def jruby?
504
- RUBY_PLATFORM =~ /java/
505
- end
506
-
507
- # Returns an array of ints representing the JRuby version number.
508
- #
509
- # @return [Array<Fixnum>]
510
- def jruby_version
511
- $jruby_version ||= ::JRUBY_VERSION.split(".").map {|s| s.to_i}
512
- end
513
-
514
462
  # Like `Dir.glob`, but works with backslash-separated paths on Windows.
515
463
  #
516
464
  # @param path [String]
@@ -519,28 +467,8 @@ module Sass
519
467
  Dir.glob(path, &block)
520
468
  end
521
469
 
522
- # Prepare a value for a destructuring assignment (e.g. `a, b =
523
- # val`). This works around a performance bug when using
524
- # ActiveSupport, and only needs to be called when `val` is likely
525
- # to be `nil` reasonably often.
526
- #
527
- # See [this bug report](http://redmine.ruby-lang.org/issues/4917).
528
- #
529
- # @param val [Object]
530
- # @return [Object]
531
- def destructure(val)
532
- val || []
533
- end
534
-
535
470
  ## Cross-Ruby-Version Compatibility
536
471
 
537
- # Whether or not this is running under a Ruby version under 2.0.
538
- #
539
- # @return [Boolean]
540
- def ruby1?
541
- Sass::Util::RUBY_VERSION[0] <= 1
542
- end
543
-
544
472
  # Whether or not this is running under Ruby 1.8 or lower.
545
473
  #
546
474
  # Note that IronRuby counts as Ruby 1.8,
@@ -561,11 +489,6 @@ module Sass
561
489
  ruby1_8? && Sass::Util::RUBY_VERSION[2] < 7
562
490
  end
563
491
 
564
- # Wehter or not this is running under JRuby 1.6 or lower.
565
- def jruby1_6?
566
- jruby? && jruby_version[0] == 1 && jruby_version[1] < 7
567
- end
568
-
569
492
  # Whether or not this is running under MacRuby.
570
493
  #
571
494
  # @return [Boolean]
@@ -602,7 +525,7 @@ module Sass
602
525
  line.encode(encoding)
603
526
  rescue Encoding::UndefinedConversionError => e
604
527
  yield <<MSG.rstrip, i + 1
605
- Invalid #{encoding.name} character #{undefined_conversion_error_char(e)}
528
+ Invalid #{encoding.name} character #{e.error_char.dump}
606
529
  MSG
607
530
  end
608
531
  end
@@ -869,47 +792,6 @@ MSG
869
792
  end
870
793
  end
871
794
 
872
- # @private
873
- ATOMIC_WRITE_MUTEX = Mutex.new
874
-
875
-
876
- # This creates a temp file and yields it for writing. When the
877
- # write is complete, the file is moved into the desired location.
878
- # The atomicity of this operation is provided by the filesystem's
879
- # rename operation.
880
- #
881
- # @param filename [String] The file to write to.
882
- # @param perms [Integer] The permissions used for creating this file.
883
- # Will be masked by the process umask. Defaults to readable/writeable
884
- # by all users however the umask usually changes this to only be writable
885
- # by the process's user.
886
- # @yieldparam tmpfile [Tempfile] The temp file that can be written to.
887
- # @return The value returned by the block.
888
- def atomic_create_and_write_file(filename, perms = 0666)
889
- require 'tempfile'
890
- tmpfile = Tempfile.new(File.basename(filename), File.dirname(filename))
891
- tmpfile.binmode if tmpfile.respond_to?(:binmode)
892
- result = yield tmpfile
893
- tmpfile.flush # ensure all writes are flushed to the OS
894
- begin
895
- tmpfile.fsync # ensure all buffered data in the OS is sync'd to disk.
896
- rescue NotImplementedError
897
- # Not all OSes support fsync
898
- end
899
- tmpfile.close # Windows cannot rename an open file.
900
- # Make file readable and writeable to all but respect umask (usually 022).
901
- File.chmod(perms & ~File.umask, tmpfile.path)
902
- ATOMIC_WRITE_MUTEX.synchronize do
903
- File.rename tmpfile.path, filename
904
- end
905
- result
906
- ensure
907
- # close and remove the tempfile if it still exists,
908
- # presumably due to an error during write
909
- tmpfile.close if tmpfile
910
- tmpfile.unlink if tmpfile
911
- end
912
-
913
795
  private
914
796
 
915
797
  # Calculates the memoization table for the Least Common Subsequence algorithm.
@@ -3,44 +3,23 @@ require 'strscan'
3
3
  if Sass::Util.ruby1_8?
4
4
  Sass::Util::MultibyteStringScanner = StringScanner
5
5
  else
6
- if Sass::Util.rbx?
7
- # Rubinius's StringScanner class implements some of its methods in terms of
8
- # others, which causes us to double-count bytes in some cases if we do
9
- # straightforward inheritance. To work around this, we use a delegate class.
10
- require 'delegate'
11
- class Sass::Util::MultibyteStringScanner < DelegateClass(StringScanner)
12
- def initialize(str)
13
- super(StringScanner.new(str))
14
- @mb_pos = 0
15
- @mb_matched_size = nil
16
- @mb_last_pos = nil
17
- end
18
-
19
- def is_a?(klass)
20
- __getobj__.is_a?(klass) || super
21
- end
22
- end
23
- else
24
- class Sass::Util::MultibyteStringScanner < StringScanner
25
- def initialize(str)
26
- super
27
- @mb_pos = 0
28
- @mb_matched_size = nil
29
- @mb_last_pos = nil
30
- end
31
- end
32
- end
33
-
34
6
  # A wrapper of the native StringScanner class that works correctly with
35
7
  # multibyte character encodings. The native class deals only in bytes, not
36
8
  # characters, for methods like [#pos] and [#matched_size]. This class deals
37
9
  # only in characters, instead.
38
- class Sass::Util::MultibyteStringScanner
10
+ class Sass::Util::MultibyteStringScanner < StringScanner
39
11
  def self.new(str)
40
12
  return StringScanner.new(str) if str.ascii_only?
41
13
  super
42
14
  end
43
15
 
16
+ def initialize(str)
17
+ super
18
+ @mb_pos = 0
19
+ @mb_matched_size = nil
20
+ @mb_last_pos = nil
21
+ end
22
+
44
23
  alias_method :byte_pos, :pos
45
24
  alias_method :byte_matched_size, :matched_size
46
25
 
@@ -1618,22 +1618,6 @@ SCSS
1618
1618
 
1619
1619
  ## Regression Tests
1620
1620
 
1621
- def test_list_in_args
1622
- assert_renders(<<SASS, <<SCSS)
1623
- +mixin((a, b, c))
1624
-
1625
- +mixin($arg: (a, b, c))
1626
-
1627
- +mixin(a, b, (c, d, e)...)
1628
- SASS
1629
- @include mixin((a, b, c));
1630
-
1631
- @include mixin($arg: (a, b, c));
1632
-
1633
- @include mixin(a, b, (c, d, e)...);
1634
- SCSS
1635
- end
1636
-
1637
1621
  def test_media_query_with_expr
1638
1622
  assert_scss_to_sass <<SASS, <<SCSS
1639
1623
  @media foo and (bar: baz)
@@ -1644,6 +1628,14 @@ SASS
1644
1628
  SCSS
1645
1629
  end
1646
1630
 
1631
+ def test_empty_lists
1632
+ assert_renders(<<SASS, <<SCSS)
1633
+ $foo: ()
1634
+ SASS
1635
+ $foo: ();
1636
+ SCSS
1637
+ end
1638
+
1647
1639
  def test_nested_if_statements
1648
1640
  assert_renders(<<SASS, <<SCSS)
1649
1641
  @if $foo
@@ -1692,23 +1684,6 @@ foo {
1692
1684
  SCSS
1693
1685
  end
1694
1686
 
1695
- def test_ambiguous_negation
1696
- assert_renders(<<SASS, <<SCSS, :indent => ' ')
1697
- foo
1698
- ok: -$foo
1699
- comma: 10px, -$foo
1700
- needs-parens: 10px (-$foo)
1701
- no-parens: a 50px + 60px b
1702
- SASS
1703
- foo {
1704
- ok: -$foo;
1705
- comma: 10px, -$foo;
1706
- needs-parens: 10px (-$foo);
1707
- no-parens: a 50px + 60px b;
1708
- }
1709
- SCSS
1710
- end
1711
-
1712
1687
  private
1713
1688
 
1714
1689
  def assert_sass_to_sass(sass, options = {})
@@ -265,25 +265,6 @@ CSS
265
265
 
266
266
  # Regressions
267
267
 
268
- def test_empty_rule
269
- assert_equal(<<SASS, css2sass(<<CSS))
270
- a
271
- SASS
272
- a {}
273
- CSS
274
- end
275
-
276
- def test_empty_rule_with_selector_combinator
277
- assert_equal(<<SASS, css2sass(<<CSS))
278
- a
279
- color: red
280
- > b
281
- SASS
282
- a {color: red}
283
- a > b {}
284
- CSS
285
- end
286
-
287
268
  def test_nesting_within_media
288
269
  assert_equal(<<SASS, css2sass(<<CSS))
289
270
  @media all
@@ -134,19 +134,19 @@ MSG
134
134
  '+foo(1 + 1: 2)' => 'Invalid CSS after "(1 + 1": expected comma, was ": 2)"',
135
135
  '+foo($var: )' => 'Invalid CSS after "($var: ": expected mixin argument, was ")"',
136
136
  '+foo($var: a, $var: b)' => 'Keyword argument "$var" passed more than once',
137
- '+foo($var-var: a, $var_var: b)' => 'Keyword argument "$var_var" passed more than once',
138
- '+foo($var_var: a, $var-var: b)' => 'Keyword argument "$var-var" passed more than once',
137
+ '+foo($var-var: a, $var_var: b)' => 'Keyword argument "$var-var" passed more than once',
138
+ '+foo($var_var: a, $var-var: b)' => 'Keyword argument "$var_var" passed more than once',
139
139
  "a\n b: foo(1 + 1: 2)" => 'Invalid CSS after "foo(1 + 1": expected comma, was ": 2)"',
140
140
  "a\n b: foo($var: )" => 'Invalid CSS after "foo($var: ": expected function argument, was ")"',
141
141
  "a\n b: foo($var: a, $var: b)" => 'Keyword argument "$var" passed more than once',
142
- "a\n b: foo($var-var: a, $var_var: b)" => 'Keyword argument "$var_var" passed more than once',
143
- "a\n b: foo($var_var: a, $var-var: b)" => 'Keyword argument "$var-var" passed more than once',
142
+ "a\n b: foo($var-var: a, $var_var: b)" => 'Keyword argument "$var-var" passed more than once',
143
+ "a\n b: foo($var_var: a, $var-var: b)" => 'Keyword argument "$var_var" passed more than once',
144
144
  "@if foo\n @extend .bar" => ["Extend directives may only be used within rules.", 2],
145
145
  "$var: true\n@while $var\n @extend .bar\n $var: false" => ["Extend directives may only be used within rules.", 3],
146
146
  "@for $i from 0 to 1\n @extend .bar" => ["Extend directives may only be used within rules.", 2],
147
147
  "@mixin foo\n @extend .bar\n@include foo" => ["Extend directives may only be used within rules.", 2],
148
- "foo\n &a\n b: c" => ["Invalid CSS after \"&\": expected \"{\", was \"a\"\n\n\"a\" may only be used at the beginning of a compound selector.", 2],
149
- "foo\n &1\n b: c" => ["Invalid CSS after \"&\": expected \"{\", was \"1\"\n\n\"1\" may only be used at the beginning of a compound selector.", 2],
148
+ "foo\n &a\n b: c" => ["Invalid CSS after \"&\": expected \"{\", was \"a\"\n\n\"a\" may only be used at the beginning of a selector.", 2],
149
+ "foo\n &1\n b: c" => ["Invalid CSS after \"&\": expected \"{\", was \"1\"\n\n\"1\" may only be used at the beginning of a selector.", 2],
150
150
  "foo %\n a: b" => ['Invalid CSS after "foo %": expected placeholder name, was ""', 1],
151
151
  "=foo\n @content error" => "Invalid content directive. Trailing characters found: \"error\".",
152
152
  "=foo\n @content\n b: c" => "Illegal nesting: Nothing may be nested beneath @content directives.",
@@ -158,7 +158,6 @@ MSG
158
158
  "a\n b:\n c\n d" => ["Illegal nesting: Only properties may be nested beneath properties.", 3],
159
159
  "& foo\n bar: baz\n blat: bang" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
160
160
  "a\n b: c\n& foo\n bar: baz\n blat: bang" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 3],
161
- "@" => "Invalid directive: '@'.",
162
161
  }
163
162
 
164
163
  def teardown
@@ -218,47 +217,7 @@ MSG
218
217
  assert_equal("p {\n a: b; }\n p q {\n c: d; }\n",
219
218
  render("p\n\ta: b\n\tq\n\t\tc: d\n"))
220
219
  end
221
-
222
- def test_import_same_name_different_ext
223
- assert_warning <<WARNING do
224
- WARNING: On line 1 of test_import_same_name_different_ext_inline.sass:
225
- It's not clear which file to import for '@import "same_name_different_ext"'.
226
- Candidates:
227
- same_name_different_ext.sass
228
- same_name_different_ext.scss
229
- For now I'll choose same_name_different_ext.sass.
230
- This will be an error in future versions of Sass.
231
- WARNING
232
- options = {:load_paths => [File.dirname(__FILE__) + '/templates/']}
233
- munge_filename options
234
- result = Sass::Engine.new("@import 'same_name_different_ext'", options).render
235
- assert_equal(<<CSS, result)
236
- .foo {
237
- ext: sass; }
238
- CSS
239
- end
240
- end
241
-
242
- def test_import_same_name_different_partiality
243
- assert_warning <<WARNING do
244
- WARNING: On line 1 of test_import_same_name_different_partiality_inline.sass:
245
- It's not clear which file to import for '@import "same_name_different_partiality"'.
246
- Candidates:
247
- _same_name_different_partiality.scss
248
- same_name_different_partiality.scss
249
- For now I'll choose _same_name_different_partiality.scss.
250
- This will be an error in future versions of Sass.
251
- WARNING
252
- options = {:load_paths => [File.dirname(__FILE__) + '/templates/']}
253
- munge_filename options
254
- result = Sass::Engine.new("@import 'same_name_different_partiality'", options).render
255
- assert_equal(<<CSS, result)
256
- .foo {
257
- partial: yes; }
258
- CSS
259
- end
260
- end
261
-
220
+
262
221
  EXCEPTION_MAP.each do |key, value|
263
222
  define_method("test_exception (#{key.inspect})") do
264
223
  line = 10
@@ -524,21 +483,6 @@ MESSAGE
524
483
  assert_hash_has(err.sass_backtrace[2], :mixin => "foo", :line => 2)
525
484
  end
526
485
 
527
- def test_mixin_loop_with_content
528
- render <<SASS
529
- =foo
530
- @content
531
- =bar
532
- +foo
533
- +bar
534
- +bar
535
- SASS
536
- assert(false, "Exception not raised")
537
- rescue Sass::SyntaxError => err
538
- assert_equal("An @include loop has been found: bar includes itself", err.message)
539
- assert_hash_has(err.sass_backtrace[0], :mixin => "@content", :line => 5)
540
- end
541
-
542
486
  def test_basic_import_loop_exception
543
487
  import = filename_for_test
544
488
  importer = MockImporter.new
@@ -558,7 +502,7 @@ ERR
558
502
  importer.add_import("bar", "@import 'foo'")
559
503
 
560
504
  engine = Sass::Engine.new('@import "foo"', :filename => filename_for_test,
561
- :load_paths => [importer], :importer => importer)
505
+ :load_paths => [importer])
562
506
 
563
507
  assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
564
508
  An @import loop has been found:
@@ -575,7 +519,7 @@ ERR
575
519
  importer.add_import("baz", "@import 'foo'")
576
520
 
577
521
  engine = Sass::Engine.new('@import "foo"', :filename => filename_for_test,
578
- :load_paths => [importer], :importer => importer)
522
+ :load_paths => [importer])
579
523
 
580
524
  assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
581
525
  An @import loop has been found:
@@ -681,11 +625,6 @@ CSS
681
625
  render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\""))
682
626
  end
683
627
 
684
- def test_protocol_relative_import
685
- assert_equal("@import url(//fonts.googleapis.com/css?family=Droid+Sans);\n",
686
- render("@import \"//fonts.googleapis.com/css?family=Droid+Sans\""))
687
- end
688
-
689
628
  def test_import_with_interpolation
690
629
  assert_equal(<<CSS, render(<<SASS))
691
630
  @import url("http://fonts.googleapis.com/css?family=Droid+Sans");
@@ -731,7 +670,7 @@ SASS
731
670
  importer.add_import("imported", "div{color:red}")
732
671
  Sass.load_paths << importer
733
672
 
734
- assert_equal "div {\n color: red; }\n", Sass::Engine.new('@import "imported"', :importer => importer).render
673
+ assert_equal "div {\n color: red; }\n", Sass::Engine.new('@import "imported"').render
735
674
  ensure
736
675
  Sass.load_paths.clear
737
676
  end
@@ -1805,7 +1744,7 @@ SASS
1805
1744
 
1806
1745
  def test_loud_comment_in_compressed_mode
1807
1746
  assert_equal <<CSS, render(<<SASS, :style => :compressed)
1808
- foo{color:blue;/*! foo
1747
+ foo{color:blue;/* foo
1809
1748
  * bar
1810
1749
  */}
1811
1750
  CSS
@@ -1819,8 +1758,7 @@ SASS
1819
1758
 
1820
1759
  def test_loud_comment_is_evaluated
1821
1760
  assert_equal <<CSS, render(<<SASS)
1822
- /*!
1823
- * Hue: 327.21649deg */
1761
+ /* Hue: 327.21649deg */
1824
1762
  CSS
1825
1763
  /*!
1826
1764
  Hue: \#{hue(#f836a0)}
@@ -2398,55 +2336,6 @@ SASS
2398
2336
 
2399
2337
  # Regression tests
2400
2338
 
2401
- def test_parent_mixin_in_content_nested
2402
- assert_equal(<<CSS, render(<<SASS))
2403
- a {
2404
- b: c; }
2405
- CSS
2406
- =foo
2407
- @content
2408
-
2409
- =bar
2410
- +foo
2411
- +foo
2412
- a
2413
- b: c
2414
-
2415
- +bar
2416
- SASS
2417
- end
2418
-
2419
- def test_supports_bubbles
2420
- assert_equal <<CSS, render(<<SASS)
2421
- parent {
2422
- background: orange; }
2423
- @supports (perspective: 10px) or (-moz-perspective: 10px) {
2424
- parent child {
2425
- background: blue; } }
2426
- CSS
2427
- parent
2428
- background: orange
2429
- @supports (perspective: 10px) or (-moz-perspective: 10px)
2430
- child
2431
- background: blue
2432
- SASS
2433
- end
2434
-
2435
- def test_line_numbers_with_dos_line_endings
2436
- assert_equal <<CSS, render(<<SASS, :line_comments => true)
2437
- /* line 5, test_line_numbers_with_dos_line_endings_inline.sass */
2438
- .foo {
2439
- a: b; }
2440
- CSS
2441
- \r
2442
- \r
2443
- \r
2444
- \r
2445
- .foo
2446
- a: b
2447
- SASS
2448
- end
2449
-
2450
2339
  def test_variable_in_media_in_mixin
2451
2340
  assert_equal <<CSS, render(<<SASS)
2452
2341
  @media screen and (min-width: 10px) {
@@ -2488,15 +2377,15 @@ SASS
2488
2377
 
2489
2378
  def test_interpolated_comment_in_mixin
2490
2379
  assert_equal <<CSS, render(<<SASS)
2491
- /*! color: red */
2380
+ /* color: red */
2492
2381
  .foo {
2493
2382
  color: red; }
2494
2383
 
2495
- /*! color: blue */
2384
+ /* color: blue */
2496
2385
  .foo {
2497
2386
  color: blue; }
2498
2387
 
2499
- /*! color: green */
2388
+ /* color: green */
2500
2389
  .foo {
2501
2390
  color: green; }
2502
2391
  CSS
@@ -2791,7 +2680,7 @@ CSS
2791
2680
  /* \\\#{foo}
2792
2681
  SASS
2793
2682
  assert_equal <<CSS, render(<<SASS)
2794
- /*! \#{foo} */
2683
+ /* \#{foo} */
2795
2684
  CSS
2796
2685
  /*! \\\#{foo}
2797
2686
  SASS
@@ -2974,7 +2863,7 @@ SCSS
2974
2863
 
2975
2864
  original_filename = filename_for_test
2976
2865
  engine = Sass::Engine.new('@import "imported"; div{color:blue}',
2977
- :filename => original_filename, :load_paths => [importer], :syntax => :scss, :importer => importer)
2866
+ :filename => original_filename, :load_paths => [importer], :syntax => :scss)
2978
2867
  engine.render
2979
2868
 
2980
2869
  assert_equal original_filename, engine.options[:original_filename]
@@ -3209,7 +3098,6 @@ SASS
3209
3098
 
3210
3099
  def render(sass, options = {})
3211
3100
  munge_filename options
3212
- options[:importer] ||= MockImporter.new
3213
3101
  Sass::Engine.new(sass, options).render
3214
3102
  end
3215
3103