sass 3.4.25 → 3.5.0

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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +2 -117
  4. data/VERSION +1 -1
  5. data/VERSION_DATE +1 -1
  6. data/VERSION_NAME +1 -1
  7. data/lib/sass/cache_stores/filesystem.rb +1 -1
  8. data/lib/sass/css.rb +1 -2
  9. data/lib/sass/engine.rb +38 -20
  10. data/lib/sass/environment.rb +26 -5
  11. data/lib/sass/error.rb +2 -2
  12. data/lib/sass/exec/base.rb +2 -11
  13. data/lib/sass/features.rb +1 -0
  14. data/lib/sass/importers/filesystem.rb +2 -2
  15. data/lib/sass/plugin/compiler.rb +20 -50
  16. data/lib/sass/plugin/configuration.rb +2 -2
  17. data/lib/sass/railtie.rb +1 -1
  18. data/lib/sass/script/functions.rb +235 -43
  19. data/lib/sass/script/lexer.rb +13 -2
  20. data/lib/sass/script/parser.rb +69 -67
  21. data/lib/sass/script/tree/funcall.rb +35 -30
  22. data/lib/sass/script/tree/list_literal.rb +23 -8
  23. data/lib/sass/script/tree/map_literal.rb +2 -2
  24. data/lib/sass/script/tree/node.rb +0 -8
  25. data/lib/sass/script/tree/operation.rb +0 -7
  26. data/lib/sass/script/value/arg_list.rb +1 -1
  27. data/lib/sass/script/value/base.rb +17 -0
  28. data/lib/sass/script/value/callable.rb +25 -0
  29. data/lib/sass/script/value/color.rb +5 -0
  30. data/lib/sass/script/value/function.rb +19 -0
  31. data/lib/sass/script/value/helpers.rb +29 -9
  32. data/lib/sass/script/value/list.rb +35 -14
  33. data/lib/sass/script/value/map.rb +2 -2
  34. data/lib/sass/script/value/number.rb +1 -1
  35. data/lib/sass/script/value.rb +2 -0
  36. data/lib/sass/scss/parser.rb +99 -40
  37. data/lib/sass/scss/rx.rb +4 -10
  38. data/lib/sass/scss/static_parser.rb +5 -24
  39. data/lib/sass/selector/abstract_sequence.rb +7 -6
  40. data/lib/sass/selector/comma_sequence.rb +7 -4
  41. data/lib/sass/selector/pseudo.rb +19 -2
  42. data/lib/sass/selector/sequence.rb +35 -6
  43. data/lib/sass/selector/simple.rb +9 -2
  44. data/lib/sass/selector/simple_sequence.rb +8 -4
  45. data/lib/sass/selector.rb +4 -0
  46. data/lib/sass/source/map.rb +2 -2
  47. data/lib/sass/stack.rb +21 -1
  48. data/lib/sass/tree/charset_node.rb +1 -1
  49. data/lib/sass/tree/prop_node.rb +45 -53
  50. data/lib/sass/tree/rule_node.rb +3 -2
  51. data/lib/sass/tree/visitors/check_nesting.rb +1 -1
  52. data/lib/sass/tree/visitors/convert.rb +2 -3
  53. data/lib/sass/tree/visitors/cssize.rb +4 -15
  54. data/lib/sass/tree/visitors/deep_copy.rb +1 -1
  55. data/lib/sass/tree/visitors/extend.rb +2 -8
  56. data/lib/sass/tree/visitors/perform.rb +21 -9
  57. data/lib/sass/tree/visitors/set_options.rb +1 -1
  58. data/lib/sass/tree/visitors/to_css.rb +47 -13
  59. data/lib/sass/util/multibyte_string_scanner.rb +127 -131
  60. data/lib/sass/util/normalized_map.rb +1 -8
  61. data/lib/sass/util.rb +12 -290
  62. data/lib/sass/version.rb +0 -2
  63. data/lib/sass.rb +0 -7
  64. data/test/sass/cache_test.rb +0 -1
  65. data/test/sass/callbacks_test.rb +0 -1
  66. data/test/sass/compiler_test.rb +4 -15
  67. data/test/sass/conversion_test.rb +113 -163
  68. data/test/sass/css2sass_test.rb +16 -19
  69. data/test/sass/css_variable_test.rb +176 -71
  70. data/test/sass/encoding_test.rb +2 -33
  71. data/test/sass/engine_test.rb +71 -19
  72. data/test/sass/exec_test.rb +0 -1
  73. data/test/sass/extend_test.rb +37 -92
  74. data/test/sass/functions_test.rb +58 -14
  75. data/test/sass/importer_test.rb +2 -3
  76. data/test/sass/logger_test.rb +0 -1
  77. data/test/sass/plugin_test.rb +6 -10
  78. data/test/sass/results/script.css +1 -1
  79. data/test/sass/results/units.css +2 -2
  80. data/test/sass/script_conversion_test.rb +10 -2
  81. data/test/sass/script_test.rb +22 -24
  82. data/test/sass/scss/css_test.rb +3 -18
  83. data/test/sass/scss/rx_test.rb +0 -1
  84. data/test/sass/scss/scss_test.rb +49 -16
  85. data/test/sass/source_map_test.rb +13 -16
  86. data/test/sass/superselector_test.rb +0 -1
  87. data/test/sass/util/multibyte_string_scanner_test.rb +121 -124
  88. data/test/sass/util/normalized_map_test.rb +0 -1
  89. data/test/sass/util/subset_map_test.rb +0 -1
  90. data/test/sass/util_test.rb +4 -39
  91. data/test/sass/value_helpers_test.rb +0 -1
  92. data/test/sass-spec.yml +1 -1
  93. data/test/test_helper.rb +39 -0
  94. metadata +19 -44
  95. data/lib/sass/script/css_variable_warning.rb +0 -52
  96. data/lib/sass/util/cross_platform_random.rb +0 -19
  97. data/lib/sass/util/ordered_hash.rb +0 -192
  98. data/test/sass/results/import_charset_1_8.css +0 -5
  99. data/test/sass/templates/import_charset_1_8.sass +0 -6
  100. data/vendor/listen/CHANGELOG.md +0 -1
  101. data/vendor/listen/CONTRIBUTING.md +0 -38
  102. data/vendor/listen/Gemfile +0 -20
  103. data/vendor/listen/Guardfile +0 -8
  104. data/vendor/listen/LICENSE +0 -20
  105. data/vendor/listen/README.md +0 -349
  106. data/vendor/listen/Rakefile +0 -5
  107. data/vendor/listen/Vagrantfile +0 -96
  108. data/vendor/listen/lib/listen/adapter.rb +0 -327
  109. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  110. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  111. data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  112. data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  113. data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  114. data/vendor/listen/lib/listen/directory_record.rb +0 -406
  115. data/vendor/listen/lib/listen/listener.rb +0 -323
  116. data/vendor/listen/lib/listen/turnstile.rb +0 -32
  117. data/vendor/listen/lib/listen/version.rb +0 -3
  118. data/vendor/listen/lib/listen.rb +0 -54
  119. data/vendor/listen/listen.gemspec +0 -28
  120. data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  121. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  122. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  123. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  124. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  125. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  126. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  127. data/vendor/listen/spec/listen/listener_spec.rb +0 -258
  128. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  129. data/vendor/listen/spec/listen_spec.rb +0 -67
  130. data/vendor/listen/spec/spec_helper.rb +0 -25
  131. data/vendor/listen/spec/support/adapter_helper.rb +0 -666
  132. data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  133. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  134. data/vendor/listen/spec/support/listeners_helper.rb +0 -179
  135. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  require 'minitest/autorun'
3
2
  require File.dirname(__FILE__) + '/../test_helper'
4
3
  require 'sass/css'
@@ -498,24 +497,22 @@ CSS
498
497
 
499
498
  # Encodings
500
499
 
501
- unless Sass::Util.ruby1_8?
502
- def test_encoding_error
503
- css2sass("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
504
- assert(false, "Expected exception")
505
- rescue Sass::SyntaxError => e
506
- assert_equal(3, e.sass_line)
507
- assert_equal('Invalid UTF-8 character "\xFE"', e.message)
508
- end
509
-
510
- def test_ascii_incompatible_encoding_error
511
- template = "foo\nbar\nb_z".encode("utf-16le")
512
- template[9] = "\xFE".force_encoding("utf-16le")
513
- css2sass(template)
514
- assert(false, "Expected exception")
515
- rescue Sass::SyntaxError => e
516
- assert_equal(3, e.sass_line)
517
- assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
518
- end
500
+ def test_encoding_error
501
+ css2sass("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
502
+ assert(false, "Expected exception")
503
+ rescue Sass::SyntaxError => e
504
+ assert_equal(3, e.sass_line)
505
+ assert_equal('Invalid UTF-8 character "\xFE"', e.message)
506
+ end
507
+
508
+ def test_ascii_incompatible_encoding_error
509
+ template = "foo\nbar\nb_z".encode("utf-16le")
510
+ template[9] = "\xFE".force_encoding("utf-16le")
511
+ css2sass(template)
512
+ assert(false, "Expected exception")
513
+ rescue Sass::SyntaxError => e
514
+ assert_equal(3, e.sass_line)
515
+ assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
519
516
  end
520
517
 
521
518
  private
@@ -1,105 +1,210 @@
1
- #!/usr/bin/env ruby
2
1
 
3
2
  require File.dirname(__FILE__) + '/../test_helper'
4
3
  require 'sass/engine'
5
4
 
5
+ # Most CSS variable tests are in sass-spec, but a few relate to formatting or
6
+ # conversion and so belong here.
6
7
  class CssVariableTest < MiniTest::Test
7
- def test_variable_warning_for_operators
8
- resolve_with_variable_warning("1 == 2")
9
- resolve_with_variable_warning("1 != 2")
10
- resolve_with_variable_warning("1 < 2")
11
- resolve_with_variable_warning("1 <= 2")
12
- resolve_with_variable_warning("1 > 2")
13
- resolve_with_variable_warning("1 >= 2")
14
- resolve_with_variable_warning("1 + 1")
15
- resolve_with_variable_warning("1 - 1")
16
- resolve_with_variable_warning("1 * 1")
17
- resolve_with_variable_warning("1 % 1")
8
+ def test_folded_inline_whitespace
9
+ assert_variable_value "foo bar baz", "foo bar baz"
10
+ assert_variable_value "foo bar", "foo \t bar"
18
11
  end
19
12
 
20
- def test_variable_warning_for_variable
21
- render_with_variable_warning(<<SCSS, "$var", 3)
13
+ def test_folded_multiline_whitespace
14
+ # We don't want to reformat newlines in nested and expanded mode, so we just
15
+ # remove trailing whitespace before them.
16
+ assert_equal <<CSS, render(<<SCSS)
22
17
  .foo {
23
- $var: value;
24
- --var: $var;
18
+ --multiline: foo
19
+ bar; }
20
+ CSS
21
+ .foo {
22
+ --multiline: foo\s
23
+ bar;
25
24
  }
26
25
  SCSS
27
- end
28
26
 
29
- def test_variable_warning_for_core_function
30
- resolve_with_variable_warning("alpha(#abc)")
31
- end
27
+ assert_equal <<CSS, render(<<SCSS)
28
+ .foo {
29
+ --multiline: foo
30
+
32
31
 
33
- def test_variable_warning_for_sass_function
34
- render_with_variable_warning(<<SCSS, "my-fn()", 2)
35
- @function my-fn() {@return null}
36
- .foo {--var: my-fn()}
32
+ bar; }
33
+ CSS
34
+ .foo {
35
+ --multiline: foo\s
36
+
37
+
38
+ bar;
39
+ }
37
40
  SCSS
38
- end
39
41
 
40
- def test_variable_warning_for_parens
41
- resolve_with_variable_warning("(foo)", "foo")
42
- resolve_with_variable_warning("(foo,)")
43
- end
42
+ assert_equal <<CSS, render(<<SCSS, style: :expanded)
43
+ .foo {
44
+ --multiline: foo
45
+ bar;
46
+ }
47
+ CSS
48
+ .foo {
49
+ --multiline: foo\s
50
+ bar;
51
+ }
52
+ SCSS
53
+
54
+ assert_equal <<CSS, render(<<SCSS, style: :expanded)
55
+ .foo {
56
+ --multiline: foo
57
+
44
58
 
45
- def test_variable_warning_for_selector
46
- resolve_with_variable_warning("&")
59
+ bar;
60
+ }
61
+ CSS
62
+ .foo {
63
+ --multiline: foo\s
64
+
65
+
66
+ bar;
67
+ }
68
+ SCSS
69
+
70
+ # In compact and compressed mode, we fold all whitespace around newlines
71
+ # together.
72
+ assert_equal <<CSS, render(<<SCSS, style: :compact)
73
+ .foo { --multiline: foo bar; }
74
+ CSS
75
+ .foo {
76
+ --multiline: foo\s
77
+ bar;
78
+ }
79
+ SCSS
80
+
81
+ assert_equal <<CSS, render(<<SCSS, style: :compact)
82
+ .foo { --multiline: foo bar; }
83
+ CSS
84
+ .foo {
85
+ --multiline: foo\s
86
+
87
+
88
+ bar;
89
+ }
90
+ SCSS
91
+
92
+ assert_equal <<CSS, render(<<SCSS, style: :compressed)
93
+ .foo{--multiline: foo bar}
94
+ CSS
95
+ .foo {
96
+ --multiline: foo\s
97
+ bar;
98
+ }
99
+ SCSS
100
+
101
+ assert_equal <<CSS, render(<<SCSS, style: :compressed)
102
+ .foo{--multiline: foo bar}
103
+ CSS
104
+ .foo {
105
+ --multiline: foo\s
106
+
107
+
108
+ bar;
109
+ }
110
+ SCSS
47
111
  end
48
112
 
49
- def test_variable_warning_for_nested_properties
50
- assert_warning(<<WARNING) {render(<<SCSS)}
51
- DEPRECATION WARNING on line 2 of #{filename_for_test :scss}:
52
- Sass 3.6 will change the way CSS variables are parsed. Instead of being parsed as
53
- normal properties, they will not allow any Sass-specific behavior other than \#{}.
54
- WARNING
113
+ # Conversion.
114
+
115
+ def test_static_values_convert
116
+ assert_converts <<SASS, <<SCSS
117
+ .foo
118
+ --bar: baz
119
+ SASS
55
120
  .foo {
56
- --var: {
57
- a: b;
58
- }
121
+ --bar: baz;
122
+ }
123
+ SCSS
124
+
125
+ assert_converts <<SASS, <<SCSS
126
+ .foo
127
+ --bar: [({{([!;])}})]
128
+ SASS
129
+ .foo {
130
+ --bar: [({{([!;])}})];
131
+ }
132
+ SCSS
133
+
134
+ assert_converts <<SASS, <<SCSS
135
+ .foo
136
+ --bar: {a: b; c: d}
137
+ SASS
138
+ .foo {
139
+ --bar: {a: b; c: d};
59
140
  }
60
141
  SCSS
61
142
  end
62
143
 
63
- def test_no_warning
64
- assert_no_variable_warning("foo")
65
- assert_no_variable_warning("true")
66
- assert_no_variable_warning("1, 2")
67
- assert_no_variable_warning("1 2")
68
- assert_no_variable_warning("1 / 2")
69
- assert_no_variable_warning("foo / bar")
70
- assert_no_variable_warning("asdf(foo)")
71
- assert_no_variable_warning("calc(1 + 1)")
72
- assert_no_variable_warning("asdf(foo=2)")
144
+ def test_dynamic_values_convert
145
+ assert_converts <<SASS, <<SCSS
146
+ .foo
147
+ --bar: baz \#{bang} qux
148
+ SASS
149
+ .foo {
150
+ --bar: baz \#{bang} qux;
151
+ }
152
+ SCSS
153
+
154
+ assert_converts <<SASS, <<SCSS
155
+ .foo
156
+ --bar: "baz \#{bang} qux"
157
+ SASS
158
+ .foo {
159
+ --bar: "baz \#{bang} qux";
160
+ }
161
+ SCSS
73
162
  end
74
163
 
75
- def test_no_warning_within_interpolation
76
- assert_no_variable_warning('#{1 + 1}')
77
- assert_no_variable_warning('#{alpha(#abc)}')
164
+ def test_multiline_value_converts
165
+ assert_scss_to_scss <<SCSS
166
+ .foo {
167
+ --bar: {
168
+ a: b;
169
+ c: d;
170
+ };
171
+ }
172
+ SCSS
173
+
174
+ assert_scss_to_sass <<SASS, <<SCSS
175
+ .foo
176
+ --bar: { a: b; c: d; }
177
+ SASS
178
+ .foo {
179
+ --bar: {
180
+ a: b;
181
+ c: d;
182
+ };
183
+ }
184
+ SCSS
78
185
  end
79
186
 
80
187
  private
81
188
 
82
- def assert_no_variable_warning(str)
83
- assert_no_warning {render("a {--var: #{str}}")}
84
- assert_no_warning {render("a\n --var: #{str}", :syntax => :sass)}
85
- end
189
+ def assert_variable_value(expected, source)
190
+ expected = <<CSS
191
+ x {
192
+ --variable: #{expected}; }
193
+ CSS
86
194
 
87
- def resolve_with_variable_warning(str, expression = nil)
88
- render_with_variable_warning("a {--var: #{str}}", expression || str, 1)
89
- render_with_variable_warning(
90
- "a\n --var: #{str}", expression || str, 2, :syntax => :sass)
195
+ assert_equal expected, render_variable(source)
196
+ assert_equal expected, render_variable(source, syntax: :sass)
91
197
  end
92
198
 
93
- def render_with_variable_warning(sass, expression, line, opts = {})
94
- opts[:syntax] ||= :scss
95
- assert_warning(<<WARNING) {render(sass, opts)}
96
- DEPRECATION WARNING on line #{line} of #{filename_for_test(opts[:syntax])}:
97
- Sass 3.6 will change the way CSS variables are parsed. Instead of being parsed as
98
- normal properties, they will not allow any Sass-specific behavior other than \#{}.
99
- For forwards-compatibility, use \#{}:
100
-
101
- --variable: \#{#{expression}};
102
- WARNING
199
+ def render_variable(source, syntax: :scss)
200
+ render(syntax == :scss ? <<SCSS : <<SASS, :syntax => syntax)
201
+ x {
202
+ --variable: #{source};
203
+ }
204
+ SCSS
205
+ x
206
+ --variable: #{source}
207
+ SASS
103
208
  end
104
209
 
105
210
  def render(sass, options = {})
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  # -*- coding: utf-8 -*-
3
2
  require File.dirname(__FILE__) + '/../test_helper'
4
3
  require File.dirname(__FILE__) + '/test_helper'
@@ -8,8 +7,6 @@ class EncodingTest < MiniTest::Test
8
7
  include Sass::Util::Test
9
8
 
10
9
  def test_encoding_error
11
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
12
-
13
10
  render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
14
11
  assert(false, "Expected exception")
15
12
  rescue Sass::SyntaxError => e
@@ -18,8 +15,6 @@ class EncodingTest < MiniTest::Test
18
15
  end
19
16
 
20
17
  def test_ascii_incompatible_encoding_error
21
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
22
-
23
18
  template = "foo\nbar\nb_z".encode("utf-16le")
24
19
  template[9] = "\xFE".force_encoding("utf-16le")
25
20
  render(template)
@@ -30,8 +25,6 @@ class EncodingTest < MiniTest::Test
30
25
  end
31
26
 
32
27
  def test_prefers_charset_to_ruby_encoding
33
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
34
-
35
28
  assert_renders_encoded(<<CSS, <<SASS.encode("IBM866").force_encoding("UTF-8"))
36
29
  @charset "UTF-8";
37
30
  fЖЖ {
@@ -44,8 +37,6 @@ SASS
44
37
  end
45
38
 
46
39
  def test_uses_ruby_encoding_without_charset
47
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
48
-
49
40
  assert_renders_encoded(<<CSS, <<SASS.encode("IBM866"))
50
41
  @charset "UTF-8";
51
42
  тАЬ {
@@ -57,8 +48,6 @@ SASS
57
48
  end
58
49
 
59
50
  def test_multibyte_charset_without_bom_declared_as_binary
60
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
61
-
62
51
  engine = Sass::Engine.new(<<SASS.encode("UTF-16LE").force_encoding("BINARY"))
63
52
  @charset "utf-16le"
64
53
  fóó
@@ -71,8 +60,6 @@ SASS
71
60
  end
72
61
 
73
62
  def test_multibyte_charset_without_bom_declared_as_utf_8
74
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
75
-
76
63
  engine = Sass::Engine.new(<<SASS.encode("UTF-16LE").force_encoding("UTF-8"))
77
64
  @charset "utf-16le"
78
65
  fóó
@@ -85,8 +72,6 @@ SASS
85
72
  end
86
73
 
87
74
  def test_utf_16le_with_bom
88
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
89
-
90
75
  assert_renders_encoded(<<CSS, <<SASS.encode("UTF-16LE").force_encoding("BINARY"))
91
76
  @charset "UTF-8";
92
77
  fóó {
@@ -98,8 +83,6 @@ SASS
98
83
  end
99
84
 
100
85
  def test_utf_16be_with_bom
101
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
102
-
103
86
  assert_renders_encoded(<<CSS, <<SASS.encode("UTF-16BE").force_encoding("BINARY"))
104
87
  @charset "UTF-8";
105
88
  fóó {
@@ -111,8 +94,6 @@ SASS
111
94
  end
112
95
 
113
96
  def test_utf_8_with_bom
114
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
115
-
116
97
  assert_renders_encoded(<<CSS, <<SASS.force_encoding("BINARY"))
117
98
  @charset "UTF-8";
118
99
  fóó {
@@ -124,8 +105,6 @@ SASS
124
105
  end
125
106
 
126
107
  def test_charset_with_multibyte_encoding
127
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
128
-
129
108
  engine = Sass::Engine.new(<<SASS)
130
109
  @charset "utf-32be"
131
110
  fóó
@@ -137,8 +116,6 @@ SASS
137
116
  end
138
117
 
139
118
  def test_charset_with_special_case_encoding
140
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
141
-
142
119
  # For some reason, a file with an ASCII-compatible UTF-16 charset
143
120
  # declaration is specced to be parsed as UTF-8.
144
121
  assert_renders_encoded(<<CSS, <<SASS.force_encoding("BINARY"))
@@ -153,8 +130,6 @@ SASS
153
130
  end
154
131
 
155
132
  def test_compressed_output_uses_bom
156
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
157
-
158
133
  assert_equal("\uFEFFfóó{a:b}\n", render(<<SASS, :style => :compressed))
159
134
  fóó
160
135
  a: b
@@ -167,19 +142,15 @@ SASS
167
142
  end
168
143
 
169
144
  def test_null_normalization
170
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
171
-
172
145
  assert_equal(<<CSS, render("/* foo\x00bar\x00baz */", :syntax => :scss))
173
- #{"@charset \"UTF-8\";\n" unless Sass::Util.ruby1_8?
174
- }/* foo�bar�baz */
146
+ @charset "UTF-8";
147
+ /* foo�bar�baz */
175
148
  CSS
176
149
  end
177
150
 
178
151
  # Regression
179
152
 
180
153
  def test_multibyte_prop_name
181
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
182
-
183
154
  assert_equal(<<CSS, render(<<SASS))
184
155
  @charset "UTF-8";
185
156
  #bar {
@@ -191,8 +162,6 @@ SASS
191
162
  end
192
163
 
193
164
  def test_multibyte_and_interpolation
194
- return skip "Can't be run on Ruby 1.8." if Sass::Util.ruby1_8?
195
-
196
165
  assert_equal(<<CSS, render(<<SCSS, :syntax => :scss))
197
166
  #bar {
198
167
  background: a 0%; }
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  # -*- coding: utf-8 -*-
3
2
  require File.dirname(__FILE__) + '/../test_helper'
4
3
  require File.dirname(__FILE__) + '/test_helper'
@@ -98,8 +97,6 @@ MSG
98
97
  "a\n\t\tb: c\n\tb: c" => ["Inconsistent indentation: 1 tab was used for indentation, but the rest of the document was indented using 2 tabs.", 3],
99
98
  "a\n b: c\n b: c" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 3],
100
99
  "a\n b: c\n a\n d: e" => ["Inconsistent indentation: 3 spaces were used for indentation, but the rest of the document was indented using 2 spaces.", 4],
101
- "a\n b: c\na\n d: e" => ["The line was indented 2 levels deeper than the previous line.", 4],
102
- "a\n b: c\n a\n d: e" => ["The line was indented 3 levels deeper than the previous line.", 4],
103
100
  "a\n \tb: c" => ["Indentation can't use both tabs and spaces.", 2],
104
101
  "=a(" => 'Invalid CSS after "(": expected variable (e.g. $foo), was ""',
105
102
  "=a(b)" => 'Invalid CSS after "(": expected variable (e.g. $foo), was "b)"',
@@ -139,7 +136,7 @@ MSG
139
136
  '@for $a from "foo" to 1' => '"foo" is not an integer.',
140
137
  '@for $a from 1 to "2"' => '"2" is not an integer.',
141
138
  '@for $a from 1 to "foo"' => '"foo" is not an integer.',
142
- '@for $a from 1 to 1.232323' => '1.23232 is not an integer.',
139
+ '@for $a from 1 to 1.23232323232' => '1.2323232323 is not an integer.',
143
140
  '@for $a from 1px to 3em' => "Incompatible units: 'em' and 'px'.",
144
141
  '@if' => "Invalid if directive '@if': expected expression.",
145
142
  '@while' => "Invalid while directive '@while': expected expression.",
@@ -1793,7 +1790,7 @@ SASS
1793
1790
 
1794
1791
  def test_loud_comment_is_evaluated
1795
1792
  assert_equal <<CSS, render(<<SASS)
1796
- /*! Hue: 327.21649deg */
1793
+ /*! Hue: 327.2164948454deg */
1797
1794
  CSS
1798
1795
  /*! Hue: \#{hue(#f836a0)}
1799
1796
  SASS
@@ -2700,15 +2697,6 @@ a
2700
2697
  SASS
2701
2698
  end
2702
2699
 
2703
- def test_mixin_no_arg_error
2704
- assert_raise_message(Sass::SyntaxError, 'Invalid CSS after "($bar,": expected variable (e.g. $foo), was ")"') do
2705
- render(<<SASS)
2706
- =foo($bar,)
2707
- bip: bap
2708
- SASS
2709
- end
2710
- end
2711
-
2712
2700
  def test_import_with_commas_in_url
2713
2701
  assert_equal <<CSS, render(<<SASS)
2714
2702
  @import url(foo.css?bar,baz);
@@ -3324,13 +3312,13 @@ SASS
3324
3312
 
3325
3313
  def test_numeric_formatting_of_integers
3326
3314
  assert_equal(<<CSS, render(<<SASS, :syntax => :scss, :style => :compressed))
3327
- a{near:3.00001;plus:3;minus:3;negative:-3}
3315
+ a{near:3.0000000001;plus:3;minus:3;negative:-3}
3328
3316
  CSS
3329
3317
  a {
3330
- near: (3 + 0.00001);
3331
- plus: (3 + 0.0000001);
3332
- minus: (3 - 0.0000001);
3333
- negative: (-3 + 0.0000001);
3318
+ near: (3 + 0.0000000001);
3319
+ plus: (3 + 0.000000000001);
3320
+ minus: (3 - 0.000000000001);
3321
+ negative: (-3 + 0.000000000001);
3334
3322
  }
3335
3323
  SASS
3336
3324
  end
@@ -3391,6 +3379,70 @@ CSS
3391
3379
  SASS
3392
3380
  end
3393
3381
 
3382
+ def test_trailing_commas_in_arglists
3383
+ assert_equal(<<CSS, render(<<SASS, :style => :nested))
3384
+ .includes {
3385
+ one-positional-arg: positional 1 a;
3386
+ two-positional-args: positional 2 a b;
3387
+ one-keyword-arg: keyword 1 z;
3388
+ two-keyword-args: keyword 2 y z;
3389
+ mixed-args: mixed 2 y z; }
3390
+
3391
+ .calls {
3392
+ one-positional-arg: positional 1 a;
3393
+ two-positional-args: positional 2 a b;
3394
+ one-keyword-arg: keyword 1 z;
3395
+ two-keyword-args: keyword 2 y z;
3396
+ mixed-args: mixed 2 y z; }
3397
+ CSS
3398
+ =one-positional-arg($a,)
3399
+ one-positional-arg: positional 1 $a
3400
+
3401
+ =two-positional-args($a, $b,)
3402
+ two-positional-args: positional 2 $a $b
3403
+
3404
+ =one-keyword-arg($a: a,)
3405
+ one-keyword-arg: keyword 1 $a
3406
+
3407
+ =two-keyword-args($a: a, $b: b,)
3408
+ two-keyword-args: keyword 2 $a $b
3409
+
3410
+ =mixed-args($a, $b: b,)
3411
+ mixed-args: mixed 2 $a $b
3412
+
3413
+ @function one-positional-arg($a)
3414
+ @return positional 1 $a
3415
+
3416
+ @function two-positional-args($a, $b)
3417
+ @return positional 2 $a $b
3418
+
3419
+ @function one-keyword-arg($a: a)
3420
+ @return keyword 1 $a
3421
+
3422
+ @function two-keyword-args($a: a, $b: b)
3423
+ @return keyword 2 $a $b
3424
+
3425
+ @function mixed-args($a, $b: b)
3426
+ @return mixed 2 $a $b
3427
+
3428
+
3429
+ .includes
3430
+ +one-positional-arg(a,)
3431
+ +two-positional-args(a, b,)
3432
+ +one-keyword-arg($a: z,)
3433
+ +two-keyword-args($a: y, $b: z,)
3434
+ +mixed-args(y, $b: z,)
3435
+
3436
+
3437
+ .calls
3438
+ one-positional-arg: one-positional-arg(a)
3439
+ two-positional-args: two-positional-args(a, b)
3440
+ one-keyword-arg: one-keyword-arg($a: z)
3441
+ two-keyword-args: two-keyword-args($a: y, $b: z)
3442
+ mixed-args: mixed-args(y, $b: z)
3443
+ SASS
3444
+ end
3445
+
3394
3446
  private
3395
3447
 
3396
3448
  def assert_hash_has(hash, expected)
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  require File.dirname(__FILE__) + '/../test_helper'
3
2
  require 'fileutils'
4
3
  require 'sass/util/test'