sass 3.1.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +11 -0
- data/CONTRIBUTING +3 -0
- data/EDGE_GEM_VERSION +1 -0
- data/MIT-LICENSE +20 -0
- data/README.md +201 -0
- data/REVISION +1 -0
- data/Rakefile +353 -0
- data/VERSION +1 -0
- data/VERSION_NAME +1 -0
- data/bin/css2sass +13 -0
- data/bin/sass +8 -0
- data/bin/sass-convert +7 -0
- data/extra/update_watch.rb +13 -0
- data/init.rb +18 -0
- data/lib/sass.rb +71 -0
- data/lib/sass/cache_store.rb +208 -0
- data/lib/sass/callbacks.rb +66 -0
- data/lib/sass/css.rb +294 -0
- data/lib/sass/engine.rb +792 -0
- data/lib/sass/environment.rb +143 -0
- data/lib/sass/error.rb +201 -0
- data/lib/sass/exec.rb +619 -0
- data/lib/sass/importers.rb +22 -0
- data/lib/sass/importers/base.rb +138 -0
- data/lib/sass/importers/filesystem.rb +121 -0
- data/lib/sass/less.rb +363 -0
- data/lib/sass/plugin.rb +126 -0
- data/lib/sass/plugin/compiler.rb +346 -0
- data/lib/sass/plugin/configuration.rb +123 -0
- data/lib/sass/plugin/generic.rb +15 -0
- data/lib/sass/plugin/merb.rb +48 -0
- data/lib/sass/plugin/rack.rb +47 -0
- data/lib/sass/plugin/rails.rb +41 -0
- data/lib/sass/plugin/staleness_checker.rb +145 -0
- data/lib/sass/railtie.rb +8 -0
- data/lib/sass/repl.rb +58 -0
- data/lib/sass/root.rb +7 -0
- data/lib/sass/script.rb +63 -0
- data/lib/sass/script/bool.rb +18 -0
- data/lib/sass/script/color.rb +490 -0
- data/lib/sass/script/css_lexer.rb +29 -0
- data/lib/sass/script/css_parser.rb +31 -0
- data/lib/sass/script/funcall.rb +78 -0
- data/lib/sass/script/functions.rb +852 -0
- data/lib/sass/script/interpolation.rb +70 -0
- data/lib/sass/script/lexer.rb +337 -0
- data/lib/sass/script/literal.rb +236 -0
- data/lib/sass/script/node.rb +101 -0
- data/lib/sass/script/number.rb +420 -0
- data/lib/sass/script/operation.rb +92 -0
- data/lib/sass/script/parser.rb +392 -0
- data/lib/sass/script/string.rb +67 -0
- data/lib/sass/script/string_interpolation.rb +93 -0
- data/lib/sass/script/unary_operation.rb +57 -0
- data/lib/sass/script/variable.rb +48 -0
- data/lib/sass/scss.rb +17 -0
- data/lib/sass/scss/css_parser.rb +51 -0
- data/lib/sass/scss/parser.rb +838 -0
- data/lib/sass/scss/rx.rb +126 -0
- data/lib/sass/scss/sass_parser.rb +11 -0
- data/lib/sass/scss/script_lexer.rb +15 -0
- data/lib/sass/scss/script_parser.rb +25 -0
- data/lib/sass/scss/static_parser.rb +40 -0
- data/lib/sass/selector.rb +361 -0
- data/lib/sass/selector/abstract_sequence.rb +62 -0
- data/lib/sass/selector/comma_sequence.rb +82 -0
- data/lib/sass/selector/sequence.rb +236 -0
- data/lib/sass/selector/simple.rb +113 -0
- data/lib/sass/selector/simple_sequence.rb +135 -0
- data/lib/sass/shared.rb +78 -0
- data/lib/sass/tree/comment_node.rb +128 -0
- data/lib/sass/tree/debug_node.rb +36 -0
- data/lib/sass/tree/directive_node.rb +75 -0
- data/lib/sass/tree/extend_node.rb +65 -0
- data/lib/sass/tree/for_node.rb +67 -0
- data/lib/sass/tree/if_node.rb +81 -0
- data/lib/sass/tree/import_node.rb +124 -0
- data/lib/sass/tree/mixin_def_node.rb +60 -0
- data/lib/sass/tree/mixin_node.rb +123 -0
- data/lib/sass/tree/node.rb +490 -0
- data/lib/sass/tree/prop_node.rb +220 -0
- data/lib/sass/tree/root_node.rb +125 -0
- data/lib/sass/tree/rule_node.rb +273 -0
- data/lib/sass/tree/variable_node.rb +39 -0
- data/lib/sass/tree/warn_node.rb +42 -0
- data/lib/sass/tree/while_node.rb +48 -0
- data/lib/sass/util.rb +687 -0
- data/lib/sass/util/subset_map.rb +101 -0
- data/lib/sass/version.rb +109 -0
- data/rails/init.rb +1 -0
- data/test/sass/cache_test.rb +74 -0
- data/test/sass/callbacks_test.rb +61 -0
- data/test/sass/conversion_test.rb +1210 -0
- data/test/sass/css2sass_test.rb +364 -0
- data/test/sass/data/hsl-rgb.txt +319 -0
- data/test/sass/engine_test.rb +2273 -0
- data/test/sass/extend_test.rb +1348 -0
- data/test/sass/functions_test.rb +565 -0
- data/test/sass/importer_test.rb +104 -0
- data/test/sass/less_conversion_test.rb +632 -0
- data/test/sass/mock_importer.rb +49 -0
- data/test/sass/more_results/more1.css +9 -0
- data/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/test/sass/more_results/more_import.css +29 -0
- data/test/sass/more_templates/_more_partial.sass +2 -0
- data/test/sass/more_templates/more1.sass +23 -0
- data/test/sass/more_templates/more_import.sass +11 -0
- data/test/sass/plugin_test.rb +430 -0
- data/test/sass/results/alt.css +4 -0
- data/test/sass/results/basic.css +9 -0
- data/test/sass/results/compact.css +5 -0
- data/test/sass/results/complex.css +86 -0
- data/test/sass/results/compressed.css +1 -0
- data/test/sass/results/expanded.css +19 -0
- data/test/sass/results/import.css +31 -0
- data/test/sass/results/line_numbers.css +49 -0
- data/test/sass/results/mixins.css +95 -0
- data/test/sass/results/multiline.css +24 -0
- data/test/sass/results/nested.css +22 -0
- data/test/sass/results/options.css +1 -0
- data/test/sass/results/parent_ref.css +13 -0
- data/test/sass/results/script.css +16 -0
- data/test/sass/results/scss_import.css +31 -0
- data/test/sass/results/scss_importee.css +2 -0
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/test/sass/results/subdir/subdir.css +3 -0
- data/test/sass/results/units.css +11 -0
- data/test/sass/results/warn.css +0 -0
- data/test/sass/results/warn_imported.css +0 -0
- data/test/sass/script_conversion_test.rb +254 -0
- data/test/sass/script_test.rb +459 -0
- data/test/sass/scss/css_test.rb +897 -0
- data/test/sass/scss/rx_test.rb +156 -0
- data/test/sass/scss/scss_test.rb +1088 -0
- data/test/sass/scss/test_helper.rb +37 -0
- data/test/sass/templates/_partial.sass +2 -0
- data/test/sass/templates/alt.sass +16 -0
- data/test/sass/templates/basic.sass +23 -0
- data/test/sass/templates/bork1.sass +2 -0
- data/test/sass/templates/bork2.sass +2 -0
- data/test/sass/templates/bork3.sass +2 -0
- data/test/sass/templates/bork4.sass +2 -0
- data/test/sass/templates/compact.sass +17 -0
- data/test/sass/templates/complex.sass +305 -0
- data/test/sass/templates/compressed.sass +15 -0
- data/test/sass/templates/expanded.sass +17 -0
- data/test/sass/templates/import.sass +12 -0
- data/test/sass/templates/importee.less +2 -0
- data/test/sass/templates/importee.sass +19 -0
- data/test/sass/templates/line_numbers.sass +13 -0
- data/test/sass/templates/mixin_bork.sass +5 -0
- data/test/sass/templates/mixins.sass +76 -0
- data/test/sass/templates/multiline.sass +20 -0
- data/test/sass/templates/nested.sass +25 -0
- data/test/sass/templates/nested_bork1.sass +2 -0
- data/test/sass/templates/nested_bork2.sass +2 -0
- data/test/sass/templates/nested_bork3.sass +2 -0
- data/test/sass/templates/nested_bork4.sass +2 -0
- data/test/sass/templates/nested_mixin_bork.sass +6 -0
- data/test/sass/templates/options.sass +2 -0
- data/test/sass/templates/parent_ref.sass +25 -0
- data/test/sass/templates/script.sass +101 -0
- data/test/sass/templates/scss_import.scss +11 -0
- data/test/sass/templates/scss_importee.scss +1 -0
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/test/sass/templates/subdir/subdir.sass +6 -0
- data/test/sass/templates/units.sass +11 -0
- data/test/sass/templates/warn.sass +3 -0
- data/test/sass/templates/warn_imported.sass +4 -0
- data/test/sass/test_helper.rb +8 -0
- data/test/sass/util/subset_map_test.rb +91 -0
- data/test/sass/util_test.rb +275 -0
- data/test/test_helper.rb +64 -0
- data/vendor/fssm/LICENSE +20 -0
- data/vendor/fssm/README.markdown +55 -0
- data/vendor/fssm/Rakefile +59 -0
- data/vendor/fssm/VERSION.yml +5 -0
- data/vendor/fssm/example.rb +9 -0
- data/vendor/fssm/fssm.gemspec +77 -0
- data/vendor/fssm/lib/fssm.rb +33 -0
- data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
- data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
- data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
- data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
- data/vendor/fssm/lib/fssm/monitor.rb +26 -0
- data/vendor/fssm/lib/fssm/path.rb +91 -0
- data/vendor/fssm/lib/fssm/pathname.rb +502 -0
- data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
- data/vendor/fssm/lib/fssm/state/file.rb +24 -0
- data/vendor/fssm/lib/fssm/support.rb +63 -0
- data/vendor/fssm/lib/fssm/tree.rb +176 -0
- data/vendor/fssm/profile/prof-cache.rb +40 -0
- data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
- data/vendor/fssm/profile/prof-pathname.rb +68 -0
- data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
- data/vendor/fssm/profile/prof.html +2379 -0
- data/vendor/fssm/spec/path_spec.rb +75 -0
- data/vendor/fssm/spec/root/duck/quack.txt +0 -0
- data/vendor/fssm/spec/root/file.css +0 -0
- data/vendor/fssm/spec/root/file.rb +0 -0
- data/vendor/fssm/spec/root/file.yml +0 -0
- data/vendor/fssm/spec/root/moo/cow.txt +0 -0
- data/vendor/fssm/spec/spec_helper.rb +14 -0
- metadata +297 -0
@@ -0,0 +1,364 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'test/unit'
|
3
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
4
|
+
require 'sass/css'
|
5
|
+
|
6
|
+
class CSS2SassTest < Test::Unit::TestCase
|
7
|
+
def test_basic
|
8
|
+
css = <<CSS
|
9
|
+
h1 {
|
10
|
+
color: red;
|
11
|
+
}
|
12
|
+
CSS
|
13
|
+
assert_equal(<<SASS, css2sass(css))
|
14
|
+
h1
|
15
|
+
color: red
|
16
|
+
SASS
|
17
|
+
assert_equal(<<SASS, css2sass(css, :old => true))
|
18
|
+
h1
|
19
|
+
:color red
|
20
|
+
SASS
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_nesting
|
24
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
25
|
+
li
|
26
|
+
display: none
|
27
|
+
a
|
28
|
+
text-decoration: none
|
29
|
+
span
|
30
|
+
color: yellow
|
31
|
+
&:hover
|
32
|
+
text-decoration: underline
|
33
|
+
SASS
|
34
|
+
li {
|
35
|
+
display: none;
|
36
|
+
}
|
37
|
+
|
38
|
+
li a {
|
39
|
+
text-decoration: none;
|
40
|
+
}
|
41
|
+
|
42
|
+
li a span {
|
43
|
+
color: yellow;
|
44
|
+
}
|
45
|
+
|
46
|
+
li a:hover {
|
47
|
+
text-decoration: underline;
|
48
|
+
}
|
49
|
+
CSS
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_no_nesting_around_rules
|
53
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
54
|
+
div .warning
|
55
|
+
color: #d21a19
|
56
|
+
|
57
|
+
span .debug
|
58
|
+
cursor: crosshair
|
59
|
+
|
60
|
+
div .debug
|
61
|
+
cursor: default
|
62
|
+
SASS
|
63
|
+
div .warning {
|
64
|
+
color: #d21a19; }
|
65
|
+
span .debug {
|
66
|
+
cursor: crosshair;}
|
67
|
+
div .debug {
|
68
|
+
cursor: default; }
|
69
|
+
CSS
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_comments_multiline
|
73
|
+
css = <<CSS
|
74
|
+
/* comment */
|
75
|
+
elephant.rawr {
|
76
|
+
rampages: excessively;
|
77
|
+
}
|
78
|
+
|
79
|
+
/* actual multiline
|
80
|
+
comment */
|
81
|
+
span.turkey {
|
82
|
+
isdinner: true;
|
83
|
+
}
|
84
|
+
|
85
|
+
.turducken {
|
86
|
+
/* Sounds funny
|
87
|
+
doesn't it */
|
88
|
+
chimera: not_really;
|
89
|
+
}
|
90
|
+
|
91
|
+
#overhere {
|
92
|
+
bored: sorta; /* it's for a good
|
93
|
+
cause */
|
94
|
+
better_than: thread_pools;
|
95
|
+
}
|
96
|
+
|
97
|
+
#one_more {
|
98
|
+
finally: srsly;
|
99
|
+
} /* just a line here */
|
100
|
+
CSS
|
101
|
+
sass = <<SASS
|
102
|
+
/* comment
|
103
|
+
|
104
|
+
elephant.rawr
|
105
|
+
rampages: excessively
|
106
|
+
|
107
|
+
/* actual multiline
|
108
|
+
*comment
|
109
|
+
|
110
|
+
span.turkey
|
111
|
+
isdinner: true
|
112
|
+
|
113
|
+
.turducken
|
114
|
+
/* Sounds funny
|
115
|
+
* doesn't it
|
116
|
+
chimera: not_really
|
117
|
+
|
118
|
+
#overhere
|
119
|
+
bored: sorta
|
120
|
+
/* it's for a good
|
121
|
+
* cause
|
122
|
+
better_than: thread_pools
|
123
|
+
|
124
|
+
#one_more
|
125
|
+
finally: srsly
|
126
|
+
|
127
|
+
/* just a line here
|
128
|
+
SASS
|
129
|
+
assert_equal(sass, css2sass(css))
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_fold_commas
|
133
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
134
|
+
li
|
135
|
+
.one, .two
|
136
|
+
color: red
|
137
|
+
SASS
|
138
|
+
li .one {
|
139
|
+
color: red;
|
140
|
+
}
|
141
|
+
li .two {
|
142
|
+
color: red;
|
143
|
+
}
|
144
|
+
CSS
|
145
|
+
|
146
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
147
|
+
.one
|
148
|
+
color: green
|
149
|
+
|
150
|
+
.two
|
151
|
+
color: green
|
152
|
+
color: red
|
153
|
+
|
154
|
+
.three
|
155
|
+
color: red
|
156
|
+
SASS
|
157
|
+
.one, .two {
|
158
|
+
color: green;
|
159
|
+
}
|
160
|
+
|
161
|
+
.two, .three {
|
162
|
+
color: red;
|
163
|
+
}
|
164
|
+
CSS
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_bad_formatting
|
168
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
169
|
+
hello
|
170
|
+
parent: true
|
171
|
+
there
|
172
|
+
parent: false
|
173
|
+
who
|
174
|
+
hoo: false
|
175
|
+
why
|
176
|
+
y: true
|
177
|
+
when
|
178
|
+
wen: nao
|
179
|
+
|
180
|
+
down_here
|
181
|
+
yeah: true
|
182
|
+
SASS
|
183
|
+
hello {
|
184
|
+
parent: true;
|
185
|
+
}
|
186
|
+
|
187
|
+
hello there {
|
188
|
+
parent: false;
|
189
|
+
}
|
190
|
+
hello who {
|
191
|
+
hoo: false;
|
192
|
+
}
|
193
|
+
hello why {
|
194
|
+
y: true;
|
195
|
+
}
|
196
|
+
hello when {
|
197
|
+
wen: nao;
|
198
|
+
}
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
down_here { yeah: true; }
|
203
|
+
CSS
|
204
|
+
end
|
205
|
+
|
206
|
+
def test_comments_in_selectors
|
207
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
208
|
+
.js
|
209
|
+
#location-navigation-form .form-submit, #business-listing-form .form-submit, #detailTabs ul, #detailsEnhanced #addTags, #locationSearchList, #moreHoods
|
210
|
+
display: none
|
211
|
+
|
212
|
+
#navListLeft
|
213
|
+
display: none
|
214
|
+
SASS
|
215
|
+
.js #location-navigation-form .form-submit,
|
216
|
+
.js #business-listing-form .form-submit,
|
217
|
+
.js #detailTabs ul,
|
218
|
+
/* .js #addReview, */
|
219
|
+
/* .js #addTags, */
|
220
|
+
.js #detailsEnhanced #addTags,
|
221
|
+
.js #locationSearchList,
|
222
|
+
.js #moreHoods,
|
223
|
+
#navListLeft
|
224
|
+
{ display: none; }
|
225
|
+
CSS
|
226
|
+
end
|
227
|
+
|
228
|
+
def test_pseudo_classes_are_escaped
|
229
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
230
|
+
\\:focus
|
231
|
+
a: b
|
232
|
+
\\:foo
|
233
|
+
bar: baz
|
234
|
+
SASS
|
235
|
+
:focus {a: b;}
|
236
|
+
:focus :foo {bar: baz;}
|
237
|
+
CSS
|
238
|
+
end
|
239
|
+
|
240
|
+
# Regressions
|
241
|
+
|
242
|
+
def test_nesting_within_media
|
243
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
244
|
+
@media all
|
245
|
+
.next .vevent
|
246
|
+
padding-left: 0
|
247
|
+
padding-right: 0
|
248
|
+
SASS
|
249
|
+
@media all {
|
250
|
+
.next .vevent {
|
251
|
+
padding-left: 0;
|
252
|
+
padding-right: 0; } }
|
253
|
+
CSS
|
254
|
+
end
|
255
|
+
|
256
|
+
def test_multiline_selector_within_media_and_with_child_selector
|
257
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
258
|
+
@media all
|
259
|
+
foo bar, baz
|
260
|
+
padding-left: 0
|
261
|
+
padding-right: 0
|
262
|
+
SASS
|
263
|
+
@media all {
|
264
|
+
foo bar,
|
265
|
+
baz {
|
266
|
+
padding-left: 0;
|
267
|
+
padding-right: 0; } }
|
268
|
+
CSS
|
269
|
+
end
|
270
|
+
|
271
|
+
# Error reporting
|
272
|
+
|
273
|
+
def test_error_reporting
|
274
|
+
css2sass("foo")
|
275
|
+
assert(false, "Expected exception")
|
276
|
+
rescue Sass::SyntaxError => err
|
277
|
+
assert_equal(1, err.sass_line)
|
278
|
+
assert_equal('Invalid CSS after "foo": expected "{", was ""', err.message)
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_error_reporting_in_line
|
282
|
+
css2sass("foo\nbar }\nbaz")
|
283
|
+
assert(false, "Expected exception")
|
284
|
+
rescue Sass::SyntaxError => err
|
285
|
+
assert_equal(2, err.sass_line)
|
286
|
+
assert_equal('Invalid CSS after "bar ": expected "{", was "}"', err.message)
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_error_truncate_after
|
290
|
+
css2sass("#{"a" * 16}foo")
|
291
|
+
assert(false, "Expected exception")
|
292
|
+
rescue Sass::SyntaxError => err
|
293
|
+
assert_equal(1, err.sass_line)
|
294
|
+
assert_equal('Invalid CSS after "...aaaaaaaaaaaafoo": expected "{", was ""', err.message)
|
295
|
+
end
|
296
|
+
|
297
|
+
def test_error_truncate_was
|
298
|
+
css2sass("foo }foo#{"a" * 15}")
|
299
|
+
assert(false, "Expected exception")
|
300
|
+
rescue Sass::SyntaxError => err
|
301
|
+
assert_equal(1, err.sass_line)
|
302
|
+
assert_equal('Invalid CSS after "foo ": expected "{", was "}fooaaaaaaaaaaa..."', err.message)
|
303
|
+
end
|
304
|
+
|
305
|
+
def test_error_doesnt_truncate_after_when_elipsis_would_add_length
|
306
|
+
css2sass("#{"a" * 15}foo")
|
307
|
+
assert(false, "Expected exception")
|
308
|
+
rescue Sass::SyntaxError => err
|
309
|
+
assert_equal(1, err.sass_line)
|
310
|
+
assert_equal('Invalid CSS after "aaaaaaaaaaaaaaafoo": expected "{", was ""', err.message)
|
311
|
+
end
|
312
|
+
|
313
|
+
def test_error_doesnt_truncate_was_when_elipsis_would_add_length
|
314
|
+
css2sass("foo }foo#{"a" * 14}")
|
315
|
+
assert(false, "Expected exception")
|
316
|
+
rescue Sass::SyntaxError => err
|
317
|
+
assert_equal(1, err.sass_line)
|
318
|
+
assert_equal('Invalid CSS after "foo ": expected "{", was "}fooaaaaaaaaaaaaaa"', err.message)
|
319
|
+
end
|
320
|
+
|
321
|
+
def test_error_gets_rid_of_trailing_newline_for_after
|
322
|
+
css2sass("foo \n ")
|
323
|
+
assert(false, "Expected exception")
|
324
|
+
rescue Sass::SyntaxError => err
|
325
|
+
assert_equal(2, err.sass_line)
|
326
|
+
assert_equal('Invalid CSS after "foo": expected "{", was ""', err.message)
|
327
|
+
end
|
328
|
+
|
329
|
+
def test_error_gets_rid_of_trailing_newline_for_was
|
330
|
+
css2sass("foo \n }foo")
|
331
|
+
assert(false, "Expected exception")
|
332
|
+
rescue Sass::SyntaxError => err
|
333
|
+
assert_equal(2, err.sass_line)
|
334
|
+
assert_equal('Invalid CSS after "foo": expected "{", was "}foo"', err.message)
|
335
|
+
end
|
336
|
+
|
337
|
+
# Encodings
|
338
|
+
|
339
|
+
unless Sass::Util.ruby1_8?
|
340
|
+
def test_encoding_error
|
341
|
+
css2sass("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
|
342
|
+
assert(false, "Expected exception")
|
343
|
+
rescue Sass::SyntaxError => e
|
344
|
+
assert_equal(3, e.sass_line)
|
345
|
+
assert_equal('Invalid UTF-8 character "\xFE"', e.message)
|
346
|
+
end
|
347
|
+
|
348
|
+
def test_ascii_incompatible_encoding_error
|
349
|
+
template = "foo\nbar\nb_z".encode("utf-16le")
|
350
|
+
template[9] = "\xFE".force_encoding("utf-16le")
|
351
|
+
css2sass(template)
|
352
|
+
assert(false, "Expected exception")
|
353
|
+
rescue Sass::SyntaxError => e
|
354
|
+
assert_equal(3, e.sass_line)
|
355
|
+
assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
private
|
360
|
+
|
361
|
+
def css2sass(string, opts={})
|
362
|
+
Sass::CSS.new(string, opts).render
|
363
|
+
end
|
364
|
+
end
|
@@ -0,0 +1,319 @@
|
|
1
|
+
hsl(0, 100%, 50%)
|
2
|
+
hsl(60, 100%, 50%)
|
3
|
+
hsl(120, 100%, 50%)
|
4
|
+
hsl(180, 100%, 50%)
|
5
|
+
hsl(240, 100%, 50%)
|
6
|
+
hsl(300, 100%, 50%)
|
7
|
+
====
|
8
|
+
rgb(255, 0, 0)
|
9
|
+
rgb(255, 255, 0)
|
10
|
+
rgb(0, 255, 0)
|
11
|
+
rgb(0, 255, 255)
|
12
|
+
rgb(0, 0, 255)
|
13
|
+
rgb(255, 0, 255)
|
14
|
+
|
15
|
+
hsl(-360, 100%, 50%)
|
16
|
+
hsl(-300, 100%, 50%)
|
17
|
+
hsl(-240, 100%, 50%)
|
18
|
+
hsl(-180, 100%, 50%)
|
19
|
+
hsl(-120, 100%, 50%)
|
20
|
+
hsl(-60, 100%, 50%)
|
21
|
+
====
|
22
|
+
rgb(255, 0, 0)
|
23
|
+
rgb(255, 255, 0)
|
24
|
+
rgb(0, 255, 0)
|
25
|
+
rgb(0, 255, 255)
|
26
|
+
rgb(0, 0, 255)
|
27
|
+
rgb(255, 0, 255)
|
28
|
+
|
29
|
+
hsl(360, 100%, 50%)
|
30
|
+
hsl(420, 100%, 50%)
|
31
|
+
hsl(480, 100%, 50%)
|
32
|
+
hsl(540, 100%, 50%)
|
33
|
+
hsl(600, 100%, 50%)
|
34
|
+
hsl(660, 100%, 50%)
|
35
|
+
====
|
36
|
+
rgb(255, 0, 0)
|
37
|
+
rgb(255, 255, 0)
|
38
|
+
rgb(0, 255, 0)
|
39
|
+
rgb(0, 255, 255)
|
40
|
+
rgb(0, 0, 255)
|
41
|
+
rgb(255, 0, 255)
|
42
|
+
|
43
|
+
hsl(6120, 100%, 50%)
|
44
|
+
hsl(-9660, 100%, 50%)
|
45
|
+
hsl(99840, 100%, 50%)
|
46
|
+
hsl(-900, 100%, 50%)
|
47
|
+
hsl(-104880, 100%, 50%)
|
48
|
+
hsl(2820, 100%, 50%)
|
49
|
+
====
|
50
|
+
rgb(255, 0, 0)
|
51
|
+
rgb(255, 255, 0)
|
52
|
+
rgb(0, 255, 0)
|
53
|
+
rgb(0, 255, 255)
|
54
|
+
rgb(0, 0, 255)
|
55
|
+
rgb(255, 0, 255)
|
56
|
+
|
57
|
+
hsl(0, 100%, 50%)
|
58
|
+
hsl(12, 100%, 50%)
|
59
|
+
hsl(24, 100%, 50%)
|
60
|
+
hsl(36, 100%, 50%)
|
61
|
+
hsl(48, 100%, 50%)
|
62
|
+
hsl(60, 100%, 50%)
|
63
|
+
hsl(72, 100%, 50%)
|
64
|
+
hsl(84, 100%, 50%)
|
65
|
+
hsl(96, 100%, 50%)
|
66
|
+
hsl(108, 100%, 50%)
|
67
|
+
hsl(120, 100%, 50%)
|
68
|
+
====
|
69
|
+
rgb(255, 0, 0)
|
70
|
+
rgb(255, 51, 0)
|
71
|
+
rgb(255, 102, 0)
|
72
|
+
rgb(255, 153, 0)
|
73
|
+
rgb(255, 204, 0)
|
74
|
+
rgb(255, 255, 0)
|
75
|
+
rgb(204, 255, 0)
|
76
|
+
rgb(153, 255, 0)
|
77
|
+
rgb(102, 255, 0)
|
78
|
+
rgb(51, 255, 0)
|
79
|
+
rgb(0, 255, 0)
|
80
|
+
|
81
|
+
hsl(120, 100%, 50%)
|
82
|
+
hsl(132, 100%, 50%)
|
83
|
+
hsl(144, 100%, 50%)
|
84
|
+
hsl(156, 100%, 50%)
|
85
|
+
hsl(168, 100%, 50%)
|
86
|
+
hsl(180, 100%, 50%)
|
87
|
+
hsl(192, 100%, 50%)
|
88
|
+
hsl(204, 100%, 50%)
|
89
|
+
hsl(216, 100%, 50%)
|
90
|
+
hsl(228, 100%, 50%)
|
91
|
+
hsl(240, 100%, 50%)
|
92
|
+
====
|
93
|
+
rgb(0, 255, 0)
|
94
|
+
rgb(0, 255, 51)
|
95
|
+
rgb(0, 255, 102)
|
96
|
+
rgb(0, 255, 153)
|
97
|
+
rgb(0, 255, 204)
|
98
|
+
rgb(0, 255, 255)
|
99
|
+
rgb(0, 204, 255)
|
100
|
+
rgb(0, 153, 255)
|
101
|
+
rgb(0, 102, 255)
|
102
|
+
rgb(0, 51, 255)
|
103
|
+
rgb(0, 0, 255)
|
104
|
+
|
105
|
+
hsl(240, 100%, 50%)
|
106
|
+
hsl(252, 100%, 50%)
|
107
|
+
hsl(264, 100%, 50%)
|
108
|
+
hsl(276, 100%, 50%)
|
109
|
+
hsl(288, 100%, 50%)
|
110
|
+
hsl(300, 100%, 50%)
|
111
|
+
hsl(312, 100%, 50%)
|
112
|
+
hsl(324, 100%, 50%)
|
113
|
+
hsl(336, 100%, 50%)
|
114
|
+
hsl(348, 100%, 50%)
|
115
|
+
hsl(360, 100%, 50%)
|
116
|
+
====
|
117
|
+
rgb(0, 0, 255)
|
118
|
+
rgb(51, 0, 255)
|
119
|
+
rgb(102, 0, 255)
|
120
|
+
rgb(153, 0, 255)
|
121
|
+
rgb(204, 0, 255)
|
122
|
+
rgb(255, 0, 255)
|
123
|
+
rgb(255, 0, 204)
|
124
|
+
rgb(255, 0, 153)
|
125
|
+
rgb(255, 0, 102)
|
126
|
+
rgb(255, 0, 51)
|
127
|
+
rgb(255, 0, 0)
|
128
|
+
|
129
|
+
hsl(0, 20%, 50%)
|
130
|
+
hsl(0, 60%, 50%)
|
131
|
+
hsl(0, 100%, 50%)
|
132
|
+
====
|
133
|
+
rgb(153, 102, 102)
|
134
|
+
rgb(204, 51, 51)
|
135
|
+
rgb(255, 0, 0)
|
136
|
+
|
137
|
+
hsl(60, 20%, 50%)
|
138
|
+
hsl(60, 60%, 50%)
|
139
|
+
hsl(60, 100%, 50%)
|
140
|
+
====
|
141
|
+
rgb(153, 153, 102)
|
142
|
+
rgb(204, 204, 51)
|
143
|
+
rgb(255, 255, 0)
|
144
|
+
|
145
|
+
hsl(120, 20%, 50%)
|
146
|
+
hsl(120, 60%, 50%)
|
147
|
+
hsl(120, 100%, 50%)
|
148
|
+
====
|
149
|
+
rgb(102, 153, 102)
|
150
|
+
rgb(51, 204, 51)
|
151
|
+
rgb(0, 255, 0)
|
152
|
+
|
153
|
+
hsl(180, 20%, 50%)
|
154
|
+
hsl(180, 60%, 50%)
|
155
|
+
hsl(180, 100%, 50%)
|
156
|
+
====
|
157
|
+
rgb(102, 153, 153)
|
158
|
+
rgb(51, 204, 204)
|
159
|
+
rgb(0, 255, 255)
|
160
|
+
|
161
|
+
hsl(240, 20%, 50%)
|
162
|
+
hsl(240, 60%, 50%)
|
163
|
+
hsl(240, 100%, 50%)
|
164
|
+
====
|
165
|
+
rgb(102, 102, 153)
|
166
|
+
rgb(51, 51, 204)
|
167
|
+
rgb(0, 0, 255)
|
168
|
+
|
169
|
+
hsl(300, 20%, 50%)
|
170
|
+
hsl(300, 60%, 50%)
|
171
|
+
hsl(300, 100%, 50%)
|
172
|
+
====
|
173
|
+
rgb(153, 102, 153)
|
174
|
+
rgb(204, 51, 204)
|
175
|
+
rgb(255, 0, 255)
|
176
|
+
|
177
|
+
hsl(0, 100%, 0%)
|
178
|
+
hsl(0, 100%, 10%)
|
179
|
+
hsl(0, 100%, 20%)
|
180
|
+
hsl(0, 100%, 30%)
|
181
|
+
hsl(0, 100%, 40%)
|
182
|
+
hsl(0, 100%, 50%)
|
183
|
+
hsl(0, 100%, 60%)
|
184
|
+
hsl(0, 100%, 70%)
|
185
|
+
hsl(0, 100%, 80%)
|
186
|
+
hsl(0, 100%, 90%)
|
187
|
+
hsl(0, 100%, 100%)
|
188
|
+
====
|
189
|
+
rgb(0, 0, 0)
|
190
|
+
rgb(51, 0, 0)
|
191
|
+
rgb(102, 0, 0)
|
192
|
+
rgb(153, 0, 0)
|
193
|
+
rgb(204, 0, 0)
|
194
|
+
rgb(255, 0, 0)
|
195
|
+
rgb(255, 51, 51)
|
196
|
+
rgb(255, 102, 102)
|
197
|
+
rgb(255, 153, 153)
|
198
|
+
rgb(255, 204, 204)
|
199
|
+
rgb(255, 255, 255)
|
200
|
+
|
201
|
+
hsl(60, 100%, 0%)
|
202
|
+
hsl(60, 100%, 10%)
|
203
|
+
hsl(60, 100%, 20%)
|
204
|
+
hsl(60, 100%, 30%)
|
205
|
+
hsl(60, 100%, 40%)
|
206
|
+
hsl(60, 100%, 50%)
|
207
|
+
hsl(60, 100%, 60%)
|
208
|
+
hsl(60, 100%, 70%)
|
209
|
+
hsl(60, 100%, 80%)
|
210
|
+
hsl(60, 100%, 90%)
|
211
|
+
hsl(60, 100%, 100%)
|
212
|
+
====
|
213
|
+
rgb(0, 0, 0)
|
214
|
+
rgb(51, 51, 0)
|
215
|
+
rgb(102, 102, 0)
|
216
|
+
rgb(153, 153, 0)
|
217
|
+
rgb(204, 204, 0)
|
218
|
+
rgb(255, 255, 0)
|
219
|
+
rgb(255, 255, 51)
|
220
|
+
rgb(255, 255, 102)
|
221
|
+
rgb(255, 255, 153)
|
222
|
+
rgb(255, 255, 204)
|
223
|
+
rgb(255, 255, 255)
|
224
|
+
|
225
|
+
hsl(120, 100%, 0%)
|
226
|
+
hsl(120, 100%, 10%)
|
227
|
+
hsl(120, 100%, 20%)
|
228
|
+
hsl(120, 100%, 30%)
|
229
|
+
hsl(120, 100%, 40%)
|
230
|
+
hsl(120, 100%, 50%)
|
231
|
+
hsl(120, 100%, 60%)
|
232
|
+
hsl(120, 100%, 70%)
|
233
|
+
hsl(120, 100%, 80%)
|
234
|
+
hsl(120, 100%, 90%)
|
235
|
+
hsl(120, 100%, 100%)
|
236
|
+
====
|
237
|
+
rgb(0, 0, 0)
|
238
|
+
rgb(0, 51, 0)
|
239
|
+
rgb(0, 102, 0)
|
240
|
+
rgb(0, 153, 0)
|
241
|
+
rgb(0, 204, 0)
|
242
|
+
rgb(0, 255, 0)
|
243
|
+
rgb(51, 255, 51)
|
244
|
+
rgb(102, 255, 102)
|
245
|
+
rgb(153, 255, 153)
|
246
|
+
rgb(204, 255, 204)
|
247
|
+
rgb(255, 255, 255)
|
248
|
+
|
249
|
+
hsl(180, 100%, 0%)
|
250
|
+
hsl(180, 100%, 10%)
|
251
|
+
hsl(180, 100%, 20%)
|
252
|
+
hsl(180, 100%, 30%)
|
253
|
+
hsl(180, 100%, 40%)
|
254
|
+
hsl(180, 100%, 50%)
|
255
|
+
hsl(180, 100%, 60%)
|
256
|
+
hsl(180, 100%, 70%)
|
257
|
+
hsl(180, 100%, 80%)
|
258
|
+
hsl(180, 100%, 90%)
|
259
|
+
hsl(180, 100%, 100%)
|
260
|
+
====
|
261
|
+
rgb(0, 0, 0)
|
262
|
+
rgb(0, 51, 51)
|
263
|
+
rgb(0, 102, 102)
|
264
|
+
rgb(0, 153, 153)
|
265
|
+
rgb(0, 204, 204)
|
266
|
+
rgb(0, 255, 255)
|
267
|
+
rgb(51, 255, 255)
|
268
|
+
rgb(102, 255, 255)
|
269
|
+
rgb(153, 255, 255)
|
270
|
+
rgb(204, 255, 255)
|
271
|
+
rgb(255, 255, 255)
|
272
|
+
|
273
|
+
hsl(240, 100%, 0%)
|
274
|
+
hsl(240, 100%, 10%)
|
275
|
+
hsl(240, 100%, 20%)
|
276
|
+
hsl(240, 100%, 30%)
|
277
|
+
hsl(240, 100%, 40%)
|
278
|
+
hsl(240, 100%, 50%)
|
279
|
+
hsl(240, 100%, 60%)
|
280
|
+
hsl(240, 100%, 70%)
|
281
|
+
hsl(240, 100%, 80%)
|
282
|
+
hsl(240, 100%, 90%)
|
283
|
+
hsl(240, 100%, 100%)
|
284
|
+
====
|
285
|
+
rgb(0, 0, 0)
|
286
|
+
rgb(0, 0, 51)
|
287
|
+
rgb(0, 0, 102)
|
288
|
+
rgb(0, 0, 153)
|
289
|
+
rgb(0, 0, 204)
|
290
|
+
rgb(0, 0, 255)
|
291
|
+
rgb(51, 51, 255)
|
292
|
+
rgb(102, 102, 255)
|
293
|
+
rgb(153, 153, 255)
|
294
|
+
rgb(204, 204, 255)
|
295
|
+
rgb(255, 255, 255)
|
296
|
+
|
297
|
+
hsl(300, 100%, 0%)
|
298
|
+
hsl(300, 100%, 10%)
|
299
|
+
hsl(300, 100%, 20%)
|
300
|
+
hsl(300, 100%, 30%)
|
301
|
+
hsl(300, 100%, 40%)
|
302
|
+
hsl(300, 100%, 50%)
|
303
|
+
hsl(300, 100%, 60%)
|
304
|
+
hsl(300, 100%, 70%)
|
305
|
+
hsl(300, 100%, 80%)
|
306
|
+
hsl(300, 100%, 90%)
|
307
|
+
hsl(300, 100%, 100%)
|
308
|
+
====
|
309
|
+
rgb(0, 0, 0)
|
310
|
+
rgb(51, 0, 51)
|
311
|
+
rgb(102, 0, 102)
|
312
|
+
rgb(153, 0, 153)
|
313
|
+
rgb(204, 0, 204)
|
314
|
+
rgb(255, 0, 255)
|
315
|
+
rgb(255, 51, 255)
|
316
|
+
rgb(255, 102, 255)
|
317
|
+
rgb(255, 153, 255)
|
318
|
+
rgb(255, 204, 255)
|
319
|
+
rgb(255, 255, 255)
|