sass 3.3.0.alpha.196 → 3.3.0.alpha.198
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass/script/functions.rb +639 -546
- data/test/sass/functions_test.rb +82 -79
- metadata +3 -3
data/test/sass/functions_test.rb
CHANGED
@@ -88,9 +88,9 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def test_hsl_checks_types
|
91
|
-
assert_error_message("\"foo\" is not a number for `hsl'", "hsl(\"foo\", 10, 12)");
|
92
|
-
assert_error_message("\"foo\" is not a number for `hsl'", "hsl(10, \"foo\", 12)");
|
93
|
-
assert_error_message("\"foo\" is not a number for `hsl'", "hsl(10, 10, \"foo\")");
|
91
|
+
assert_error_message("$hue: \"foo\" is not a number for `hsl'", "hsl(\"foo\", 10, 12)");
|
92
|
+
assert_error_message("$saturation: \"foo\" is not a number for `hsl'", "hsl(10, \"foo\", 12)");
|
93
|
+
assert_error_message("$lightness: \"foo\" is not a number for `hsl'", "hsl(10, 10, \"foo\")");
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_hsla
|
@@ -108,10 +108,10 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
108
108
|
end
|
109
109
|
|
110
110
|
def test_hsla_checks_types
|
111
|
-
assert_error_message("\"foo\" is not a number for `hsla'", "hsla(\"foo\", 10, 12, 0.3)");
|
112
|
-
assert_error_message("\"foo\" is not a number for `hsla'", "hsla(10, \"foo\", 12, 0)");
|
113
|
-
assert_error_message("\"foo\" is not a number for `hsla'", "hsla(10, 10, \"foo\", 1)");
|
114
|
-
assert_error_message("\"foo\" is not a number for `hsla'", "hsla(10, 10, 10, \"foo\")");
|
111
|
+
assert_error_message("$hue: \"foo\" is not a number for `hsla'", "hsla(\"foo\", 10, 12, 0.3)");
|
112
|
+
assert_error_message("$saturation: \"foo\" is not a number for `hsla'", "hsla(10, \"foo\", 12, 0)");
|
113
|
+
assert_error_message("$lightness: \"foo\" is not a number for `hsla'", "hsla(10, 10, \"foo\", 1)");
|
114
|
+
assert_error_message("$alpha: \"foo\" is not a number for `hsla'", "hsla(10, 10, 10, \"foo\")");
|
115
115
|
end
|
116
116
|
|
117
117
|
def test_percentage
|
@@ -122,9 +122,9 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def test_percentage_checks_types
|
125
|
-
assert_error_message("25px is not a unitless number for `percentage'", "percentage(25px)")
|
126
|
-
assert_error_message("#cccccc is not a unitless number for `percentage'", "percentage(#ccc)")
|
127
|
-
assert_error_message("\"string\" is not a unitless number for `percentage'", %Q{percentage("string")})
|
125
|
+
assert_error_message("$value: 25px is not a unitless number for `percentage'", "percentage(25px)")
|
126
|
+
assert_error_message("$value: #cccccc is not a unitless number for `percentage'", "percentage(#ccc)")
|
127
|
+
assert_error_message("$value: \"string\" is not a unitless number for `percentage'", %Q{percentage("string")})
|
128
128
|
end
|
129
129
|
|
130
130
|
def test_round
|
@@ -133,7 +133,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
133
133
|
assert_equal("5px", evaluate("round(5.49px)"))
|
134
134
|
assert_equal("5px", evaluate("round($value: 5.49px)"))
|
135
135
|
|
136
|
-
assert_error_message("#cccccc is not a number for `round'", "round(#ccc)")
|
136
|
+
assert_error_message("$value: #cccccc is not a number for `round'", "round(#ccc)")
|
137
137
|
end
|
138
138
|
|
139
139
|
def test_floor
|
@@ -141,7 +141,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
141
141
|
assert_equal("4px", evaluate("floor(4.8px)"))
|
142
142
|
assert_equal("4px", evaluate("floor($value: 4.8px)"))
|
143
143
|
|
144
|
-
assert_error_message("\"foo\" is not a number for `floor'", "floor(\"foo\")")
|
144
|
+
assert_error_message("$value: \"foo\" is not a number for `floor'", "floor(\"foo\")")
|
145
145
|
end
|
146
146
|
|
147
147
|
def test_ceil
|
@@ -149,7 +149,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
149
149
|
assert_equal("5px", evaluate("ceil(4.8px)"))
|
150
150
|
assert_equal("5px", evaluate("ceil($value: 4.8px)"))
|
151
151
|
|
152
|
-
assert_error_message("\"a\" is not a number for `ceil'", "ceil(\"a\")")
|
152
|
+
assert_error_message("$value: \"a\" is not a number for `ceil'", "ceil(\"a\")")
|
153
153
|
end
|
154
154
|
|
155
155
|
def test_abs
|
@@ -159,7 +159,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
159
159
|
assert_equal("5px", evaluate("abs(5px)"))
|
160
160
|
assert_equal("5px", evaluate("abs($value: 5px)"))
|
161
161
|
|
162
|
-
assert_error_message("#aaaaaa is not a number for `abs'", "abs(#aaa)")
|
162
|
+
assert_error_message("$value: #aaaaaa is not a number for `abs'", "abs(#aaa)")
|
163
163
|
end
|
164
164
|
|
165
165
|
def test_min
|
@@ -197,31 +197,31 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
197
197
|
end
|
198
198
|
|
199
199
|
def test_rgb_tests_bounds
|
200
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
|
200
|
+
assert_error_message("$red: Color value 256 must be between 0 and 255 for `rgb'",
|
201
201
|
"rgb(256, 1, 1)")
|
202
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
|
202
|
+
assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgb'",
|
203
203
|
"rgb(1, 256, 1)")
|
204
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
|
204
|
+
assert_error_message("$blue: Color value 256 must be between 0 and 255 for `rgb'",
|
205
205
|
"rgb(1, 1, 256)")
|
206
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgb'",
|
206
|
+
assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgb'",
|
207
207
|
"rgb(1, 256, 257)")
|
208
|
-
assert_error_message("Color value -1 must be between 0 and 255 for `rgb'",
|
208
|
+
assert_error_message("$red: Color value -1 must be between 0 and 255 for `rgb'",
|
209
209
|
"rgb(-1, 1, 1)")
|
210
210
|
end
|
211
211
|
|
212
212
|
def test_rgb_test_percent_bounds
|
213
|
-
assert_error_message("Color value 100.1% must be between 0% and 100% for `rgb'",
|
213
|
+
assert_error_message("$red: Color value 100.1% must be between 0% and 100% for `rgb'",
|
214
214
|
"rgb(100.1%, 0, 0)")
|
215
|
-
assert_error_message("Color value -0.1% must be between 0% and 100% for `rgb'",
|
215
|
+
assert_error_message("$green: Color value -0.1% must be between 0% and 100% for `rgb'",
|
216
216
|
"rgb(0, -0.1%, 0)")
|
217
|
-
assert_error_message("Color value 101% must be between 0% and 100% for `rgb'",
|
217
|
+
assert_error_message("$blue: Color value 101% must be between 0% and 100% for `rgb'",
|
218
218
|
"rgb(0, 0, 101%)")
|
219
219
|
end
|
220
220
|
|
221
221
|
def test_rgb_tests_types
|
222
|
-
assert_error_message("\"foo\" is not a number for `rgb'", "rgb(\"foo\", 10, 12)");
|
223
|
-
assert_error_message("\"foo\" is not a number for `rgb'", "rgb(10, \"foo\", 12)");
|
224
|
-
assert_error_message("\"foo\" is not a number for `rgb'", "rgb(10, 10, \"foo\")");
|
222
|
+
assert_error_message("$red: \"foo\" is not a number for `rgb'", "rgb(\"foo\", 10, 12)");
|
223
|
+
assert_error_message("$green: \"foo\" is not a number for `rgb'", "rgb(10, \"foo\", 12)");
|
224
|
+
assert_error_message("$blue: \"foo\" is not a number for `rgb'", "rgb(10, 10, \"foo\")");
|
225
225
|
end
|
226
226
|
|
227
227
|
def test_rgba
|
@@ -232,15 +232,15 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
232
232
|
end
|
233
233
|
|
234
234
|
def test_rgba_tests_bounds
|
235
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
|
235
|
+
assert_error_message("$red: Color value 256 must be between 0 and 255 for `rgba'",
|
236
236
|
"rgba(256, 1, 1, 0.3)")
|
237
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
|
237
|
+
assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgba'",
|
238
238
|
"rgba(1, 256, 1, 0.3)")
|
239
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
|
239
|
+
assert_error_message("$blue: Color value 256 must be between 0 and 255 for `rgba'",
|
240
240
|
"rgba(1, 1, 256, 0.3)")
|
241
|
-
assert_error_message("Color value 256 must be between 0 and 255 for `rgba'",
|
241
|
+
assert_error_message("$green: Color value 256 must be between 0 and 255 for `rgba'",
|
242
242
|
"rgba(1, 256, 257, 0.3)")
|
243
|
-
assert_error_message("Color value -1 must be between 0 and 255 for `rgba'",
|
243
|
+
assert_error_message("$red: Color value -1 must be between 0 and 255 for `rgba'",
|
244
244
|
"rgba(-1, 1, 1, 0.3)")
|
245
245
|
assert_error_message("Alpha channel -0.2 must be between 0 and 1 for `rgba'",
|
246
246
|
"rgba(1, 1, 1, -0.2)")
|
@@ -249,10 +249,10 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
249
249
|
end
|
250
250
|
|
251
251
|
def test_rgba_tests_types
|
252
|
-
assert_error_message("\"foo\" is not a number for `rgba'", "rgba(\"foo\", 10, 12, 0.2)");
|
253
|
-
assert_error_message("\"foo\" is not a number for `rgba'", "rgba(10, \"foo\", 12, 0.1)");
|
254
|
-
assert_error_message("\"foo\" is not a number for `rgba'", "rgba(10, 10, \"foo\", 0)");
|
255
|
-
assert_error_message("\"foo\" is not a number for `rgba'", "rgba(10, 10, 10, \"foo\")");
|
252
|
+
assert_error_message("$red: \"foo\" is not a number for `rgba'", "rgba(\"foo\", 10, 12, 0.2)");
|
253
|
+
assert_error_message("$green: \"foo\" is not a number for `rgba'", "rgba(10, \"foo\", 12, 0.1)");
|
254
|
+
assert_error_message("$blue: \"foo\" is not a number for `rgba'", "rgba(10, 10, \"foo\", 0)");
|
255
|
+
assert_error_message("$alpha: \"foo\" is not a number for `rgba'", "rgba(10, 10, 10, \"foo\")");
|
256
256
|
end
|
257
257
|
|
258
258
|
def test_rgba_with_color
|
@@ -262,8 +262,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
262
262
|
end
|
263
263
|
|
264
264
|
def test_rgba_with_color_tests_types
|
265
|
-
assert_error_message("\"foo\" is not a color for `rgba'", "rgba(\"foo\", 0.2)");
|
266
|
-
assert_error_message("\"foo\" is not a number for `rgba'", "rgba(blue, \"foo\")");
|
265
|
+
assert_error_message("$color: \"foo\" is not a color for `rgba'", "rgba(\"foo\", 0.2)");
|
266
|
+
assert_error_message("$alpha: \"foo\" is not a number for `rgba'", "rgba(blue, \"foo\")");
|
267
267
|
end
|
268
268
|
|
269
269
|
def test_rgba_tests_num_args
|
@@ -279,7 +279,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
279
279
|
end
|
280
280
|
|
281
281
|
def test_red_exception
|
282
|
-
assert_error_message("12 is not a color for `red'", "red(12)")
|
282
|
+
assert_error_message("$color: 12 is not a color for `red'", "red(12)")
|
283
283
|
end
|
284
284
|
|
285
285
|
def test_green
|
@@ -288,7 +288,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
288
288
|
end
|
289
289
|
|
290
290
|
def test_green_exception
|
291
|
-
assert_error_message("12 is not a color for `green'", "green(12)")
|
291
|
+
assert_error_message("$color: 12 is not a color for `green'", "green(12)")
|
292
292
|
end
|
293
293
|
|
294
294
|
def test_blue
|
@@ -297,7 +297,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
297
297
|
end
|
298
298
|
|
299
299
|
def test_blue_exception
|
300
|
-
assert_error_message("12 is not a color for `blue'", "blue(12)")
|
300
|
+
assert_error_message("$color: 12 is not a color for `blue'", "blue(12)")
|
301
301
|
end
|
302
302
|
|
303
303
|
def test_hue
|
@@ -306,7 +306,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
306
306
|
end
|
307
307
|
|
308
308
|
def test_hue_exception
|
309
|
-
assert_error_message("12 is not a color for `hue'", "hue(12)")
|
309
|
+
assert_error_message("$color: 12 is not a color for `hue'", "hue(12)")
|
310
310
|
end
|
311
311
|
|
312
312
|
def test_saturation
|
@@ -316,7 +316,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
316
316
|
end
|
317
317
|
|
318
318
|
def test_saturation_exception
|
319
|
-
assert_error_message("12 is not a color for `saturation'", "saturation(12)")
|
319
|
+
assert_error_message("$color: 12 is not a color for `saturation'", "saturation(12)")
|
320
320
|
end
|
321
321
|
|
322
322
|
def test_lightness
|
@@ -326,7 +326,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
326
326
|
end
|
327
327
|
|
328
328
|
def test_lightness_exception
|
329
|
-
assert_error_message("12 is not a color for `lightness'", "lightness(12)")
|
329
|
+
assert_error_message("$color: 12 is not a color for `lightness'", "lightness(12)")
|
330
330
|
end
|
331
331
|
|
332
332
|
def test_alpha
|
@@ -337,7 +337,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
337
337
|
end
|
338
338
|
|
339
339
|
def test_alpha_exception
|
340
|
-
assert_error_message("12 is not a color for `alpha'", "alpha(12)")
|
340
|
+
assert_error_message("$color: 12 is not a color for `alpha'", "alpha(12)")
|
341
341
|
end
|
342
342
|
|
343
343
|
def test_opacity
|
@@ -349,7 +349,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
349
349
|
end
|
350
350
|
|
351
351
|
def test_opacity_exception
|
352
|
-
assert_error_message("\"foo\" is not a color for `opacity'", "opacity(foo)")
|
352
|
+
assert_error_message("$color: \"foo\" is not a color for `opacity'", "opacity(foo)")
|
353
353
|
end
|
354
354
|
|
355
355
|
def test_opacify
|
@@ -371,8 +371,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
371
371
|
end
|
372
372
|
|
373
373
|
def test_opacify_tests_types
|
374
|
-
assert_error_message("\"foo\" is not a color for `opacify'", "opacify(\"foo\", 10%)")
|
375
|
-
assert_error_message("\"foo\" is not a number for `opacify'", "opacify(#fff, \"foo\")")
|
374
|
+
assert_error_message("$color: \"foo\" is not a color for `opacify'", "opacify(\"foo\", 10%)")
|
375
|
+
assert_error_message("$amount: \"foo\" is not a number for `opacify'", "opacify(#fff, \"foo\")")
|
376
376
|
end
|
377
377
|
|
378
378
|
def test_transparentize
|
@@ -394,8 +394,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
394
394
|
end
|
395
395
|
|
396
396
|
def test_transparentize_tests_types
|
397
|
-
assert_error_message("\"foo\" is not a color for `transparentize'", "transparentize(\"foo\", 10%)")
|
398
|
-
assert_error_message("\"foo\" is not a number for `transparentize'", "transparentize(#fff, \"foo\")")
|
397
|
+
assert_error_message("$color: \"foo\" is not a color for `transparentize'", "transparentize(\"foo\", 10%)")
|
398
|
+
assert_error_message("$amount: \"foo\" is not a number for `transparentize'", "transparentize(#fff, \"foo\")")
|
399
399
|
end
|
400
400
|
|
401
401
|
def test_lighten
|
@@ -416,8 +416,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
416
416
|
end
|
417
417
|
|
418
418
|
def test_lighten_tests_types
|
419
|
-
assert_error_message("\"foo\" is not a color for `lighten'", "lighten(\"foo\", 10%)")
|
420
|
-
assert_error_message("\"foo\" is not a number for `lighten'", "lighten(#fff, \"foo\")")
|
419
|
+
assert_error_message("$color: \"foo\" is not a color for `lighten'", "lighten(\"foo\", 10%)")
|
420
|
+
assert_error_message("$amount: \"foo\" is not a number for `lighten'", "lighten(#fff, \"foo\")")
|
421
421
|
end
|
422
422
|
|
423
423
|
def test_darken
|
@@ -438,8 +438,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
438
438
|
end
|
439
439
|
|
440
440
|
def test_darken_tests_types
|
441
|
-
assert_error_message("\"foo\" is not a color for `darken'", "darken(\"foo\", 10%)")
|
442
|
-
assert_error_message("\"foo\" is not a number for `darken'", "darken(#fff, \"foo\")")
|
441
|
+
assert_error_message("$color: \"foo\" is not a color for `darken'", "darken(\"foo\", 10%)")
|
442
|
+
assert_error_message("$amount: \"foo\" is not a number for `darken'", "darken(#fff, \"foo\")")
|
443
443
|
end
|
444
444
|
|
445
445
|
def test_saturate
|
@@ -462,8 +462,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
462
462
|
end
|
463
463
|
|
464
464
|
def test_saturate_tests_types
|
465
|
-
assert_error_message("\"foo\" is not a color for `saturate'", "saturate(\"foo\", 10%)")
|
466
|
-
assert_error_message("\"foo\" is not a number for `saturate'", "saturate(#fff, \"foo\")")
|
465
|
+
assert_error_message("$color: \"foo\" is not a color for `saturate'", "saturate(\"foo\", 10%)")
|
466
|
+
assert_error_message("$amount: \"foo\" is not a number for `saturate'", "saturate(#fff, \"foo\")")
|
467
467
|
end
|
468
468
|
|
469
469
|
def test_desaturate
|
@@ -485,8 +485,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
485
485
|
end
|
486
486
|
|
487
487
|
def test_desaturate_tests_types
|
488
|
-
assert_error_message("\"foo\" is not a color for `desaturate'", "desaturate(\"foo\", 10%)")
|
489
|
-
assert_error_message("\"foo\" is not a number for `desaturate'", "desaturate(#fff, \"foo\")")
|
488
|
+
assert_error_message("$color: \"foo\" is not a color for `desaturate'", "desaturate(\"foo\", 10%)")
|
489
|
+
assert_error_message("$amount: \"foo\" is not a number for `desaturate'", "desaturate(#fff, \"foo\")")
|
490
490
|
end
|
491
491
|
|
492
492
|
def test_adjust_hue
|
@@ -502,8 +502,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
502
502
|
end
|
503
503
|
|
504
504
|
def test_adjust_hue_tests_types
|
505
|
-
assert_error_message("\"foo\" is not a color for `adjust-hue'", "adjust-hue(\"foo\", 10%)")
|
506
|
-
assert_error_message("\"foo\" is not a number for `adjust-hue'", "adjust-hue(#fff, \"foo\")")
|
505
|
+
assert_error_message("$color: \"foo\" is not a color for `adjust-hue'", "adjust-hue(\"foo\", 10%)")
|
506
|
+
assert_error_message("$degrees: \"foo\" is not a number for `adjust-hue'", "adjust-hue(#fff, \"foo\")")
|
507
507
|
end
|
508
508
|
|
509
509
|
def test_adjust_color
|
@@ -561,7 +561,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
561
561
|
end
|
562
562
|
|
563
563
|
def test_adjust_color_tests_types
|
564
|
-
assert_error_message("\"foo\" is not a color for `adjust-color'", "adjust-color(foo, $hue: 10)")
|
564
|
+
assert_error_message("$color: \"foo\" is not a color for `adjust-color'", "adjust-color(foo, $hue: 10)")
|
565
565
|
# HSL
|
566
566
|
assert_error_message("$hue: \"foo\" is not a number for `adjust-color'",
|
567
567
|
"adjust-color(blue, $hue: foo)")
|
@@ -667,7 +667,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
667
667
|
end
|
668
668
|
|
669
669
|
def test_scale_color_tests_types
|
670
|
-
assert_error_message("\"foo\" is not a color for `scale-color'", "scale-color(foo, $red: 10%)")
|
670
|
+
assert_error_message("$color: \"foo\" is not a color for `scale-color'", "scale-color(foo, $red: 10%)")
|
671
671
|
# HSL
|
672
672
|
assert_error_message("$saturation: \"foo\" is not a number for `scale-color'",
|
673
673
|
"scale-color(blue, $saturation: foo)")
|
@@ -738,7 +738,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
738
738
|
end
|
739
739
|
|
740
740
|
def test_change_color_tests_types
|
741
|
-
assert_error_message("\"foo\" is not a color for `change-color'", "change-color(foo, $red: 10%)")
|
741
|
+
assert_error_message("$color: \"foo\" is not a color for `change-color'", "change-color(foo, $red: 10%)")
|
742
742
|
# HSL
|
743
743
|
assert_error_message("$saturation: \"foo\" is not a number for `change-color'",
|
744
744
|
"change-color(blue, $saturation: foo)")
|
@@ -801,9 +801,9 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
801
801
|
end
|
802
802
|
|
803
803
|
def test_mix_tests_types
|
804
|
-
assert_error_message("\"foo\" is not a color for `mix'", "mix(\"foo\", #f00, 10%)")
|
805
|
-
assert_error_message("\"foo\" is not a color for `mix'", "mix(#f00, \"foo\", 10%)")
|
806
|
-
assert_error_message("\"foo\" is not a number for `mix'", "mix(#f00, #baf, \"foo\")")
|
804
|
+
assert_error_message("$color-1: \"foo\" is not a color for `mix'", "mix(\"foo\", #f00, 10%)")
|
805
|
+
assert_error_message("$color-2: \"foo\" is not a color for `mix'", "mix(#f00, \"foo\", 10%)")
|
806
|
+
assert_error_message("$weight: \"foo\" is not a number for `mix'", "mix(#f00, #baf, \"foo\")")
|
807
807
|
end
|
808
808
|
|
809
809
|
def test_mix_tests_bounds
|
@@ -826,7 +826,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
826
826
|
end
|
827
827
|
|
828
828
|
def tets_grayscale_tests_types
|
829
|
-
assert_error_message("\"foo\" is not a color for `grayscale'", "grayscale(\"foo\")")
|
829
|
+
assert_error_message("$color: \"foo\" is not a color for `grayscale'", "grayscale(\"foo\")")
|
830
830
|
end
|
831
831
|
|
832
832
|
def test_complement
|
@@ -839,7 +839,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
839
839
|
end
|
840
840
|
|
841
841
|
def tets_complement_tests_types
|
842
|
-
assert_error_message("\"foo\" is not a color for `complement'", "complement(\"foo\")")
|
842
|
+
assert_error_message("$color: \"foo\" is not a color for `complement'", "complement(\"foo\")")
|
843
843
|
end
|
844
844
|
|
845
845
|
def test_invert
|
@@ -849,7 +849,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
849
849
|
end
|
850
850
|
|
851
851
|
def test_invert_tests_types
|
852
|
-
assert_error_message("\"foo\" is not a color for `invert'", "invert(\"foo\")")
|
852
|
+
assert_error_message("$color: \"foo\" is not a color for `invert'", "invert(\"foo\")")
|
853
853
|
end
|
854
854
|
|
855
855
|
def test_unquote
|
@@ -865,7 +865,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
865
865
|
end
|
866
866
|
|
867
867
|
def test_quote_tests_type
|
868
|
-
assert_error_message("#ff0000 is not a string for `quote'", "quote(#f00)")
|
868
|
+
assert_error_message("$string: #ff0000 is not a string for `quote'", "quote(#f00)")
|
869
869
|
end
|
870
870
|
|
871
871
|
def test_str_length
|
@@ -873,7 +873,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
873
873
|
end
|
874
874
|
|
875
875
|
def test_str_length_requires_a_string
|
876
|
-
assert_error_message("#ff0000 is not a string for `str-length'", "str-length(#f00)")
|
876
|
+
assert_error_message("$string: #ff0000 is not a string for `str-length'", "str-length(#f00)")
|
877
877
|
end
|
878
878
|
|
879
879
|
def test_str_insert
|
@@ -893,7 +893,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
893
893
|
end
|
894
894
|
|
895
895
|
def test_str_insert_asserts_types
|
896
|
-
assert_error_message("$
|
896
|
+
assert_error_message("$string: #ff0000 is not a string for `str-insert'", "str-insert(#f00, X, 1)")
|
897
897
|
assert_error_message("$insert: #ff0000 is not a string for `str-insert'", "str-insert(foo, #f00, 1)")
|
898
898
|
assert_error_message("$index: #ff0000 is not a number for `str-insert'", "str-insert(foo, X, #f00)")
|
899
899
|
assert_error_message("Expected $index to be unitless but got 10px for `str-insert'", "str-insert(foo, X, 10px)")
|
@@ -907,20 +907,20 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
907
907
|
end
|
908
908
|
|
909
909
|
def test_str_index_asserts_types
|
910
|
-
assert_error_message("#ff0000 is not a string for `str-index'", "str-index(#f00, X)")
|
911
|
-
assert_error_message("#ff0000 is not a string for `str-index'", "str-index(asdf, #f00)")
|
910
|
+
assert_error_message("$string: #ff0000 is not a string for `str-index'", "str-index(#f00, X)")
|
911
|
+
assert_error_message("$substring: #ff0000 is not a string for `str-index'", "str-index(asdf, #f00)")
|
912
912
|
end
|
913
913
|
|
914
914
|
def test_to_lower_case
|
915
915
|
assert_equal('abcd', evaluate('to-lower-case(ABCD)'))
|
916
916
|
assert_equal('"abcd"', evaluate('to-lower-case("ABCD")'))
|
917
|
-
assert_error_message("#ff0000 is not a string for `to-lower-case'", "to-lower-case(#f00)")
|
917
|
+
assert_error_message("$string: #ff0000 is not a string for `to-lower-case'", "to-lower-case(#f00)")
|
918
918
|
end
|
919
919
|
|
920
920
|
def test_to_upper_case
|
921
921
|
assert_equal('ABCD', evaluate('to-upper-case(abcd)'))
|
922
922
|
assert_equal('"ABCD"', evaluate('to-upper-case("abcd")'))
|
923
|
-
assert_error_message("#ff0000 is not a string for `to-upper-case'", "to-upper-case(#f00)")
|
923
|
+
assert_error_message("$string: #ff0000 is not a string for `to-upper-case'", "to-upper-case(#f00)")
|
924
924
|
end
|
925
925
|
|
926
926
|
def test_str_slice
|
@@ -937,7 +937,7 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
937
937
|
assert_equal('bc', evaluate('str-slice(abcd,2,-2)')) # when end is negative it counts in from the end
|
938
938
|
assert_equal('', evaluate('str-slice(abcd,3,-3)')) # when end is negative and comes before the start
|
939
939
|
assert_equal('bc', evaluate('str-slice(abcd,-3,-2)')) # when both are negative
|
940
|
-
assert_error_message("#ff0000 is not a string for `str-slice'", "str-slice(#f00,2,3)")
|
940
|
+
assert_error_message("$string: #ff0000 is not a string for `str-slice'", "str-slice(#f00,2,3)")
|
941
941
|
assert_error_message("$start-at: #ff0000 is not a number for `str-slice'", "str-slice(abcd,#f00,3)")
|
942
942
|
assert_error_message("$end-at: #ff0000 is not a number for `str-slice'", "str-slice(abcd,2,#f00)")
|
943
943
|
assert_error_message("Expected $end-at to be unitless but got 3px for `str-slice'", "str-slice(abcd,2,3px)")
|
@@ -997,14 +997,14 @@ MSG
|
|
997
997
|
assert_equal(%Q{"em/rem"}, evaluate("unit(10px * 5em / 30cm / 1rem)"))
|
998
998
|
assert_equal(%Q{"em*vh/cm*rem"}, evaluate("unit(10vh * 5em / 30cm / 1rem)"))
|
999
999
|
assert_equal(%Q{"px"}, evaluate("unit($number: 100px)"))
|
1000
|
-
assert_error_message("#ff0000 is not a number for `unit'", "unit(#f00)")
|
1000
|
+
assert_error_message("$number: #ff0000 is not a number for `unit'", "unit(#f00)")
|
1001
1001
|
end
|
1002
1002
|
|
1003
1003
|
def test_unitless
|
1004
1004
|
assert_equal(%Q{true}, evaluate("unitless(100)"))
|
1005
1005
|
assert_equal(%Q{false}, evaluate("unitless(100px)"))
|
1006
1006
|
assert_equal(%Q{false}, evaluate("unitless($number: 100px)"))
|
1007
|
-
assert_error_message("#ff0000 is not a number for `unitless'", "unitless(#f00)")
|
1007
|
+
assert_error_message("$number: #ff0000 is not a number for `unitless'", "unitless(#f00)")
|
1008
1008
|
end
|
1009
1009
|
|
1010
1010
|
def test_comparable
|
@@ -1012,8 +1012,8 @@ MSG
|
|
1012
1012
|
assert_equal(%Q{true}, evaluate("comparable(10cm, 3mm)"))
|
1013
1013
|
assert_equal(%Q{false}, evaluate("comparable(100px, 3em)"))
|
1014
1014
|
assert_equal(%Q{false}, evaluate("comparable($number-1: 100px, $number-2: 3em)"))
|
1015
|
-
assert_error_message("#ff0000 is not a number for `comparable'", "comparable(#f00, 1px)")
|
1016
|
-
assert_error_message("#ff0000 is not a number for `comparable'", "comparable(1px, #f00)")
|
1015
|
+
assert_error_message("$number-1: #ff0000 is not a number for `comparable'", "comparable(#f00, 1px)")
|
1016
|
+
assert_error_message("$number-2: #ff0000 is not a number for `comparable'", "comparable(1px, #f00)")
|
1017
1017
|
end
|
1018
1018
|
|
1019
1019
|
def test_length
|
@@ -1040,6 +1040,7 @@ MSG
|
|
1040
1040
|
assert_error_message("List index is 5 but list is only 4 items long for `nth'", "nth(1 2 3 4, 5)")
|
1041
1041
|
assert_error_message("List index is 2 but list is only 1 item long for `nth'", "nth(foo, 2)")
|
1042
1042
|
assert_error_message("List index is 1 but list has no items for `nth'", "nth((), 1)")
|
1043
|
+
assert_error_message("$n: \"foo\" is not a number for `nth'", "nth(1 2 3, foo)")
|
1043
1044
|
end
|
1044
1045
|
|
1045
1046
|
def test_join
|
@@ -1078,6 +1079,7 @@ MSG
|
|
1078
1079
|
assert_equal("false", evaluate("(1, 2, ()) == join((), (1, 2))"))
|
1079
1080
|
|
1080
1081
|
assert_error_message("Separator name must be space, comma, or auto for `join'", "join(1, 2, baboon)")
|
1082
|
+
assert_error_message("$separator: 12 is not a string for `join'", "join(1, 2, 12)")
|
1081
1083
|
end
|
1082
1084
|
|
1083
1085
|
def test_append
|
@@ -1112,6 +1114,7 @@ MSG
|
|
1112
1114
|
assert_equal("true", evaluate("(1 2) == nth(append((), 1 2), 1)"))
|
1113
1115
|
|
1114
1116
|
assert_error_message("Separator name must be space, comma, or auto for `append'", "append(1, 2, baboon)")
|
1117
|
+
assert_error_message("$separator: 12 is not a string for `append'", "append(1, 2, 12)")
|
1115
1118
|
end
|
1116
1119
|
|
1117
1120
|
def test_zip
|