sass 3.1.21 → 3.2.0.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. data/README.md +5 -4
  2. data/REVISION +1 -1
  3. data/Rakefile +6 -15
  4. data/VERSION +1 -1
  5. data/VERSION_NAME +1 -1
  6. data/lib/sass.rb +0 -1
  7. data/lib/sass/cache_stores/base.rb +1 -3
  8. data/lib/sass/cache_stores/filesystem.rb +0 -3
  9. data/lib/sass/css.rb +49 -145
  10. data/lib/sass/engine.rb +23 -47
  11. data/lib/sass/environment.rb +5 -30
  12. data/lib/sass/exec.rb +7 -30
  13. data/lib/sass/importers/base.rb +1 -2
  14. data/lib/sass/importers/filesystem.rb +13 -18
  15. data/lib/sass/less.rb +1 -1
  16. data/lib/sass/plugin.rb +8 -4
  17. data/lib/sass/plugin/compiler.rb +67 -93
  18. data/lib/sass/plugin/configuration.rb +2 -0
  19. data/lib/sass/plugin/staleness_checker.rb +4 -14
  20. data/lib/sass/repl.rb +3 -2
  21. data/lib/sass/script.rb +1 -0
  22. data/lib/sass/script/color.rb +9 -4
  23. data/lib/sass/script/funcall.rb +3 -16
  24. data/lib/sass/script/functions.rb +55 -98
  25. data/lib/sass/script/interpolation.rb +0 -9
  26. data/lib/sass/script/lexer.rb +4 -2
  27. data/lib/sass/script/list.rb +0 -8
  28. data/lib/sass/script/literal.rb +20 -5
  29. data/lib/sass/script/node.rb +0 -8
  30. data/lib/sass/script/number.rb +11 -35
  31. data/lib/sass/script/operation.rb +0 -16
  32. data/lib/sass/script/parser.rb +5 -12
  33. data/lib/sass/script/string_interpolation.rb +0 -9
  34. data/lib/sass/script/unary_operation.rb +0 -7
  35. data/lib/sass/script/variable.rb +1 -5
  36. data/lib/sass/scss/parser.rb +54 -191
  37. data/lib/sass/scss/rx.rb +3 -15
  38. data/lib/sass/scss/static_parser.rb +3 -3
  39. data/lib/sass/selector.rb +3 -15
  40. data/lib/sass/selector/abstract_sequence.rb +2 -11
  41. data/lib/sass/selector/comma_sequence.rb +3 -8
  42. data/lib/sass/selector/sequence.rb +11 -74
  43. data/lib/sass/selector/simple.rb +1 -7
  44. data/lib/sass/selector/simple_sequence.rb +8 -28
  45. data/lib/sass/shared.rb +5 -3
  46. data/lib/sass/tree/comment_node.rb +12 -25
  47. data/lib/sass/tree/debug_node.rb +1 -1
  48. data/lib/sass/tree/directive_node.rb +0 -5
  49. data/lib/sass/tree/each_node.rb +1 -1
  50. data/lib/sass/tree/extend_node.rb +1 -1
  51. data/lib/sass/tree/for_node.rb +2 -2
  52. data/lib/sass/tree/function_node.rb +1 -1
  53. data/lib/sass/tree/if_node.rb +14 -1
  54. data/lib/sass/tree/media_node.rb +4 -4
  55. data/lib/sass/tree/mixin_def_node.rb +1 -1
  56. data/lib/sass/tree/mixin_node.rb +2 -2
  57. data/lib/sass/tree/node.rb +26 -10
  58. data/lib/sass/tree/return_node.rb +1 -1
  59. data/lib/sass/tree/root_node.rb +1 -1
  60. data/lib/sass/tree/rule_node.rb +11 -9
  61. data/lib/sass/tree/variable_node.rb +1 -1
  62. data/lib/sass/tree/visitors/base.rb +1 -1
  63. data/lib/sass/tree/visitors/check_nesting.rb +36 -29
  64. data/lib/sass/tree/visitors/convert.rb +9 -16
  65. data/lib/sass/tree/visitors/cssize.rb +9 -40
  66. data/lib/sass/tree/visitors/perform.rb +23 -79
  67. data/lib/sass/tree/visitors/to_css.rb +21 -23
  68. data/lib/sass/tree/warn_node.rb +1 -1
  69. data/lib/sass/tree/while_node.rb +1 -1
  70. data/lib/sass/util.rb +9 -147
  71. data/lib/sass/version.rb +0 -14
  72. data/test/sass/cache_test.rb +0 -15
  73. data/test/sass/conversion_test.rb +8 -50
  74. data/test/sass/css2sass_test.rb +0 -33
  75. data/test/sass/engine_test.rb +32 -283
  76. data/test/sass/extend_test.rb +0 -315
  77. data/test/sass/functions_test.rb +23 -60
  78. data/test/sass/importer_test.rb +0 -110
  79. data/test/sass/more_results/more_import.css +2 -2
  80. data/test/sass/plugin_test.rb +13 -40
  81. data/test/sass/results/import.css +2 -2
  82. data/test/sass/results/import_charset.css +0 -1
  83. data/test/sass/results/import_charset_1_8.css +0 -1
  84. data/test/sass/results/import_charset_ibm866.css +0 -1
  85. data/test/sass/results/scss_import.css +2 -2
  86. data/test/sass/results/units.css +1 -1
  87. data/test/sass/script_conversion_test.rb +0 -2
  88. data/test/sass/script_test.rb +4 -28
  89. data/test/sass/scss/css_test.rb +1 -79
  90. data/test/sass/scss/scss_test.rb +16 -96
  91. data/test/sass/templates/import_charset.sass +0 -2
  92. data/test/sass/templates/import_charset_1_8.sass +0 -2
  93. data/test/sass/templates/import_charset_ibm866.sass +0 -2
  94. data/test/sass/test_helper.rb +1 -1
  95. data/test/sass/util_test.rb +0 -28
  96. data/test/test_helper.rb +0 -2
  97. data/vendor/{listen → fssm}/LICENSE +1 -1
  98. data/vendor/fssm/README.markdown +55 -0
  99. data/vendor/fssm/Rakefile +59 -0
  100. data/vendor/fssm/VERSION.yml +5 -0
  101. data/vendor/fssm/example.rb +9 -0
  102. data/vendor/fssm/fssm.gemspec +77 -0
  103. data/vendor/fssm/lib/fssm.rb +33 -0
  104. data/vendor/fssm/lib/fssm/backends/fsevents.rb +36 -0
  105. data/vendor/fssm/lib/fssm/backends/inotify.rb +26 -0
  106. data/vendor/fssm/lib/fssm/backends/polling.rb +25 -0
  107. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +131 -0
  108. data/vendor/fssm/lib/fssm/monitor.rb +26 -0
  109. data/vendor/fssm/lib/fssm/path.rb +91 -0
  110. data/vendor/fssm/lib/fssm/pathname.rb +502 -0
  111. data/vendor/fssm/lib/fssm/state/directory.rb +57 -0
  112. data/vendor/fssm/lib/fssm/state/file.rb +24 -0
  113. data/vendor/fssm/lib/fssm/support.rb +63 -0
  114. data/vendor/fssm/lib/fssm/tree.rb +176 -0
  115. data/vendor/fssm/profile/prof-cache.rb +40 -0
  116. data/vendor/fssm/profile/prof-fssm-pathname.html +1231 -0
  117. data/vendor/fssm/profile/prof-pathname.rb +68 -0
  118. data/vendor/fssm/profile/prof-plain-pathname.html +988 -0
  119. data/vendor/fssm/profile/prof.html +2379 -0
  120. data/vendor/fssm/spec/path_spec.rb +75 -0
  121. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  122. data/vendor/fssm/spec/root/file.css +0 -0
  123. data/vendor/fssm/spec/root/file.rb +0 -0
  124. data/vendor/fssm/spec/root/file.yml +0 -0
  125. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  126. data/vendor/fssm/spec/spec_helper.rb +14 -0
  127. metadata +246 -281
  128. data/VERSION_DATE +0 -1
  129. data/lib/sass/logger.rb +0 -15
  130. data/lib/sass/logger/base.rb +0 -32
  131. data/lib/sass/logger/log_level.rb +0 -49
  132. data/lib/sass/tree/visitors/deep_copy.rb +0 -87
  133. data/lib/sass/tree/visitors/extend.rb +0 -42
  134. data/lib/sass/tree/visitors/set_options.rb +0 -97
  135. data/lib/sass/util/multibyte_string_scanner.rb +0 -134
  136. data/test/Gemfile +0 -4
  137. data/test/Gemfile.lock +0 -19
  138. data/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
  139. data/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
  140. data/test/sass/logger_test.rb +0 -58
  141. data/test/sass/templates/_double_import_loop2.sass +0 -1
  142. data/test/sass/templates/bork5.sass +0 -3
  143. data/test/sass/templates/double_import_loop1.sass +0 -1
  144. data/test/sass/templates/nested_bork5.sass +0 -2
  145. data/test/sass/templates/single_import_loop.sass +0 -1
  146. data/test/sass/util/multibyte_string_scanner_test.rb +0 -147
  147. data/vendor/listen/CHANGELOG.md +0 -147
  148. data/vendor/listen/Gemfile +0 -23
  149. data/vendor/listen/Guardfile +0 -8
  150. data/vendor/listen/README.md +0 -312
  151. data/vendor/listen/Rakefile +0 -47
  152. data/vendor/listen/Vagrantfile +0 -96
  153. data/vendor/listen/lib/listen.rb +0 -38
  154. data/vendor/listen/lib/listen/adapter.rb +0 -167
  155. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -84
  156. data/vendor/listen/lib/listen/adapters/linux.rb +0 -110
  157. data/vendor/listen/lib/listen/adapters/polling.rb +0 -66
  158. data/vendor/listen/lib/listen/adapters/windows.rb +0 -81
  159. data/vendor/listen/lib/listen/directory_record.rb +0 -318
  160. data/vendor/listen/lib/listen/listener.rb +0 -203
  161. data/vendor/listen/lib/listen/multi_listener.rb +0 -121
  162. data/vendor/listen/lib/listen/turnstile.rb +0 -28
  163. data/vendor/listen/lib/listen/version.rb +0 -3
  164. data/vendor/listen/listen.gemspec +0 -26
  165. data/vendor/listen/spec/listen/adapter_spec.rb +0 -142
  166. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -31
  167. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -41
  168. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  169. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -24
  170. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1138
  171. data/vendor/listen/spec/listen/listener_spec.rb +0 -155
  172. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -156
  173. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  174. data/vendor/listen/spec/listen_spec.rb +0 -73
  175. data/vendor/listen/spec/spec_helper.rb +0 -18
  176. data/vendor/listen/spec/support/adapter_helper.rb +0 -716
  177. data/vendor/listen/spec/support/directory_record_helper.rb +0 -55
  178. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  179. data/vendor/listen/spec/support/listeners_helper.rb +0 -144
  180. data/vendor/listen/spec/support/platform_helper.rb +0 -11
@@ -2,8 +2,6 @@
2
2
  require File.dirname(__FILE__) + '/../test_helper'
3
3
  require File.dirname(__FILE__) + '/test_helper'
4
4
 
5
- require 'sass/plugin'
6
-
7
5
  class ImporterTest < Test::Unit::TestCase
8
6
 
9
7
  class FruitImporter < Sass::Importers::Base
@@ -40,72 +38,6 @@ class ImporterTest < Test::Unit::TestCase
40
38
  end
41
39
  end
42
40
 
43
- # This importer maps one import to another import
44
- # based on the mappings passed to importer's constructor.
45
- class IndirectImporter < Sass::Importers::Base
46
- def initialize(mappings, mtimes)
47
- @mappings = mappings
48
- @mtimes = mtimes
49
- end
50
- def find_relative(uri, base, options)
51
- nil
52
- end
53
- def find(name, options)
54
- if @mappings.has_key?(name)
55
- Sass::Engine.new(
56
- %Q[@import "#{@mappings[name]}";],
57
- options.merge(
58
- :filename => name,
59
- :syntax => :scss,
60
- :importer => self
61
- )
62
- )
63
- end
64
- end
65
- def mtime(uri, options)
66
- @mtimes.fetch(uri, @mtimes.has_key?(uri) ? Time.now : nil)
67
- end
68
- def key(uri, options)
69
- [self.class.name, uri]
70
- end
71
- def to_s
72
- "IndirectImporter(#{@mappings.keys.join(", ")})"
73
- end
74
- end
75
-
76
- # This importer maps the import to single class
77
- # based on the mappings passed to importer's constructor.
78
- class ClassImporter < Sass::Importers::Base
79
- def initialize(mappings, mtimes)
80
- @mappings = mappings
81
- @mtimes = mtimes
82
- end
83
- def find_relative(uri, base, options)
84
- nil
85
- end
86
- def find(name, options)
87
- if @mappings.has_key?(name)
88
- Sass::Engine.new(
89
- %Q[.#{name}{#{@mappings[name]}}],
90
- options.merge(
91
- :filename => name,
92
- :syntax => :scss,
93
- :importer => self
94
- )
95
- )
96
- end
97
- end
98
- def mtime(uri, options)
99
- @mtimes.fetch(uri, @mtimes.has_key?(uri) ? Time.now : nil)
100
- end
101
- def key(uri, options)
102
- [self.class.name, uri]
103
- end
104
- def to_s
105
- "ClassImporter(#{@mappings.keys.join(", ")})"
106
- end
107
- end
108
-
109
41
  def test_can_resolve_generated_imports
110
42
  scss_file = %Q{
111
43
  $pear-color: green;
@@ -147,46 +79,4 @@ CSS
147
79
  ensure
148
80
  FileUtils.rm_rf(absolutize("tmp"))
149
81
  end
150
-
151
- def test_staleness_check_across_importers
152
- file_system_importer = Sass::Importers::Filesystem.new(fixture_dir)
153
- # Make sure the first import is older
154
- indirect_importer = IndirectImporter.new({"apple" => "pear"}, {"apple" => Time.now - 1})
155
- # Make css file is newer so the dependencies are the only way for the css file to be out of date.
156
- FileUtils.touch(fixture_file("test_staleness_check_across_importers.css"))
157
- # Make sure the first import is older
158
- class_importer = ClassImporter.new({"pear" => %Q{color: green;}}, {"pear" => Time.now + 1})
159
-
160
- options = {
161
- :style => :compact,
162
- :filename => fixture_file("test_staleness_check_across_importers.scss"),
163
- :importer => file_system_importer,
164
- :load_paths => [file_system_importer, indirect_importer, class_importer],
165
- :syntax => :scss
166
- }
167
-
168
- assert_equal File.read(fixture_file("test_staleness_check_across_importers.css")),
169
- Sass::Engine.new(File.read(fixture_file("test_staleness_check_across_importers.scss")), options).render
170
-
171
- checker = Sass::Plugin::StalenessChecker.new(options)
172
-
173
- assert checker.stylesheet_needs_update?(
174
- fixture_file("test_staleness_check_across_importers.css"),
175
- fixture_file("test_staleness_check_across_importers.scss"),
176
- file_system_importer
177
- )
178
- end
179
-
180
- def fixture_dir
181
- File.join(File.dirname(__FILE__), "fixtures")
182
- end
183
-
184
- def fixture_file(path)
185
- File.join(fixture_dir, path)
186
- end
187
-
188
- def test_absolute_files_across_template_locations
189
- importer = Sass::Importers::Filesystem.new(absolutize 'templates')
190
- assert_not_nil importer.mtime(absolutize('more_templates/more1.sass'), {})
191
- end
192
82
  end
@@ -1,5 +1,3 @@
1
- @import url(basic.css);
2
- @import url(../results/complex.css);
3
1
  imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
4
2
 
5
3
  body { font: Arial; background: blue; }
@@ -24,6 +22,8 @@ body { font: Arial; background: blue; }
24
22
  #content.user.show #container.top #column.right { width: 600px; }
25
23
  #content.user.show #container.bottom { background: brown; }
26
24
 
25
+ @import url(basic.css);
26
+ @import url(../results/complex.css);
27
27
  #foo { background-color: #bbaaff; }
28
28
 
29
29
  nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
@@ -110,30 +110,6 @@ CSS
110
110
  File.delete(tempfile_loc('bork1'))
111
111
  end
112
112
 
113
- def test_single_level_import_loop
114
- File.delete(tempfile_loc('single_import_loop'))
115
- check_for_updates!
116
- File.open(tempfile_loc('single_import_loop')) do |file|
117
- assert_equal(<<CSS.strip, file.read.split("\n")[0...2].join("\n"))
118
- /*
119
- Sass::SyntaxError: An @import loop has been found: #{template_loc('single_import_loop')} imports itself
120
- CSS
121
- end
122
- end
123
-
124
- def test_double_level_import_loop
125
- File.delete(tempfile_loc('double_import_loop1'))
126
- check_for_updates!
127
- File.open(tempfile_loc('double_import_loop1')) do |file|
128
- assert_equal(<<CSS.strip, file.read.split("\n")[0...4].join("\n"))
129
- /*
130
- Sass::SyntaxError: An @import loop has been found:
131
- #{template_loc('double_import_loop1')} imports #{template_loc('_double_import_loop2')}
132
- #{template_loc('_double_import_loop2')} imports #{template_loc('double_import_loop1')}
133
- CSS
134
- end
135
- end
136
-
137
113
  def test_nonfull_exception_handling
138
114
  old_full_exception = Sass::Plugin.options[:full_exception]
139
115
  Sass::Plugin.options[:full_exception] = false
@@ -207,7 +183,6 @@ CSS
207
183
 
208
184
  def test_updating_stylesheets_callback
209
185
  # Should run even when there's nothing to update
210
- Sass::Plugin.options[:template_location] = nil
211
186
  assert_callback :updating_stylesheets, []
212
187
  end
213
188
 
@@ -221,25 +196,25 @@ CSS
221
196
  assert_no_callback :updating_stylesheets
222
197
  end
223
198
 
224
- def test_updated_stylesheet_callback_for_updated_template
199
+ def test_updating_stylesheet_callback_for_updated_template
225
200
  Sass::Plugin.options[:always_update] = false
226
201
  touch 'basic'
227
- assert_no_callback :updated_stylesheet, template_loc("complex"), tempfile_loc("complex") do
202
+ assert_no_callback :updating_stylesheet, template_loc("complex"), tempfile_loc("complex") do
228
203
  assert_callbacks(
229
- [:updated_stylesheet, template_loc("basic"), tempfile_loc("basic")],
230
- [:updated_stylesheet, template_loc("import"), tempfile_loc("import")])
204
+ [:updating_stylesheet, template_loc("basic"), tempfile_loc("basic")],
205
+ [:updating_stylesheet, template_loc("import"), tempfile_loc("import")])
231
206
  end
232
207
  end
233
208
 
234
- def test_updated_stylesheet_callback_for_fresh_template
209
+ def test_updating_stylesheet_callback_for_fresh_template
235
210
  Sass::Plugin.options[:always_update] = false
236
- assert_no_callback :updated_stylesheet
211
+ assert_no_callback :updating_stylesheet
237
212
  end
238
213
 
239
- def test_updated_stylesheet_callback_for_error_template
214
+ def test_updating_stylesheet_callback_for_error_template
240
215
  Sass::Plugin.options[:always_update] = false
241
216
  touch 'bork1'
242
- assert_no_callback :updated_stylesheet
217
+ assert_no_callback :updating_stylesheet
243
218
  end
244
219
 
245
220
  def test_not_updating_stylesheet_callback_for_fresh_template
@@ -251,8 +226,8 @@ CSS
251
226
  Sass::Plugin.options[:always_update] = false
252
227
  assert_callback :not_updating_stylesheet, template_loc("complex"), tempfile_loc("complex") do
253
228
  assert_no_callbacks(
254
- [:updated_stylesheet, template_loc("basic"), tempfile_loc("basic")],
255
- [:updated_stylesheet, template_loc("import"), tempfile_loc("import")])
229
+ [:updating_stylesheet, template_loc("basic"), tempfile_loc("basic")],
230
+ [:updating_stylesheet, template_loc("import"), tempfile_loc("import")])
256
231
  end
257
232
  end
258
233
 
@@ -372,11 +347,9 @@ CSS
372
347
 
373
348
  def assert_callback(name, *expected_args)
374
349
  run = false
375
- received_args = nil
376
350
  Sass::Plugin.send("on_#{name}") do |*args|
377
- received_args = args
378
- run ||= expected_args.zip(received_args).all? do |ea, ra|
379
- ea.respond_to?(:call) ? ea.call(ra) : ea == ra
351
+ run ||= expected_args.zip(args).all? do |ea, a|
352
+ ea.respond_to?(:call) ? ea.call(a) : ea == a
380
353
  end
381
354
  end
382
355
 
@@ -386,7 +359,7 @@ CSS
386
359
  check_for_updates!
387
360
  end
388
361
 
389
- assert run, "Expected #{name} callback to be run with arguments:\n #{expected_args.inspect}\nHowever, it got:\n #{received_args.inspect}"
362
+ assert run, "Expected #{name} callback to be run with arguments:\n #{expected_args.inspect}"
390
363
  end
391
364
 
392
365
  def assert_no_callback(name, *unexpected_args)
@@ -1,5 +1,3 @@
1
- @import url(basic.css);
2
- @import url(../results/complex.css);
3
1
  imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
4
2
 
5
3
  body { font: Arial; background: blue; }
@@ -26,6 +24,8 @@ body { font: Arial; background: blue; }
26
24
  #content.user.show #container.top #column.right { width: 600px; }
27
25
  #content.user.show #container.bottom { background: brown; }
28
26
 
27
+ @import url(basic.css);
28
+ @import url(../results/complex.css);
29
29
  #foo { background-color: #bbaaff; }
30
30
 
31
31
  nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
@@ -1,5 +1,4 @@
1
1
  @charset "UTF-8";
2
- @import url(foo.css);
3
2
  .foo { a: b; }
4
3
 
5
4
  .bar { a: щ; }
@@ -1,5 +1,4 @@
1
1
  @charset "IBM866";
2
- @import url(foo.css);
3
2
  .foo { a: b; }
4
3
 
5
4
  .bar { a: �; }
@@ -1,5 +1,4 @@
1
1
  @charset "IBM866";
2
- @import url(foo.css);
3
2
  .foo { a: b; }
4
3
 
5
4
  .bar { a: �; }
@@ -1,5 +1,3 @@
1
- @import url(basic.css);
2
- @import url(../results/complex.css);
3
1
  imported { otherconst: hello; myconst: goodbye; pre-mixin: here; }
4
2
 
5
3
  body { font: Arial; background: blue; }
@@ -26,6 +24,8 @@ body { font: Arial; background: blue; }
26
24
  #content.user.show #container.top #column.right { width: 600px; }
27
25
  #content.user.show #container.bottom { background: brown; }
28
26
 
27
+ @import url(basic.css);
28
+ @import url(../results/complex.css);
29
29
  #foo { background-color: #bbaaff; }
30
30
 
31
31
  nonimported { myconst: hello; otherconst: goodbye; post-mixin: here; }
@@ -8,4 +8,4 @@ b {
8
8
  pt: -72pt;
9
9
  inches: 2in;
10
10
  more-inches: 3.5in;
11
- mixed: 2.042in; }
11
+ mixed: 6px; }
@@ -223,8 +223,6 @@ RUBY
223
223
  assert_renders '#{1 + 2}, #{3 + 4}'
224
224
  assert_renders '#{1 + 2} ,#{3 + 4}'
225
225
  assert_renders '#{1 + 2},#{3 + 4}'
226
- assert_renders '#{1 + 2}, #{3 + 4}, #{5 + 6}'
227
- assert_renders '3, #{3 + 4}, 11'
228
226
 
229
227
  assert_renders '3 / #{3 + 4}'
230
228
  assert_renders '3 /#{3 + 4}'
@@ -7,27 +7,19 @@ module Sass::Script::Functions::UserFunctions
7
7
  val.options[:foo]
8
8
  Sass::Script::String.new("Options defined!")
9
9
  end
10
-
11
- def arg_error
12
- assert_options
13
- end
14
- end
15
-
16
- module Sass::Script::Functions
17
- include Sass::Script::Functions::UserFunctions
18
10
  end
19
11
 
20
12
  class SassScriptTest < Test::Unit::TestCase
21
13
  include Sass::Script
22
14
 
23
15
  def test_color_checks_input
24
- assert_raise_message(ArgumentError, "Blue value -1 must be between 0 and 255") {Color.new([1, 2, -1])}
25
- assert_raise_message(ArgumentError, "Red value 256 must be between 0 and 255") {Color.new([256, 2, 3])}
16
+ assert_raise_message(ArgumentError, "Blue value must be between 0 and 255") {Color.new([1, 2, -1])}
17
+ assert_raise_message(ArgumentError, "Red value must be between 0 and 255") {Color.new([256, 2, 3])}
26
18
  end
27
19
 
28
20
  def test_color_checks_rgba_input
29
- assert_raise_message(ArgumentError, "Alpha channel 1.1 must be between 0 and 1") {Color.new([1, 2, 3, 1.1])}
30
- assert_raise_message(ArgumentError, "Alpha channel -0.1 must be between 0 and 1") {Color.new([1, 2, 3, -0.1])}
21
+ assert_raise_message(ArgumentError, "Alpha channel must be between 0 and 1") {Color.new([1, 2, 3, 1.1])}
22
+ assert_raise_message(ArgumentError, "Alpha channel must be between 0 and 1") {Color.new([1, 2, 3, -0.1])}
31
23
  end
32
24
 
33
25
  def test_string_escapes
@@ -138,8 +130,6 @@ class SassScriptTest < Test::Unit::TestCase
138
130
  assert_equal '3, 7', resolve('#{1 + 2}, #{3 + 4}')
139
131
  assert_equal '3 ,7', resolve('#{1 + 2} ,#{3 + 4}')
140
132
  assert_equal '3,7', resolve('#{1 + 2},#{3 + 4}')
141
- assert_equal '3, 7, 11', resolve('#{1 + 2}, #{3 + 4}, #{5 + 6}')
142
- assert_equal '3, 7, 11', resolve('3, #{3 + 4}, 11')
143
133
 
144
134
  assert_equal '3 / 7', resolve('3 / #{3 + 4}')
145
135
  assert_equal '3 /7', resolve('3 /#{3 + 4}')
@@ -359,7 +349,6 @@ SASS
359
349
 
360
350
  def test_operator_unit_conversion
361
351
  assert_equal "1.1cm", resolve("1cm + 1mm")
362
- assert_equal "2in", resolve("1in + 96px")
363
352
  assert_equal "true", resolve("2mm < 1cm")
364
353
  assert_equal "true", resolve("10mm == 1cm")
365
354
  assert_equal "true", resolve("1 == 1cm")
@@ -425,19 +414,6 @@ SASS
425
414
  assert_raise_message(Sass::SyntaxError, "() isn't a valid CSS value.") {resolve("nth(append((), ()), 1)")}
426
415
  end
427
416
 
428
- def test_deep_argument_error_not_unwrapped
429
- assert_raise_message(ArgumentError, 'wrong number of arguments (0 for 1)') {resolve("arg-error()")}
430
- end
431
-
432
- def test_shallow_argument_error_unwrapped
433
- assert_raise_message(Sass::SyntaxError, "wrong number of arguments (1 for 0) for `arg-error'") {resolve("arg-error(1)")}
434
- end
435
-
436
- def test_boolean_ops_short_circuit
437
- assert_equal "false", resolve("$ie and $ie <= 7", {}, env('ie' => Sass::Script::Bool.new(false)))
438
- assert_equal "true", resolve("$ie or $undef", {}, env('ie' => Sass::Script::Bool.new(true)))
439
- end
440
-
441
417
  # Regression Tests
442
418
 
443
419
  def test_funcall_has_higher_precedence_than_color_name
@@ -412,15 +412,6 @@ foo {
412
412
  SCSS
413
413
  end
414
414
 
415
- def test_element_function
416
- assert_parses <<SCSS
417
- foo {
418
- a: -moz-element(#foo);
419
- b: -webkit-element(#foo);
420
- b: -foobar-element(#foo); }
421
- SCSS
422
- end
423
-
424
415
  def test_unary_ops
425
416
  assert_equal <<CSS, render(<<SCSS)
426
417
  foo {
@@ -595,50 +586,6 @@ CSS
595
586
  SCSS
596
587
  end
597
588
 
598
- def test_moz_document_directive
599
- assert_equal <<CSS, render(<<SCSS)
600
- @-moz-document url(http://www.w3.org/),
601
- url-prefix(http://www.w3.org/Style/),
602
- domain(mozilla.org),
603
- regexp("^https:.*") {
604
- .foo {
605
- a: b; } }
606
- CSS
607
- @-moz-document url(http://www.w3.org/),
608
- url-prefix(http://www.w3.org/Style/),
609
- domain(mozilla.org),
610
- regexp("^https:.*") {
611
- .foo {a: b}
612
- }
613
- SCSS
614
- end
615
-
616
- def test_supports
617
- assert_equal <<CSS, render(<<SCSS)
618
- @supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
619
- .foo {
620
- a: b; } }
621
- CSS
622
- @supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
623
- .foo {
624
- a: b;
625
- }
626
- }
627
- SCSS
628
-
629
- assert_equal <<CSS, render(<<SCSS)
630
- @-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
631
- .foo {
632
- a: b; } }
633
- CSS
634
- @-prefix-supports (a: b) and (c: d) or (not (d: e)) and ((not (f: g)) or (not ((h: i) and (j: k)))) {
635
- .foo {
636
- a: b;
637
- }
638
- }
639
- SCSS
640
- end
641
-
642
589
  ## Selectors
643
590
 
644
591
  # Taken from http://www.w3.org/TR/css3-selectors/#selectors
@@ -853,12 +800,6 @@ SCSS
853
800
  assert_selector_parses('E*:hover')
854
801
  end
855
802
 
856
- def test_spaceless_combo_selectors
857
- assert_equal "E > F {\n a: b; }\n", render("E>F { a: b;} ")
858
- assert_equal "E ~ F {\n a: b; }\n", render("E~F { a: b;} ")
859
- assert_equal "E + F {\n a: b; }\n", render("E+F { a: b;} ")
860
- end
861
-
862
803
  ## Errors
863
804
 
864
805
  def test_invalid_directives
@@ -946,10 +887,6 @@ SCSS
946
887
 
947
888
  ## Regressions
948
889
 
949
- def test_selector_without_closing_bracket
950
- assert_not_parses('"]"', "foo[bar <err>{a: b}")
951
- end
952
-
953
890
  def test_closing_line_comment_end_with_compact_output
954
891
  assert_equal(<<CSS, render(<<SCSS, :style => :compact))
955
892
  /* foo */
@@ -962,21 +899,6 @@ bar {baz: bang}
962
899
  SCSS
963
900
  end
964
901
 
965
- def test_single_line_comment_within_multiline_comment
966
- assert_equal(<<CSS, render(<<SCSS))
967
- body {
968
- /*
969
- //comment here
970
- */ }
971
- CSS
972
- body {
973
- /*
974
- //comment here
975
- */
976
- }
977
- SCSS
978
- end
979
-
980
902
  private
981
903
 
982
904
  def assert_selector_parses(selector)
@@ -987,7 +909,7 @@ SCSS
987
909
  end
988
910
 
989
911
  def render(scss, options = {})
990
- tree = Sass::SCSS::CssParser.new(scss, options[:filename]).parse
912
+ tree = Sass::SCSS::CssParser.new(scss).parse
991
913
  tree.options = Sass::Engine::DEFAULT_OPTIONS.merge(options)
992
914
  tree.render
993
915
  end