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
@@ -489,7 +489,7 @@ CSS
489
489
  SCSS
490
490
  end
491
491
 
492
- def test_another_nested_extender_with_early_child_selectors_doesnt_subseq_them
492
+ def test_nested_extender_with_early_child_selectors_doesnt_subseq_them
493
493
  assert_equal <<CSS, render(<<SCSS)
494
494
  .foo .bar, .foo .bip > .baz {
495
495
  a: b; }
@@ -1154,182 +1154,37 @@ b.foo {@extend .bar}
1154
1154
  SCSS
1155
1155
  end
1156
1156
 
1157
- def test_optional_extend_does_not_warn_when_extendee_doesnt_exist
1158
- assert_no_warning {assert_equal("", render(<<SCSS))}
1159
- .foo {@extend .bar !optional}
1160
- SCSS
1161
- end
1162
-
1163
- def test_optional_extend_does_not_warn_when_extension_fails
1157
+ def test_extend_does_not_warn_when_one_extension_fails_but_others_dont
1164
1158
  assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1165
1159
  a.bar {
1166
1160
  a: b; }
1167
- CSS
1168
- a.bar {a: b}
1169
- b.foo {@extend .bar !optional}
1170
- SCSS
1171
- end
1172
-
1173
- # Regression Tests
1174
-
1175
- def test_pseudo_element_superselector
1176
- # Pseudo-elements shouldn't be removed in superselector calculations.
1177
- assert_equal <<CSS, render(<<SCSS)
1178
- a#bar, a#bar::fblthp {
1179
- a: b; }
1180
- CSS
1181
- %x#bar {a: b} // Add an id to make the results have high specificity
1182
- %y, %y::fblthp {@extend %x}
1183
- a {@extend %y}
1184
- SCSS
1185
-
1186
- # Pseudo-classes can be removed when the second law allows.
1187
- assert_equal <<CSS, render(<<SCSS)
1188
- a#bar {
1189
- a: b; }
1190
- CSS
1191
- %x#bar {a: b}
1192
- %y, %y:fblthp {@extend %x}
1193
- a {@extend %y}
1194
- SCSS
1195
1161
 
1196
- # A few pseudo-elements can be written as pseudo-elements for historical
1197
- # reasons. See http://www.w3.org/TR/selectors4/#pseudo-elements.
1198
- %w[first-line first-letter before after].each do |pseudo|
1199
- assert_equal <<CSS, render(<<SCSS)
1200
- a#bar, a#bar:#{pseudo} {
1201
- a: b; }
1202
- CSS
1203
- %x#bar {a: b}
1204
- %y, %y:#{pseudo} {@extend %x}
1205
- a {@extend %y}
1206
- SCSS
1207
- end
1208
- end
1209
-
1210
- def test_multiple_source_redundancy_elimination
1211
- assert_equal <<CSS, render(<<SCSS)
1212
- .test-case, .test-case:active {
1213
- color: red; }
1214
-
1215
- .test-case:hover {
1216
- color: green; }
1217
- CSS
1218
- %default-color {color: red}
1219
- %alt-color {color: green}
1220
-
1221
- %default-style {
1222
- @extend %default-color;
1223
- &:hover {@extend %alt-color}
1224
- &:active {@extend %default-color}
1225
- }
1226
-
1227
- .test-case {@extend %default-style}
1228
- SCSS
1229
- end
1230
-
1231
- def test_nested_sibling_extend
1232
- assert_equal <<CSS, render(<<SCSS)
1233
- .parent .bar, .parent .foo {
1234
- width: 2000px; }
1235
- CSS
1236
- .foo {@extend .bar}
1237
-
1238
- .parent {
1239
- .bar {
1240
- width: 2000px;
1241
- }
1242
- .foo {
1243
- @extend .bar
1244
- }
1245
- }
1246
- SCSS
1247
- end
1248
-
1249
- def test_parent_and_sibling_extend
1250
- assert_equal <<CSS, render(<<SCSS)
1251
- .parent1 .parent2 .child1.child2, .parent2 .parent1 .child1.child2 {
1162
+ .bar, b.foo {
1252
1163
  c: d; }
1253
1164
  CSS
1254
- %foo %bar%baz {c: d}
1255
-
1256
- .parent1 {
1257
- @extend %foo;
1258
- .child1 {@extend %bar}
1259
- }
1260
-
1261
- .parent2 {
1262
- @extend %foo;
1263
- .child2 {@extend %baz}
1264
- }
1165
+ a.bar {a: b}
1166
+ .bar {c: d}
1167
+ b.foo {@extend .bar}
1265
1168
  SCSS
1266
1169
  end
1267
1170
 
1268
- def test_nested_extend_specificity
1269
- assert_equal <<CSS, render(<<SCSS)
1270
- a :b, a :b:c {
1271
- a: b; }
1272
- CSS
1273
- %foo {a: b}
1274
-
1275
- a {
1276
- :b {@extend %foo}
1277
- :b:c {@extend %foo}
1278
- }
1171
+ def test_optional_extend_does_not_warn_when_extendee_doesnt_exist
1172
+ assert_no_warning {assert_equal("", render(<<SCSS))}
1173
+ .foo {@extend .bar !optional}
1279
1174
  SCSS
1280
1175
  end
1281
1176
 
1282
- def test_nested_double_extend_optimization
1283
- assert_equal <<CSS, render(<<SCSS)
1284
- .parent1 .child {
1177
+ def test_optional_extend_does_not_warn_when_extension_fails
1178
+ assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1179
+ a.bar {
1285
1180
  a: b; }
1286
1181
  CSS
1287
- %foo %bar {
1288
- a: b;
1289
- }
1290
-
1291
- .parent1 {
1292
- @extend %foo;
1293
-
1294
- .child {
1295
- @extend %bar;
1296
- }
1297
- }
1298
-
1299
- .parent2 {
1300
- @extend %foo;
1301
- }
1302
- SCSS
1303
- end
1304
-
1305
- def test_extend_in_double_nested_media_query
1306
- assert_equal <<CSS, render(<<SCSS)
1307
- @media all and (orientation: landscape) {
1308
- .bar {
1309
- color: blue; } }
1310
- CSS
1311
- @media all {
1312
- @media (orientation: landscape) {
1313
- %foo {color: blue}
1314
- .bar {@extend %foo}
1315
- }
1316
- }
1182
+ a.bar {a: b}
1183
+ b.foo {@extend .bar !optional}
1317
1184
  SCSS
1318
1185
  end
1319
1186
 
1320
- def test_partially_failed_extend
1321
- assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1322
- .rc, test {
1323
- color: white; }
1324
-
1325
- .prices span.pill span.rc {
1326
- color: red; }
1327
- CSS
1328
- test { @extend .rc; }
1329
- .rc {color: white;}
1330
- .prices span.pill span.rc {color: red;}
1331
- SCSS
1332
- end
1187
+ # Regression Tests
1333
1188
 
1334
1189
  def test_newline_near_combinator
1335
1190
  assert_equal <<CSS, render(<<SCSS)
@@ -1418,22 +1273,22 @@ SCSS
1418
1273
 
1419
1274
  def test_extend_cross_branch_redundancy_elimination
1420
1275
  assert_equal <<CSS, render(<<SCSS)
1421
- .a .c .d, .b .c .a .d {
1276
+ a c d, b c a d {
1422
1277
  a: b; }
1423
1278
  CSS
1424
- %x .c %y {a: b}
1425
- .a, .b {@extend %x}
1426
- .a .d {@extend %y}
1279
+ %x c %y {a: b}
1280
+ a, b {@extend %x}
1281
+ a d {@extend %y}
1427
1282
  SCSS
1428
1283
 
1429
1284
  assert_equal <<CSS, render(<<SCSS)
1430
- .e .a .c .d, .a .c .e .d, .e .b .c .a .d, .b .c .a .e .d {
1285
+ e a c d, a c e d, e b c a d, b c a e d {
1431
1286
  a: b; }
1432
1287
  CSS
1433
- .e %z {a: b}
1434
- %x .c %y {@extend %z}
1435
- .a, .b {@extend %x}
1436
- .a .d {@extend %y}
1288
+ e %z {a: b}
1289
+ %x c %y {@extend %z}
1290
+ a, b {@extend %x}
1291
+ a d {@extend %y}
1437
1292
  SCSS
1438
1293
  end
1439
1294
 
@@ -84,9 +84,9 @@ class SassFunctionTest < Test::Unit::TestCase
84
84
  end
85
85
 
86
86
  def test_hsl_checks_types
87
- assert_error_message("$hue: \"foo\" is not a number for `hsl'", "hsl(\"foo\", 10, 12)");
88
- assert_error_message("$saturation: \"foo\" is not a number for `hsl'", "hsl(10, \"foo\", 12)");
89
- assert_error_message("$lightness: \"foo\" is not a number for `hsl'", "hsl(10, 10, \"foo\")");
87
+ assert_error_message("\"foo\" is not a number for `hsl'", "hsl(\"foo\", 10, 12)");
88
+ assert_error_message("\"foo\" is not a number for `hsl'", "hsl(10, \"foo\", 12)");
89
+ assert_error_message("\"foo\" is not a number for `hsl'", "hsl(10, 10, \"foo\")");
90
90
  end
91
91
 
92
92
  def test_hsla
@@ -104,10 +104,10 @@ class SassFunctionTest < Test::Unit::TestCase
104
104
  end
105
105
 
106
106
  def test_hsla_checks_types
107
- assert_error_message("$hue: \"foo\" is not a number for `hsla'", "hsla(\"foo\", 10, 12, 0.3)");
108
- assert_error_message("$saturation: \"foo\" is not a number for `hsla'", "hsla(10, \"foo\", 12, 0)");
109
- assert_error_message("$lightness: \"foo\" is not a number for `hsla'", "hsla(10, 10, \"foo\", 1)");
110
- assert_error_message("$alpha: \"foo\" is not a number for `hsla'", "hsla(10, 10, 10, \"foo\")");
107
+ assert_error_message("\"foo\" is not a number for `hsla'", "hsla(\"foo\", 10, 12, 0.3)");
108
+ assert_error_message("\"foo\" is not a number for `hsla'", "hsla(10, \"foo\", 12, 0)");
109
+ assert_error_message("\"foo\" is not a number for `hsla'", "hsla(10, 10, \"foo\", 1)");
110
+ assert_error_message("\"foo\" is not a number for `hsla'", "hsla(10, 10, 10, \"foo\")");
111
111
  end
112
112
 
113
113
  def test_percentage
@@ -118,9 +118,9 @@ class SassFunctionTest < Test::Unit::TestCase
118
118
  end
119
119
 
120
120
  def test_percentage_checks_types
121
- assert_error_message("$value: 25px is not a unitless number for `percentage'", "percentage(25px)")
122
- assert_error_message("$value: #cccccc is not a unitless number for `percentage'", "percentage(#ccc)")
123
- assert_error_message("$value: \"string\" is not a unitless number for `percentage'", %Q{percentage("string")})
121
+ assert_error_message("25px is not a unitless number for `percentage'", "percentage(25px)")
122
+ assert_error_message("#cccccc is not a unitless number for `percentage'", "percentage(#ccc)")
123
+ assert_error_message("\"string\" is not a unitless number for `percentage'", %Q{percentage("string")})
124
124
  end
125
125
 
126
126
  def test_round
@@ -129,7 +129,7 @@ class SassFunctionTest < Test::Unit::TestCase
129
129
  assert_equal("5px", evaluate("round(5.49px)"))
130
130
  assert_equal("5px", evaluate("round($value: 5.49px)"))
131
131
 
132
- assert_error_message("$value: #cccccc is not a number for `round'", "round(#ccc)")
132
+ assert_error_message("#cccccc is not a number for `round'", "round(#ccc)")
133
133
  end
134
134
 
135
135
  def test_floor
@@ -137,7 +137,7 @@ class SassFunctionTest < Test::Unit::TestCase
137
137
  assert_equal("4px", evaluate("floor(4.8px)"))
138
138
  assert_equal("4px", evaluate("floor($value: 4.8px)"))
139
139
 
140
- assert_error_message("$value: \"foo\" is not a number for `floor'", "floor(\"foo\")")
140
+ assert_error_message("\"foo\" is not a number for `floor'", "floor(\"foo\")")
141
141
  end
142
142
 
143
143
  def test_ceil
@@ -145,7 +145,7 @@ class SassFunctionTest < Test::Unit::TestCase
145
145
  assert_equal("5px", evaluate("ceil(4.8px)"))
146
146
  assert_equal("5px", evaluate("ceil($value: 4.8px)"))
147
147
 
148
- assert_error_message("$value: \"a\" is not a number for `ceil'", "ceil(\"a\")")
148
+ assert_error_message("\"a\" is not a number for `ceil'", "ceil(\"a\")")
149
149
  end
150
150
 
151
151
  def test_abs
@@ -155,7 +155,7 @@ class SassFunctionTest < Test::Unit::TestCase
155
155
  assert_equal("5px", evaluate("abs(5px)"))
156
156
  assert_equal("5px", evaluate("abs($value: 5px)"))
157
157
 
158
- assert_error_message("$value: #aaaaaa is not a number for `abs'", "abs(#aaa)")
158
+ assert_error_message("#aaaaaa is not a number for `abs'", "abs(#aaa)")
159
159
  end
160
160
 
161
161
  def test_min
@@ -193,31 +193,31 @@ class SassFunctionTest < Test::Unit::TestCase
193
193
  end
194
194
 
195
195
  def test_rgb_tests_bounds
196
- assert_error_message("$red: Color value 256 must be between 0 and 255 for `rgb'",
196
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
197
197
  "rgb(256, 1, 1)")
198
- assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgb'",
198
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
199
199
  "rgb(1, 256, 1)")
200
- assert_error_message("$blue: Color value 256 must be between 0 and 255 for `rgb'",
200
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
201
201
  "rgb(1, 1, 256)")
202
- assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgb'",
202
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
203
203
  "rgb(1, 256, 257)")
204
- assert_error_message("$red: Color value -1 must be between 0 and 255 for `rgb'",
204
+ assert_error_message("Color value -1 must be between 0 and 255 for `rgb'",
205
205
  "rgb(-1, 1, 1)")
206
206
  end
207
207
 
208
208
  def test_rgb_test_percent_bounds
209
- assert_error_message("$red: Color value 100.1% must be between 0% and 100% for `rgb'",
209
+ assert_error_message("Color value 100.1% must be between 0% and 100% for `rgb'",
210
210
  "rgb(100.1%, 0, 0)")
211
- assert_error_message("$green: Color value -0.1% must be between 0% and 100% for `rgb'",
211
+ assert_error_message("Color value -0.1% must be between 0% and 100% for `rgb'",
212
212
  "rgb(0, -0.1%, 0)")
213
- assert_error_message("$blue: Color value 101% must be between 0% and 100% for `rgb'",
213
+ assert_error_message("Color value 101% must be between 0% and 100% for `rgb'",
214
214
  "rgb(0, 0, 101%)")
215
215
  end
216
216
 
217
217
  def test_rgb_tests_types
218
- assert_error_message("$red: \"foo\" is not a number for `rgb'", "rgb(\"foo\", 10, 12)");
219
- assert_error_message("$green: \"foo\" is not a number for `rgb'", "rgb(10, \"foo\", 12)");
220
- assert_error_message("$blue: \"foo\" is not a number for `rgb'", "rgb(10, 10, \"foo\")");
218
+ assert_error_message("\"foo\" is not a number for `rgb'", "rgb(\"foo\", 10, 12)");
219
+ assert_error_message("\"foo\" is not a number for `rgb'", "rgb(10, \"foo\", 12)");
220
+ assert_error_message("\"foo\" is not a number for `rgb'", "rgb(10, 10, \"foo\")");
221
221
  end
222
222
 
223
223
  def test_rgba
@@ -228,15 +228,15 @@ class SassFunctionTest < Test::Unit::TestCase
228
228
  end
229
229
 
230
230
  def test_rgba_tests_bounds
231
- assert_error_message("$red: Color value 256 must be between 0 and 255 for `rgba'",
231
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
232
232
  "rgba(256, 1, 1, 0.3)")
233
- assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgba'",
233
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
234
234
  "rgba(1, 256, 1, 0.3)")
235
- assert_error_message("$blue: Color value 256 must be between 0 and 255 for `rgba'",
235
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
236
236
  "rgba(1, 1, 256, 0.3)")
237
- assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgba'",
237
+ assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
238
238
  "rgba(1, 256, 257, 0.3)")
239
- assert_error_message("$red: Color value -1 must be between 0 and 255 for `rgba'",
239
+ assert_error_message("Color value -1 must be between 0 and 255 for `rgba'",
240
240
  "rgba(-1, 1, 1, 0.3)")
241
241
  assert_error_message("Alpha channel -0.2 must be between 0 and 1 for `rgba'",
242
242
  "rgba(1, 1, 1, -0.2)")
@@ -245,10 +245,10 @@ class SassFunctionTest < Test::Unit::TestCase
245
245
  end
246
246
 
247
247
  def test_rgba_tests_types
248
- assert_error_message("$red: \"foo\" is not a number for `rgba'", "rgba(\"foo\", 10, 12, 0.2)");
249
- assert_error_message("$green: \"foo\" is not a number for `rgba'", "rgba(10, \"foo\", 12, 0.1)");
250
- assert_error_message("$blue: \"foo\" is not a number for `rgba'", "rgba(10, 10, \"foo\", 0)");
251
- assert_error_message("$alpha: \"foo\" is not a number for `rgba'", "rgba(10, 10, 10, \"foo\")");
248
+ assert_error_message("\"foo\" is not a number for `rgba'", "rgba(\"foo\", 10, 12, 0.2)");
249
+ assert_error_message("\"foo\" is not a number for `rgba'", "rgba(10, \"foo\", 12, 0.1)");
250
+ assert_error_message("\"foo\" is not a number for `rgba'", "rgba(10, 10, \"foo\", 0)");
251
+ assert_error_message("\"foo\" is not a number for `rgba'", "rgba(10, 10, 10, \"foo\")");
252
252
  end
253
253
 
254
254
  def test_rgba_with_color
@@ -258,8 +258,8 @@ class SassFunctionTest < Test::Unit::TestCase
258
258
  end
259
259
 
260
260
  def test_rgba_with_color_tests_types
261
- assert_error_message("$color: \"foo\" is not a color for `rgba'", "rgba(\"foo\", 0.2)");
262
- assert_error_message("$alpha: \"foo\" is not a number for `rgba'", "rgba(blue, \"foo\")");
261
+ assert_error_message("\"foo\" is not a color for `rgba'", "rgba(\"foo\", 0.2)");
262
+ assert_error_message("\"foo\" is not a number for `rgba'", "rgba(blue, \"foo\")");
263
263
  end
264
264
 
265
265
  def test_rgba_tests_num_args
@@ -275,7 +275,7 @@ class SassFunctionTest < Test::Unit::TestCase
275
275
  end
276
276
 
277
277
  def test_red_exception
278
- assert_error_message("$color: 12 is not a color for `red'", "red(12)")
278
+ assert_error_message("12 is not a color for `red'", "red(12)")
279
279
  end
280
280
 
281
281
  def test_green
@@ -284,7 +284,7 @@ class SassFunctionTest < Test::Unit::TestCase
284
284
  end
285
285
 
286
286
  def test_green_exception
287
- assert_error_message("$color: 12 is not a color for `green'", "green(12)")
287
+ assert_error_message("12 is not a color for `green'", "green(12)")
288
288
  end
289
289
 
290
290
  def test_blue
@@ -293,7 +293,7 @@ class SassFunctionTest < Test::Unit::TestCase
293
293
  end
294
294
 
295
295
  def test_blue_exception
296
- assert_error_message("$color: 12 is not a color for `blue'", "blue(12)")
296
+ assert_error_message("12 is not a color for `blue'", "blue(12)")
297
297
  end
298
298
 
299
299
  def test_hue
@@ -302,7 +302,7 @@ class SassFunctionTest < Test::Unit::TestCase
302
302
  end
303
303
 
304
304
  def test_hue_exception
305
- assert_error_message("$color: 12 is not a color for `hue'", "hue(12)")
305
+ assert_error_message("12 is not a color for `hue'", "hue(12)")
306
306
  end
307
307
 
308
308
  def test_saturation
@@ -312,7 +312,7 @@ class SassFunctionTest < Test::Unit::TestCase
312
312
  end
313
313
 
314
314
  def test_saturation_exception
315
- assert_error_message("$color: 12 is not a color for `saturation'", "saturation(12)")
315
+ assert_error_message("12 is not a color for `saturation'", "saturation(12)")
316
316
  end
317
317
 
318
318
  def test_lightness
@@ -322,7 +322,7 @@ class SassFunctionTest < Test::Unit::TestCase
322
322
  end
323
323
 
324
324
  def test_lightness_exception
325
- assert_error_message("$color: 12 is not a color for `lightness'", "lightness(12)")
325
+ assert_error_message("12 is not a color for `lightness'", "lightness(12)")
326
326
  end
327
327
 
328
328
  def test_alpha
@@ -333,7 +333,7 @@ class SassFunctionTest < Test::Unit::TestCase
333
333
  end
334
334
 
335
335
  def test_alpha_exception
336
- assert_error_message("$color: 12 is not a color for `alpha'", "alpha(12)")
336
+ assert_error_message("12 is not a color for `alpha'", "alpha(12)")
337
337
  end
338
338
 
339
339
  def test_opacity
@@ -345,7 +345,7 @@ class SassFunctionTest < Test::Unit::TestCase
345
345
  end
346
346
 
347
347
  def test_opacity_exception
348
- assert_error_message("$color: \"foo\" is not a color for `opacity'", "opacity(foo)")
348
+ assert_error_message("\"foo\" is not a color for `opacity'", "opacity(foo)")
349
349
  end
350
350
 
351
351
  def test_opacify
@@ -367,8 +367,8 @@ class SassFunctionTest < Test::Unit::TestCase
367
367
  end
368
368
 
369
369
  def test_opacify_tests_types
370
- assert_error_message("$color: \"foo\" is not a color for `opacify'", "opacify(\"foo\", 10%)")
371
- assert_error_message("$amount: \"foo\" is not a number for `opacify'", "opacify(#fff, \"foo\")")
370
+ assert_error_message("\"foo\" is not a color for `opacify'", "opacify(\"foo\", 10%)")
371
+ assert_error_message("\"foo\" is not a number for `opacify'", "opacify(#fff, \"foo\")")
372
372
  end
373
373
 
374
374
  def test_transparentize
@@ -390,8 +390,8 @@ class SassFunctionTest < Test::Unit::TestCase
390
390
  end
391
391
 
392
392
  def test_transparentize_tests_types
393
- assert_error_message("$color: \"foo\" is not a color for `transparentize'", "transparentize(\"foo\", 10%)")
394
- assert_error_message("$amount: \"foo\" is not a number for `transparentize'", "transparentize(#fff, \"foo\")")
393
+ assert_error_message("\"foo\" is not a color for `transparentize'", "transparentize(\"foo\", 10%)")
394
+ assert_error_message("\"foo\" is not a number for `transparentize'", "transparentize(#fff, \"foo\")")
395
395
  end
396
396
 
397
397
  def test_lighten
@@ -412,8 +412,8 @@ class SassFunctionTest < Test::Unit::TestCase
412
412
  end
413
413
 
414
414
  def test_lighten_tests_types
415
- assert_error_message("$color: \"foo\" is not a color for `lighten'", "lighten(\"foo\", 10%)")
416
- assert_error_message("$amount: \"foo\" is not a number for `lighten'", "lighten(#fff, \"foo\")")
415
+ assert_error_message("\"foo\" is not a color for `lighten'", "lighten(\"foo\", 10%)")
416
+ assert_error_message("\"foo\" is not a number for `lighten'", "lighten(#fff, \"foo\")")
417
417
  end
418
418
 
419
419
  def test_darken
@@ -434,8 +434,8 @@ class SassFunctionTest < Test::Unit::TestCase
434
434
  end
435
435
 
436
436
  def test_darken_tests_types
437
- assert_error_message("$color: \"foo\" is not a color for `darken'", "darken(\"foo\", 10%)")
438
- assert_error_message("$amount: \"foo\" is not a number for `darken'", "darken(#fff, \"foo\")")
437
+ assert_error_message("\"foo\" is not a color for `darken'", "darken(\"foo\", 10%)")
438
+ assert_error_message("\"foo\" is not a number for `darken'", "darken(#fff, \"foo\")")
439
439
  end
440
440
 
441
441
  def test_saturate
@@ -458,8 +458,8 @@ class SassFunctionTest < Test::Unit::TestCase
458
458
  end
459
459
 
460
460
  def test_saturate_tests_types
461
- assert_error_message("$color: \"foo\" is not a color for `saturate'", "saturate(\"foo\", 10%)")
462
- assert_error_message("$amount: \"foo\" is not a number for `saturate'", "saturate(#fff, \"foo\")")
461
+ assert_error_message("\"foo\" is not a color for `saturate'", "saturate(\"foo\", 10%)")
462
+ assert_error_message("\"foo\" is not a number for `saturate'", "saturate(#fff, \"foo\")")
463
463
  end
464
464
 
465
465
  def test_desaturate
@@ -481,8 +481,8 @@ class SassFunctionTest < Test::Unit::TestCase
481
481
  end
482
482
 
483
483
  def test_desaturate_tests_types
484
- assert_error_message("$color: \"foo\" is not a color for `desaturate'", "desaturate(\"foo\", 10%)")
485
- assert_error_message("$amount: \"foo\" is not a number for `desaturate'", "desaturate(#fff, \"foo\")")
484
+ assert_error_message("\"foo\" is not a color for `desaturate'", "desaturate(\"foo\", 10%)")
485
+ assert_error_message("\"foo\" is not a number for `desaturate'", "desaturate(#fff, \"foo\")")
486
486
  end
487
487
 
488
488
  def test_adjust_hue
@@ -498,8 +498,8 @@ class SassFunctionTest < Test::Unit::TestCase
498
498
  end
499
499
 
500
500
  def test_adjust_hue_tests_types
501
- assert_error_message("$color: \"foo\" is not a color for `adjust-hue'", "adjust-hue(\"foo\", 10%)")
502
- assert_error_message("$degrees: \"foo\" is not a number for `adjust-hue'", "adjust-hue(#fff, \"foo\")")
501
+ assert_error_message("\"foo\" is not a color for `adjust-hue'", "adjust-hue(\"foo\", 10%)")
502
+ assert_error_message("\"foo\" is not a number for `adjust-hue'", "adjust-hue(#fff, \"foo\")")
503
503
  end
504
504
 
505
505
  def test_adjust_color
@@ -557,7 +557,7 @@ class SassFunctionTest < Test::Unit::TestCase
557
557
  end
558
558
 
559
559
  def test_adjust_color_tests_types
560
- assert_error_message("$color: \"foo\" is not a color for `adjust-color'", "adjust-color(foo, $hue: 10)")
560
+ assert_error_message("\"foo\" is not a color for `adjust-color'", "adjust-color(foo, $hue: 10)")
561
561
  # HSL
562
562
  assert_error_message("$hue: \"foo\" is not a number for `adjust-color'",
563
563
  "adjust-color(blue, $hue: foo)")
@@ -663,7 +663,7 @@ class SassFunctionTest < Test::Unit::TestCase
663
663
  end
664
664
 
665
665
  def test_scale_color_tests_types
666
- assert_error_message("$color: \"foo\" is not a color for `scale-color'", "scale-color(foo, $red: 10%)")
666
+ assert_error_message("\"foo\" is not a color for `scale-color'", "scale-color(foo, $red: 10%)")
667
667
  # HSL
668
668
  assert_error_message("$saturation: \"foo\" is not a number for `scale-color'",
669
669
  "scale-color(blue, $saturation: foo)")
@@ -734,7 +734,7 @@ class SassFunctionTest < Test::Unit::TestCase
734
734
  end
735
735
 
736
736
  def test_change_color_tests_types
737
- assert_error_message("$color: \"foo\" is not a color for `change-color'", "change-color(foo, $red: 10%)")
737
+ assert_error_message("\"foo\" is not a color for `change-color'", "change-color(foo, $red: 10%)")
738
738
  # HSL
739
739
  assert_error_message("$saturation: \"foo\" is not a number for `change-color'",
740
740
  "change-color(blue, $saturation: foo)")
@@ -797,9 +797,9 @@ class SassFunctionTest < Test::Unit::TestCase
797
797
  end
798
798
 
799
799
  def test_mix_tests_types
800
- assert_error_message("$color-1: \"foo\" is not a color for `mix'", "mix(\"foo\", #f00, 10%)")
801
- assert_error_message("$color-2: \"foo\" is not a color for `mix'", "mix(#f00, \"foo\", 10%)")
802
- assert_error_message("$weight: \"foo\" is not a number for `mix'", "mix(#f00, #baf, \"foo\")")
800
+ assert_error_message("\"foo\" is not a color for `mix'", "mix(\"foo\", #f00, 10%)")
801
+ assert_error_message("\"foo\" is not a color for `mix'", "mix(#f00, \"foo\", 10%)")
802
+ assert_error_message("\"foo\" is not a number for `mix'", "mix(#f00, #baf, \"foo\")")
803
803
  end
804
804
 
805
805
  def test_mix_tests_bounds
@@ -822,7 +822,7 @@ class SassFunctionTest < Test::Unit::TestCase
822
822
  end
823
823
 
824
824
  def tets_grayscale_tests_types
825
- assert_error_message("$color: \"foo\" is not a color for `grayscale'", "grayscale(\"foo\")")
825
+ assert_error_message("\"foo\" is not a color for `grayscale'", "grayscale(\"foo\")")
826
826
  end
827
827
 
828
828
  def test_complement
@@ -835,7 +835,7 @@ class SassFunctionTest < Test::Unit::TestCase
835
835
  end
836
836
 
837
837
  def tets_complement_tests_types
838
- assert_error_message("$color: \"foo\" is not a color for `complement'", "complement(\"foo\")")
838
+ assert_error_message("\"foo\" is not a color for `complement'", "complement(\"foo\")")
839
839
  end
840
840
 
841
841
  def test_invert
@@ -845,7 +845,7 @@ class SassFunctionTest < Test::Unit::TestCase
845
845
  end
846
846
 
847
847
  def test_invert_tests_types
848
- assert_error_message("$color: \"foo\" is not a color for `invert'", "invert(\"foo\")")
848
+ assert_error_message("\"foo\" is not a color for `invert'", "invert(\"foo\")")
849
849
  end
850
850
 
851
851
  def test_unquote
@@ -861,7 +861,7 @@ class SassFunctionTest < Test::Unit::TestCase
861
861
  end
862
862
 
863
863
  def test_quote_tests_type
864
- assert_error_message("$string: #ff0000 is not a string for `quote'", "quote(#f00)")
864
+ assert_error_message("#ff0000 is not a string for `quote'", "quote(#f00)")
865
865
  end
866
866
 
867
867
  def test_user_defined_function
@@ -900,14 +900,14 @@ MSG
900
900
  assert_equal(%Q{"em/rem"}, evaluate("unit(10px * 5em / 30cm / 1rem)"))
901
901
  assert_equal(%Q{"em*vh/cm*rem"}, evaluate("unit(10vh * 5em / 30cm / 1rem)"))
902
902
  assert_equal(%Q{"px"}, evaluate("unit($number: 100px)"))
903
- assert_error_message("$number: #ff0000 is not a number for `unit'", "unit(#f00)")
903
+ assert_error_message("#ff0000 is not a number for `unit'", "unit(#f00)")
904
904
  end
905
905
 
906
906
  def test_unitless
907
907
  assert_equal(%Q{true}, evaluate("unitless(100)"))
908
908
  assert_equal(%Q{false}, evaluate("unitless(100px)"))
909
909
  assert_equal(%Q{false}, evaluate("unitless($number: 100px)"))
910
- assert_error_message("$number: #ff0000 is not a number for `unitless'", "unitless(#f00)")
910
+ assert_error_message("#ff0000 is not a number for `unitless'", "unitless(#f00)")
911
911
  end
912
912
 
913
913
  def test_comparable
@@ -915,8 +915,8 @@ MSG
915
915
  assert_equal(%Q{true}, evaluate("comparable(10cm, 3mm)"))
916
916
  assert_equal(%Q{false}, evaluate("comparable(100px, 3em)"))
917
917
  assert_equal(%Q{false}, evaluate("comparable($number-1: 100px, $number-2: 3em)"))
918
- assert_error_message("$number-1: #ff0000 is not a number for `comparable'", "comparable(#f00, 1px)")
919
- assert_error_message("$number-2: #ff0000 is not a number for `comparable'", "comparable(1px, #f00)")
918
+ assert_error_message("#ff0000 is not a number for `comparable'", "comparable(#f00, 1px)")
919
+ assert_error_message("#ff0000 is not a number for `comparable'", "comparable(1px, #f00)")
920
920
  end
921
921
 
922
922
  def test_length
@@ -941,7 +941,6 @@ MSG
941
941
  assert_error_message("List index is 5 but list is only 4 items long for `nth'", "nth(1 2 3 4, 5)")
942
942
  assert_error_message("List index is 2 but list is only 1 item long for `nth'", "nth(foo, 2)")
943
943
  assert_error_message("List index is 1 but list has no items for `nth'", "nth((), 1)")
944
- assert_error_message("$n: \"foo\" is not a number for `nth'", "nth(1 2 3, foo)")
945
944
  end
946
945
 
947
946
  def test_join
@@ -980,7 +979,6 @@ MSG
980
979
  assert_equal("false", evaluate("(1, 2, ()) == join((), (1, 2))"))
981
980
 
982
981
  assert_error_message("Separator name must be space, comma, or auto for `join'", "join(1, 2, baboon)")
983
- assert_error_message("$separator: 12 is not a string for `join'", "join(1, 2, 12)")
984
982
  end
985
983
 
986
984
  def test_append
@@ -1015,23 +1013,19 @@ MSG
1015
1013
  assert_equal("true", evaluate("(1 2) == nth(append((), 1 2), 1)"))
1016
1014
 
1017
1015
  assert_error_message("Separator name must be space, comma, or auto for `append'", "append(1, 2, baboon)")
1018
- assert_error_message("$separator: 12 is not a string for `append'", "append(1, 2, 12)")
1019
1016
  end
1020
1017
 
1021
1018
  def test_zip
1022
1019
  assert_equal("1 3 5, 2 4 6", evaluate("zip(1 2, 3 4, 5 6)"))
1023
1020
  assert_equal("1 4 7, 2 5 8", evaluate("zip(1 2 3, 4 5 6, 7 8)"))
1024
- assert_equal("1 2 3", evaluate("zip(1, 2, 3)"))
1025
1021
  end
1026
1022
 
1027
1023
  def test_index
1028
1024
  assert_equal("1", evaluate("index(1px solid blue, 1px)"))
1029
1025
  assert_equal("2", evaluate("index(1px solid blue, solid)"))
1030
1026
  assert_equal("3", evaluate("index(1px solid blue, #00f)"))
1031
- assert_equal("1", evaluate("index(1px, 1px)"))
1032
1027
  assert_equal("false", evaluate("index(1px solid blue, 1em)"))
1033
1028
  assert_equal("false", evaluate("index(1px solid blue, notfound)"))
1034
- assert_equal("false", evaluate("index(1px, #00f)"))
1035
1029
  end
1036
1030
 
1037
1031
  def test_if
@@ -1040,18 +1034,6 @@ MSG
1040
1034
  assert_equal("2px", evaluate("if(null, 1px, 2px)"))
1041
1035
  end
1042
1036
 
1043
- def test_counter
1044
- assert_equal("counter(foo)", evaluate("counter(foo)"))
1045
- assert_equal('counter(item,".")', evaluate('counter(item, ".")'))
1046
- assert_equal('counter(item,".")', evaluate('counter(item,".")'))
1047
- end
1048
-
1049
- def test_counters
1050
- assert_equal("counters(foo)", evaluate("counters(foo)"))
1051
- assert_equal('counters(item,".")', evaluate('counters(item, ".")'))
1052
- assert_equal('counters(item,".")', evaluate('counters(item,".")'))
1053
- end
1054
-
1055
1037
  def test_keyword_args_rgb
1056
1038
  assert_equal(%Q{white}, evaluate("rgb($red: 255, $green: 255, $blue: 255)"))
1057
1039
  end
@@ -1120,9 +1102,7 @@ MSG
1120
1102
  private
1121
1103
 
1122
1104
  def evaluate(value)
1123
- result = perform(value)
1124
- assert_kind_of Sass::Script::Literal, result
1125
- return result.to_s
1105
+ Sass::Script::Parser.parse(value, 0, 0).perform(Sass::Environment.new).to_s
1126
1106
  end
1127
1107
 
1128
1108
  def perform(value)