sass 3.4.25 → 3.5.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +13 -157
  5. data/VERSION +1 -1
  6. data/VERSION_DATE +1 -1
  7. data/VERSION_NAME +1 -1
  8. data/lib/sass.rb +3 -10
  9. data/lib/sass/cache_stores/filesystem.rb +1 -1
  10. data/lib/sass/css.rb +2 -3
  11. data/lib/sass/engine.rb +46 -32
  12. data/lib/sass/environment.rb +27 -6
  13. data/lib/sass/error.rb +5 -5
  14. data/lib/sass/exec/base.rb +3 -12
  15. data/lib/sass/features.rb +1 -0
  16. data/lib/sass/importers/filesystem.rb +2 -2
  17. data/lib/sass/plugin.rb +1 -1
  18. data/lib/sass/plugin/compiler.rb +21 -51
  19. data/lib/sass/plugin/configuration.rb +1 -1
  20. data/lib/sass/plugin/rack.rb +3 -3
  21. data/lib/sass/plugin/staleness_checker.rb +3 -3
  22. data/lib/sass/railtie.rb +1 -1
  23. data/lib/sass/script.rb +3 -3
  24. data/lib/sass/script/functions.rb +238 -47
  25. data/lib/sass/script/lexer.rb +8 -6
  26. data/lib/sass/script/parser.rb +76 -75
  27. data/lib/sass/script/tree/funcall.rb +35 -30
  28. data/lib/sass/script/tree/list_literal.rb +23 -8
  29. data/lib/sass/script/tree/map_literal.rb +2 -2
  30. data/lib/sass/script/tree/node.rb +2 -10
  31. data/lib/sass/script/tree/operation.rb +16 -50
  32. data/lib/sass/script/value.rb +2 -0
  33. data/lib/sass/script/value/arg_list.rb +1 -1
  34. data/lib/sass/script/value/base.rb +20 -3
  35. data/lib/sass/script/value/callable.rb +25 -0
  36. data/lib/sass/script/value/color.rb +10 -10
  37. data/lib/sass/script/value/function.rb +19 -0
  38. data/lib/sass/script/value/helpers.rb +16 -7
  39. data/lib/sass/script/value/list.rb +33 -12
  40. data/lib/sass/script/value/map.rb +2 -2
  41. data/lib/sass/script/value/number.rb +3 -3
  42. data/lib/sass/script/value/string.rb +12 -5
  43. data/lib/sass/scss/parser.rb +101 -45
  44. data/lib/sass/scss/rx.rb +5 -11
  45. data/lib/sass/scss/static_parser.rb +0 -7
  46. data/lib/sass/selector.rb +4 -0
  47. data/lib/sass/selector/abstract_sequence.rb +5 -5
  48. data/lib/sass/selector/comma_sequence.rb +3 -15
  49. data/lib/sass/selector/pseudo.rb +4 -0
  50. data/lib/sass/selector/sequence.rb +30 -3
  51. data/lib/sass/selector/simple.rb +13 -7
  52. data/lib/sass/selector/simple_sequence.rb +1 -1
  53. data/lib/sass/shared.rb +3 -5
  54. data/lib/sass/source/map.rb +4 -4
  55. data/lib/sass/source/position.rb +4 -4
  56. data/lib/sass/stack.rb +21 -1
  57. data/lib/sass/tree/charset_node.rb +1 -1
  58. data/lib/sass/tree/comment_node.rb +1 -1
  59. data/lib/sass/tree/node.rb +3 -3
  60. data/lib/sass/tree/prop_node.rb +46 -54
  61. data/lib/sass/tree/rule_node.rb +7 -15
  62. data/lib/sass/tree/visitors/check_nesting.rb +1 -1
  63. data/lib/sass/tree/visitors/convert.rb +2 -3
  64. data/lib/sass/tree/visitors/cssize.rb +1 -10
  65. data/lib/sass/tree/visitors/deep_copy.rb +2 -2
  66. data/lib/sass/tree/visitors/perform.rb +23 -12
  67. data/lib/sass/tree/visitors/set_options.rb +1 -1
  68. data/lib/sass/tree/visitors/to_css.rb +46 -12
  69. data/lib/sass/util.rb +16 -321
  70. data/lib/sass/util/multibyte_string_scanner.rb +127 -131
  71. data/lib/sass/util/normalized_map.rb +1 -8
  72. data/lib/sass/version.rb +2 -2
  73. data/test/sass-spec.yml +1 -1
  74. data/test/sass/compiler_test.rb +4 -14
  75. data/test/sass/conversion_test.rb +113 -162
  76. data/test/sass/css2sass_test.rb +17 -19
  77. data/test/sass/css_variable_test.rb +176 -70
  78. data/test/sass/encoding_test.rb +2 -32
  79. data/test/sass/engine_test.rb +114 -65
  80. data/test/sass/extend_test.rb +37 -51
  81. data/test/sass/functions_test.rb +57 -15
  82. data/test/sass/importer_test.rb +2 -2
  83. data/test/sass/more_templates/more1.sass +10 -10
  84. data/test/sass/more_templates/more_import.sass +2 -2
  85. data/test/sass/plugin_test.rb +9 -12
  86. data/test/sass/script_conversion_test.rb +9 -0
  87. data/test/sass/script_test.rb +38 -48
  88. data/test/sass/scss/css_test.rb +5 -19
  89. data/test/sass/scss/scss_test.rb +58 -39
  90. data/test/sass/source_map_test.rb +26 -28
  91. data/test/sass/templates/_partial.sass +1 -1
  92. data/test/sass/templates/basic.sass +10 -10
  93. data/test/sass/templates/bork1.sass +1 -1
  94. data/test/sass/templates/bork5.sass +1 -1
  95. data/test/sass/templates/compact.sass +10 -10
  96. data/test/sass/templates/complex.sass +187 -187
  97. data/test/sass/templates/compressed.sass +10 -10
  98. data/test/sass/templates/expanded.sass +10 -10
  99. data/test/sass/templates/import.sass +2 -2
  100. data/test/sass/templates/importee.sass +3 -3
  101. data/test/sass/templates/mixins.sass +22 -22
  102. data/test/sass/templates/multiline.sass +4 -4
  103. data/test/sass/templates/nested.sass +13 -13
  104. data/test/sass/templates/parent_ref.sass +12 -12
  105. data/test/sass/templates/script.sass +70 -70
  106. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  107. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  108. data/test/sass/templates/subdir/subdir.sass +3 -3
  109. data/test/sass/templates/units.sass +10 -10
  110. data/test/sass/util/multibyte_string_scanner_test.rb +139 -149
  111. data/test/sass/util_test.rb +0 -36
  112. data/test/test_helper.rb +39 -0
  113. metadata +30 -57
  114. data/extra/sass-spec-ref.sh +0 -32
  115. data/lib/sass/deprecation.rb +0 -55
  116. data/lib/sass/script/css_variable_warning.rb +0 -52
  117. data/lib/sass/util/cross_platform_random.rb +0 -19
  118. data/lib/sass/util/ordered_hash.rb +0 -192
  119. data/test/sass/results/import_charset_1_8.css +0 -5
  120. data/test/sass/templates/import_charset_1_8.sass +0 -6
  121. data/vendor/listen/CHANGELOG.md +0 -1
  122. data/vendor/listen/CONTRIBUTING.md +0 -38
  123. data/vendor/listen/Gemfile +0 -20
  124. data/vendor/listen/Guardfile +0 -8
  125. data/vendor/listen/LICENSE +0 -20
  126. data/vendor/listen/README.md +0 -349
  127. data/vendor/listen/Rakefile +0 -5
  128. data/vendor/listen/Vagrantfile +0 -96
  129. data/vendor/listen/lib/listen.rb +0 -54
  130. data/vendor/listen/lib/listen/adapter.rb +0 -327
  131. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  132. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  133. data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  134. data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  135. data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  136. data/vendor/listen/lib/listen/directory_record.rb +0 -406
  137. data/vendor/listen/lib/listen/listener.rb +0 -323
  138. data/vendor/listen/lib/listen/turnstile.rb +0 -32
  139. data/vendor/listen/lib/listen/version.rb +0 -3
  140. data/vendor/listen/listen.gemspec +0 -28
  141. data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  142. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  143. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  144. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  145. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  146. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  147. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  148. data/vendor/listen/spec/listen/listener_spec.rb +0 -258
  149. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  150. data/vendor/listen/spec/listen_spec.rb +0 -67
  151. data/vendor/listen/spec/spec_helper.rb +0 -25
  152. data/vendor/listen/spec/support/adapter_helper.rb +0 -666
  153. data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  154. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  155. data/vendor/listen/spec/support/listeners_helper.rb +0 -179
  156. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -21,7 +21,9 @@ module Sass::Script::Functions
21
21
  declare :only_kw_args, [], :var_kwargs => true
22
22
 
23
23
  def deprecated_arg_fn(arg1, arg2, arg3 = nil)
24
- Sass::Script::Value::List.new([arg1, arg2, arg3 || Sass::Script::Value::Null.new], :space)
24
+ Sass::Script::Value::List.new(
25
+ [arg1, arg2, arg3 || Sass::Script::Value::Null.new],
26
+ separator: :space)
25
27
  end
26
28
  declare :deprecated_arg_fn, [:arg1, :arg2, :arg3], :deprecated => [:arg_1, :arg_2, :arg3]
27
29
  declare :deprecated_arg_fn, [:arg1, :arg2], :deprecated => [:arg_1, :arg_2]
@@ -876,12 +878,22 @@ WARNING
876
878
 
877
879
  def test_invert
878
880
  assert_equal("#112233", evaluate("invert(#edc)"))
881
+ assert_equal("#d8cabd", evaluate("invert(#edc, 10%)"))
879
882
  assert_equal("rgba(245, 235, 225, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5))"))
883
+ assert_equal("rgba(34, 42, 50, 0.5)", evaluate("invert(rgba(10, 20, 30, 0.5), 10%)"))
880
884
  assert_equal("invert(20%)", evaluate("invert(20%)"))
881
885
  end
882
886
 
883
887
  def test_invert_tests_types
884
888
  assert_error_message("$color: \"foo\" is not a color for `invert'", "invert(\"foo\")")
889
+ assert_error_message("$weight: \"foo\" is not a number for `invert'", "invert(#edc, \"foo\")")
890
+ end
891
+
892
+ def test_invert_tests_bounds
893
+ assert_error_message("Weight -0.001 must be between 0% and 100% for `invert'",
894
+ "invert(#edc, -0.001)")
895
+ assert_error_message("Weight 100.001 must be between 0% and 100% for `invert'",
896
+ "invert(#edc, 100.001)")
885
897
  end
886
898
 
887
899
  def test_unquote
@@ -891,6 +903,7 @@ WARNING
891
903
  assert_warning <<MESSAGE do
892
904
  DEPRECATION WARNING: Passing blue, a non-string value, to unquote()
893
905
  will be an error in future versions of Sass.
906
+ on line 1 of test_unquote_inline.scss
894
907
  MESSAGE
895
908
  assert_equal('blue', evaluate('unquote(blue)'))
896
909
  end
@@ -1467,30 +1480,56 @@ SCSS
1467
1480
  end
1468
1481
 
1469
1482
  def test_call_with_positional_arguments
1470
- assert_equal evaluate("lighten(blue, 5%)"), evaluate("call(lighten, blue, 5%)")
1483
+ # TODO: Remove this block in 4.0
1484
+ Sass::Util.silence_sass_warnings do
1485
+ assert_equal evaluate("lighten(blue, 5%)"), evaluate("call(lighten, blue, 5%)")
1486
+ end
1487
+ assert_equal evaluate("lighten(blue, 5%)"), evaluate("call(get-function(lighten), blue, 5%)")
1471
1488
  end
1472
1489
 
1473
1490
  def test_call_with_keyword_arguments
1491
+ # TODO: Remove this block in 4.0
1492
+ Sass::Util.silence_sass_warnings do
1493
+ assert_equal(
1494
+ evaluate("lighten($color: blue, $amount: 5%)"),
1495
+ evaluate("call(lighten, $color: blue, $amount: 5%)"))
1496
+ end
1474
1497
  assert_equal(
1475
1498
  evaluate("lighten($color: blue, $amount: 5%)"),
1476
- evaluate("call(lighten, $color: blue, $amount: 5%)"))
1499
+ evaluate("call(get-function(lighten), $color: blue, $amount: 5%)"))
1477
1500
  end
1478
1501
 
1479
1502
  def test_call_with_keyword_and_positional_arguments
1503
+ # TODO: Remove this block in 4.0
1504
+ Sass::Util.silence_sass_warnings do
1505
+ assert_equal(
1506
+ evaluate("lighten(blue, $amount: 5%)"),
1507
+ evaluate("call(lighten, blue, $amount: 5%)"))
1508
+ end
1480
1509
  assert_equal(
1481
1510
  evaluate("lighten(blue, $amount: 5%)"),
1482
- evaluate("call(lighten, blue, $amount: 5%)"))
1511
+ evaluate("call(get-function(lighten), blue, $amount: 5%)"))
1483
1512
  end
1484
1513
 
1485
1514
  def test_call_with_dynamic_name
1515
+ # TODO: Remove this block in 4.0
1516
+ Sass::Util.silence_sass_warnings do
1517
+ assert_equal(
1518
+ evaluate("lighten($color: blue, $amount: 5%)"),
1519
+ evaluate("call($fn, $color: blue, $amount: 5%)",
1520
+ env("fn" => Sass::Script::Value::String.new("lighten"))))
1521
+ end
1486
1522
  assert_equal(
1487
1523
  evaluate("lighten($color: blue, $amount: 5%)"),
1488
1524
  evaluate("call($fn, $color: blue, $amount: 5%)",
1489
- env("fn" => Sass::Script::String.new("lighten"))))
1525
+ env("fn" => Sass::Script::Value::Function.new(
1526
+ Sass::Callable.new("lighten", nil, nil, nil, nil, nil, "function", :builtin)))))
1490
1527
  end
1491
1528
 
1529
+ # TODO: Remove this test in 4.0
1492
1530
  def test_call_uses_local_scope
1493
- assert_equal <<CSS, render(<<SCSS)
1531
+ Sass::Util.silence_sass_warnings do
1532
+ assert_equal <<CSS, render(<<SCSS)
1494
1533
  .first-scope {
1495
1534
  a: local; }
1496
1535
 
@@ -1508,18 +1547,24 @@ CSS
1508
1547
  a: call(foo);
1509
1548
  }
1510
1549
  SCSS
1550
+ end
1511
1551
  end
1512
1552
 
1513
1553
  def test_call_unknown_function
1514
- assert_equal evaluate("unknown(red, blue)"), evaluate("call(unknown, red, blue)")
1554
+ # TODO: Remove this block in 4.0
1555
+ Sass::Util.silence_sass_warnings do
1556
+ assert_equal evaluate("unknown(red, blue)"), evaluate("call(unknown, red, blue)")
1557
+ end
1558
+ assert_equal evaluate("unknown(red, blue)"), evaluate("call(get-function(unknown, $css: true), red, blue)")
1515
1559
  end
1516
1560
 
1517
1561
  def test_call_with_non_string_argument
1518
- assert_error_message "$name: 3px is not a string for `call'", "call(3px)"
1562
+ assert_error_message "$function: 3px is not a function for `call'", "call(3px)"
1519
1563
  end
1520
1564
 
1521
1565
  def test_errors_in_called_function
1522
- assert_error_message "$color: 3px is not a color for `lighten'", "call(lighten, 3px, 5%)"
1566
+ assert_error_message "$color: 3px is not a color for `lighten'",
1567
+ "call(get-function(lighten), 3px, 5%)"
1523
1568
  end
1524
1569
 
1525
1570
  def test_variable_exists
@@ -1841,11 +1886,8 @@ WARNING
1841
1886
  assert_equal(".bar", evaluate("selector-replace('.foo', '.foo', '.bar')"))
1842
1887
  assert_equal(".foo.baz", evaluate("selector-replace('.foo.bar', '.bar', '.baz')"))
1843
1888
  assert_equal(".a .foo.baz", evaluate("selector-replace('.foo.bar', '.bar', '.a .baz')"))
1844
-
1845
- # These shouldn't warn since we still support componud targets for selector
1846
- # functions.
1847
- assert_no_warning {assert_equal(".foo.bar", evaluate("selector-replace('.foo.bar', '.baz.bar', '.qux')"))}
1848
- assert_no_warning {assert_equal(".bar.qux", evaluate("selector-replace('.foo.bar.baz', '.foo.baz', '.qux')"))}
1889
+ assert_equal(".foo.bar", evaluate("selector-replace('.foo.bar', '.baz.bar', '.qux')"))
1890
+ assert_equal(".bar.qux", evaluate("selector-replace('.foo.bar.baz', '.foo.baz', '.qux')"))
1849
1891
 
1850
1892
  assert_equal(":not(.bar)", evaluate("selector-replace(':not(.foo)', '.foo', '.bar')"))
1851
1893
  assert_equal(".bar", evaluate("selector-replace(':not(.foo)', ':not(.foo)', '.bar')"))
@@ -1958,7 +2000,7 @@ WARNING
1958
2000
  end
1959
2001
 
1960
2002
  def perform(value, environment = env)
1961
- Sass::Script::Parser.parse(value, 0, 0).perform(environment)
2003
+ Sass::Script::Parser.parse(value, 1, 0, {:filename => "#{test_name}_inline.scss"}).perform(environment)
1962
2004
  end
1963
2005
 
1964
2006
  def render(sass, options = {})
@@ -282,7 +282,7 @@ SCSS
282
282
 
283
283
  _, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
284
284
 
285
- uri = Sass::Util.file_uri_from_path(Sass::Util.absolute_path(filename_for_test(:scss)))
285
+ uri = Sass::Util.file_uri_from_path(File.absolute_path(filename_for_test(:scss)))
286
286
  assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => 'css_uri')
287
287
  {
288
288
  "version": 3,
@@ -309,7 +309,7 @@ SCSS
309
309
 
310
310
  _, sourcemap = engine.render_with_sourcemap('http://1.example.com/style.map')
311
311
 
312
- uri = Sass::Util.file_uri_from_path(Sass::Util.absolute_path(filename_for_test(:scss)))
312
+ uri = Sass::Util.file_uri_from_path(File.absolute_path(filename_for_test(:scss)))
313
313
  assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => 'css_uri', :css_path => 'css_path')
314
314
  {
315
315
  "version": 3,
@@ -1,23 +1,23 @@
1
1
 
2
2
 
3
3
  body
4
- font: Arial
5
- background: blue
4
+ :font Arial
5
+ :background blue
6
6
 
7
7
  #page
8
- width: 700px
9
- height: 100
8
+ :width 700px
9
+ :height 100
10
10
  #header
11
- height: 300px
11
+ :height 300px
12
12
  h1
13
- font-size: 50px
14
- color: blue
13
+ :font-size 50px
14
+ :color blue
15
15
 
16
16
  #content.user.show
17
17
  #container.top
18
18
  #column.left
19
- width: 100px
19
+ :width 100px
20
20
  #column.right
21
- width: 600px
21
+ :width 600px
22
22
  #container.bottom
23
- background: brown
23
+ :background brown
@@ -6,6 +6,6 @@ $preconst: hello
6
6
  @import importee, basic, basic.css, ../results/complex.css, more_partial
7
7
 
8
8
  nonimported
9
- myconst: $preconst
10
- otherconst: $postconst
9
+ :myconst $preconst
10
+ :otherconst $postconst
11
11
  +postmixin
@@ -21,10 +21,9 @@ class SassPluginTest < MiniTest::Test
21
21
  @@templates = %w{
22
22
  complex script parent_ref import scss_import alt
23
23
  subdir/subdir subdir/nested_subdir/nested_subdir
24
- options import_content filename_fn
24
+ options import_content filename_fn import_charset
25
+ import_charset_ibm866
25
26
  }
26
- @@templates += %w[import_charset import_charset_ibm866] unless Sass::Util.ruby1_8?
27
- @@templates << 'import_charset_1_8' if Sass::Util.ruby1_8?
28
27
 
29
28
  @@cache_store = Sass::CacheStores::Memory.new
30
29
 
@@ -45,7 +44,7 @@ class SassPluginTest < MiniTest::Test
45
44
 
46
45
  @@templates.each do |name|
47
46
  define_method("test_template_renders_correctly (#{name})") do
48
- silence_warnings {assert_renders_correctly(name)}
47
+ assert_renders_correctly(name)
49
48
  end
50
49
  end
51
50
 
@@ -117,7 +116,7 @@ Error: Undefined variable: "$bork".
117
116
  on line 2 of #{template_loc('bork1')}
118
117
 
119
118
  1: bork
120
- 2: bork: $bork
119
+ 2: :bork $bork
121
120
  CSS
122
121
  end
123
122
  File.delete(tempfile_loc('bork1'))
@@ -134,7 +133,7 @@ Error: Undefined variable: "$bork".
134
133
 
135
134
  1: bork
136
135
  2: /* foo *\\/
137
- 3: bork: $bork
136
+ 3: :bork $bork
138
137
  CSS
139
138
  end
140
139
  File.delete(tempfile_loc('bork1'))
@@ -396,15 +395,13 @@ WARNING
396
395
 
397
396
  expected_str = File.read(result_loc(result_name, prefix))
398
397
  actual_str = File.read(tempfile_loc(tempfile_name, prefix))
399
- unless Sass::Util.ruby1_8?
400
- expected_str = expected_str.force_encoding('IBM866') if result_name == 'import_charset_ibm866'
401
- actual_str = actual_str.force_encoding('IBM866') if tempfile_name == 'import_charset_ibm866'
402
- end
398
+ expected_str = expected_str.force_encoding('IBM866') if result_name == 'import_charset_ibm866'
399
+ actual_str = actual_str.force_encoding('IBM866') if tempfile_name == 'import_charset_ibm866'
403
400
  expected_lines = expected_str.split("\n")
404
401
  actual_lines = actual_str.split("\n")
405
402
 
406
403
  if actual_lines.first == "/*" && expected_lines.first != "/*"
407
- assert(false, actual_lines[0..Sass::Util.enum_with_index(actual_lines).find {|l, i| l == "*/"}.last].join("\n"))
404
+ assert(false, actual_lines[0..actual_lines.each_with_index.find {|l, i| l == "*/"}.last].join("\n"))
408
405
  end
409
406
 
410
407
  expected_lines.zip(actual_lines).each_with_index do |pair, line|
@@ -423,7 +420,7 @@ WARNING
423
420
  expected_lines = File.read(result_loc(name)).split("\n")
424
421
  actual_lines = File.read(tempfile_loc(name)).split("\n")
425
422
  if actual_lines.first == "/*" && expected_lines.first != "/*"
426
- assert(false, actual_lines[0..actual_lines.enum_with_index.find {|l, i| l == "*/"}.last].join("\n"))
423
+ assert(false, actual_lines[0..actual_lines.each_with_index.find {|l, i| l == "*/"}.last].join("\n"))
427
424
  end
428
425
  end
429
426
 
@@ -343,6 +343,15 @@ RUBY
343
343
  assert_equal '"foo#{$bar}baz"', render("'foo\#{$bar}baz'")
344
344
  end
345
345
 
346
+ def test_bracketed_lists
347
+ assert_renders("[]")
348
+ assert_renders("[foo, bar]")
349
+ assert_renders("[[foo]]")
350
+ assert_renders("[(foo bar)]")
351
+ assert_renders("[foo bar,]")
352
+ assert_renders("[(foo,)]")
353
+ end
354
+
346
355
  private
347
356
 
348
357
  def assert_renders(script, options = {})
@@ -78,7 +78,7 @@ class SassScriptTest < MiniTest::Test
78
78
  def test_color_names
79
79
  assert_equal "white", resolve("white")
80
80
  assert_equal "#ffffff", resolve("#ffffff")
81
- silence_warnings {assert_equal "#fffffe", resolve("white - #000001")}
81
+ assert_equal "#fffffe", resolve("white - #000001")
82
82
  assert_equal "transparent", resolve("transparent")
83
83
  assert_equal "transparent", resolve("rgba(0, 0, 0, 0)")
84
84
  end
@@ -97,23 +97,23 @@ class SassScriptTest < MiniTest::Test
97
97
  end
98
98
 
99
99
  def test_rgba_color_math
100
- silence_warnings {assert_equal "rgba(50, 50, 100, 0.35)", resolve("rgba(1, 1, 2, 0.35) * rgba(50, 50, 50, 0.35)")}
101
- silence_warnings {assert_equal "rgba(52, 52, 52, 0.25)", resolve("rgba(2, 2, 2, 0.25) + rgba(50, 50, 50, 0.25)")}
100
+ assert_equal "rgba(50, 50, 100, 0.35)", resolve("rgba(1, 1, 2, 0.35) * rgba(50, 50, 50, 0.35)")
101
+ assert_equal "rgba(52, 52, 52, 0.25)", resolve("rgba(2, 2, 2, 0.25) + rgba(50, 50, 50, 0.25)")
102
102
 
103
103
  assert_raise_message(Sass::SyntaxError, "Alpha channels must be equal: rgba(1, 2, 3, 0.15) + rgba(50, 50, 50, 0.75)") do
104
- silence_warnings {resolve("rgba(1, 2, 3, 0.15) + rgba(50, 50, 50, 0.75)")}
104
+ resolve("rgba(1, 2, 3, 0.15) + rgba(50, 50, 50, 0.75)")
105
105
  end
106
106
  assert_raise_message(Sass::SyntaxError, "Alpha channels must be equal: #123456 * rgba(50, 50, 50, 0.75)") do
107
- silence_warnings {resolve("#123456 * rgba(50, 50, 50, 0.75)")}
107
+ resolve("#123456 * rgba(50, 50, 50, 0.75)")
108
108
  end
109
109
  assert_raise_message(Sass::SyntaxError, "Alpha channels must be equal: rgba(50, 50, 50, 0.75) / #123456") do
110
- silence_warnings {resolve("rgba(50, 50, 50, 0.75) / #123456")}
110
+ resolve("rgba(50, 50, 50, 0.75) / #123456")
111
111
  end
112
112
  end
113
113
 
114
114
  def test_rgba_number_math
115
- silence_warnings {assert_equal "rgba(49, 49, 49, 0.75)", resolve("rgba(50, 50, 50, 0.75) - 1")}
116
- silence_warnings {assert_equal "rgba(100, 100, 100, 0.75)", resolve("rgba(50, 50, 50, 0.75) * 2")}
115
+ assert_equal "rgba(49, 49, 49, 0.75)", resolve("rgba(50, 50, 50, 0.75) - 1")
116
+ assert_equal "rgba(100, 100, 100, 0.75)", resolve("rgba(50, 50, 50, 0.75) * 2")
117
117
  end
118
118
 
119
119
  def test_rgba_rounding
@@ -284,10 +284,10 @@ SASS
284
284
  end
285
285
 
286
286
  def test_adding_functions_directly_to_functions_module
287
- assert !Functions.callable?('nonexistant')
288
- Functions.class_eval { def nonexistant; end }
289
- assert Functions.callable?('nonexistant')
290
- Functions.send :remove_method, :nonexistant
287
+ assert !Functions.callable?('nonexistent')
288
+ Functions.class_eval { def nonexistent; end }
289
+ assert Functions.callable?('nonexistent')
290
+ Functions.send :remove_method, :nonexistent
291
291
  end
292
292
 
293
293
  def test_default_functions
@@ -504,7 +504,7 @@ SASS
504
504
 
505
505
  def test_functions
506
506
  assert_equal "#80ff80", resolve("hsl(120, 100%, 75%)")
507
- silence_warnings {assert_equal "#81ff81", resolve("hsl(120, 100%, 75%) + #010001")}
507
+ assert_equal "#81ff81", resolve("hsl(120, 100%, 75%) + #010001")
508
508
  end
509
509
 
510
510
  def test_operator_unit_conversion
@@ -518,19 +518,17 @@ SASS
518
518
  assert_equal "true", resolve("2mm == 8q")
519
519
  assert_equal "false", resolve("2px > 3q")
520
520
 
521
- Sass::Deprecation.allow_double_warnings do
522
- assert_warning(<<WARNING) {assert_equal "true", resolve("1 == 1cm")}
521
+ assert_warning(<<WARNING) {assert_equal "true", resolve("1 == 1cm")}
523
522
  DEPRECATION WARNING on line 1 of test_operator_unit_conversion_inline.sass:
524
523
  The result of `1 == 1cm` will be `false` in future releases of Sass.
525
524
  Unitless numbers will no longer be equal to the same numbers with units.
526
525
  WARNING
527
526
 
528
- assert_warning(<<WARNING) {assert_equal "false", resolve("1 != 1cm")}
527
+ assert_warning(<<WARNING) {assert_equal "false", resolve("1 != 1cm")}
529
528
  DEPRECATION WARNING on line 1 of test_operator_unit_conversion_inline.sass:
530
529
  The result of `1 != 1cm` will be `true` in future releases of Sass.
531
530
  Unitless numbers will no longer be equal to the same numbers with units.
532
531
  WARNING
533
- end
534
532
  end
535
533
 
536
534
  def test_length_units
@@ -560,9 +558,9 @@ WARNING
560
558
  end
561
559
 
562
560
  def test_resolution_units
563
- assert_equal "0.3937", resolve("(1dpi/1dpcm)")
564
- assert_equal "0.02646", resolve("(1dpcm/1dppx)")
565
- assert_equal "96", resolve("(1dppx/1dpi)")
561
+ assert_equal "2.54", resolve("(1dpi/1dpcm)")
562
+ assert_equal "37.79528", resolve("(1dpcm/1dppx)")
563
+ assert_equal "0.01042", resolve("(1dppx/1dpi)")
566
564
  end
567
565
 
568
566
  def test_operations_have_options
@@ -990,7 +988,7 @@ SCSS
990
988
  end
991
989
 
992
990
  def test_color_format_isnt_preserved_when_modified
993
- assert_equal "magenta", resolve("change-color(#f00, $blue: 255)")
991
+ assert_equal "magenta", resolve("#f00 + #00f")
994
992
  end
995
993
 
996
994
  def test_ids
@@ -1134,9 +1132,8 @@ SASS
1134
1132
  assert_equal "#2", resolve('"##{1 + 1}"')
1135
1133
  end
1136
1134
 
1137
- def test_misplaced_comma_in_funcall
1138
- assert_raise_message(Sass::SyntaxError,
1139
- 'Invalid CSS after "foo(bar, ": expected function argument, was ")"') {eval('foo(bar, )')}
1135
+ def test_func_call_arglist_trailing_comma
1136
+ assert_equal eval('foo(bar)'), eval('foo(bar, )')
1140
1137
  end
1141
1138
 
1142
1139
  def test_color_prefixed_identifier
@@ -1309,37 +1306,32 @@ SASS
1309
1306
  end
1310
1307
 
1311
1308
  def test_active_lazy_interpolation_deprecation_warning
1312
- Sass::Deprecation.allow_double_warnings do
1313
- assert_equal "1, 2, 3", resolve_with_lazy_interp_warning('quote((1, #{2}, 3))', '"1, 2, 3"')
1314
- assert_equal "1", resolve_with_lazy_interp_warning('length((1, #{2}, 3))', '"1, 2, 3"')
1315
- assert_equal "1, 2, 3", resolve_with_lazy_interp_warning('inspect((1, #{2}, 3))', '"1, 2, 3"')
1316
- assert_equal "string", resolve_with_lazy_interp_warning('type-of((1, #{2}, 3))', '"1, 2, 3"')
1317
-
1318
- assert_equal "+1 2 3", resolve_with_lazy_interp_warning('quote((+#{1} 2 3))', '"+1 #{2 3}"')
1319
- assert_equal "/1 2 3", resolve_with_lazy_interp_warning('quote((/#{1} 2 3))', '"/1 #{2 3}"')
1320
- assert_equal "-1 2 3", resolve_with_lazy_interp_warning('quote((-#{1} 2 3))', '"-1 #{2 3}"')
1321
- end
1309
+ assert_equal "1, 2, 3", resolve_with_lazy_interp_warning('quote((1, #{2}, 3))', '"1, 2, 3"')
1310
+ assert_equal "1", resolve_with_lazy_interp_warning('length((1, #{2}, 3))', '"1, 2, 3"')
1311
+ assert_equal "1, 2, 3", resolve_with_lazy_interp_warning('inspect((1, #{2}, 3))', '"1, 2, 3"')
1312
+ assert_equal "string", resolve_with_lazy_interp_warning('type-of((1, #{2}, 3))', '"1, 2, 3"')
1313
+
1314
+ assert_equal "+1 2 3", resolve_with_lazy_interp_warning('quote((+#{1} 2 3))', '"+1 #{2 3}"')
1315
+ assert_equal "/1 2 3", resolve_with_lazy_interp_warning('quote((/#{1} 2 3))', '"/1 #{2 3}"')
1316
+ assert_equal "-1 2 3", resolve_with_lazy_interp_warning('quote((-#{1} 2 3))', '"-1 #{2 3}"')
1322
1317
  end
1323
1318
 
1324
1319
  def test_comparison_of_complex_units
1325
1320
  # Tests for issue #1960
1326
- Sass::Deprecation.allow_double_warnings do
1327
- assert_warning(<<WARNING) do
1321
+ assert_warning(<<WARNING) do
1328
1322
  DEPRECATION WARNING on line 1 of test_comparison_of_complex_units_inline.sass:
1329
1323
  The result of `10 == 10px` will be `false` in future releases of Sass.
1330
1324
  Unitless numbers will no longer be equal to the same numbers with units.
1331
1325
  WARNING
1332
- assert_equal "true", resolve("10 == 2 * 5px")
1333
- end
1334
- assert_warning(<<WARNING) do
1326
+ assert_equal "true", resolve("10 == 2 * 5px")
1327
+ end
1328
+ assert_warning(<<WARNING) do
1335
1329
  DEPRECATION WARNING on line 1 of test_comparison_of_complex_units_inline.sass:
1336
1330
  The result of `10 == 10px*px` will be `false` in future releases of Sass.
1337
1331
  Unitless numbers will no longer be equal to the same numbers with units.
1338
1332
  WARNING
1339
- assert_equal "true", resolve("10 == 2px * 5px")
1340
- end
1333
+ assert_equal "true", resolve("10 == 2px * 5px")
1341
1334
  end
1342
-
1343
1335
  assert_equal "true", resolve("10px * 1px == 2px * 5px")
1344
1336
  assert_equal "true", resolve("5px * 1px < 2px * 5px")
1345
1337
  end
@@ -1349,9 +1341,8 @@ WARNING
1349
1341
  def resolve_with_lazy_interp_warning(str, contents = nil, environment = env)
1350
1342
  contents ||= "\"#{str}\""
1351
1343
  result = assert_warning(<<WARNING) {resolve(str, {}, environment)}
1352
- DEPRECATION WARNING on line 1 of #{filename_for_test}:
1353
- \#{} interpolation near operators will be simplified in a future version of Sass.
1354
- To preserve the current behavior, use quotes:
1344
+ DEPRECATION WARNING on line 1 of #{filename_for_test}: \#{} interpolation near operators will be simplified
1345
+ in a future version of Sass. To preserve the current behavior, use quotes:
1355
1346
 
1356
1347
  unquote(#{contents})
1357
1348
  WARNING
@@ -1362,9 +1353,8 @@ WARNING
1362
1353
  def resolve_with_interp_warning(str, contents = nil, environment = env)
1363
1354
  contents ||= "\"#{str}\""
1364
1355
  assert_warning(<<WARNING) {resolve(str, {}, environment)}
1365
- DEPRECATION WARNING on line 1 of #{filename_for_test}:
1366
- \#{} interpolation near operators will be simplified in a future version of Sass.
1367
- To preserve the current behavior, use quotes:
1356
+ DEPRECATION WARNING on line 1 of #{filename_for_test}: \#{} interpolation near operators will be simplified
1357
+ in a future version of Sass. To preserve the current behavior, use quotes:
1368
1358
 
1369
1359
  unquote(#{contents})
1370
1360