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
@@ -1,5 +1,3 @@
1
- require 'date'
2
-
3
1
  # This is necessary for loading Sass when Haml is required in Rails 3.
4
2
  # Once the split is complete, we can remove it.
5
3
  require File.dirname(__FILE__) + '/../sass'
@@ -18,7 +16,6 @@ module Sass
18
16
  # The `:name` key has the name of the version.
19
17
  # The `:string` key contains a human-readable string representation of the version.
20
18
  # The `:number` key is the major, minor, and teeny keys separated by periods.
21
- # The `:date` key, which is not guaranteed to be defined, is the [DateTime] at which this release was cut.
22
19
  # If Sass is checked out from Git, the `:rev` key will have the revision hash.
23
20
  # For example:
24
21
  #
@@ -26,7 +23,6 @@ module Sass
26
23
  # :string => "2.1.0.9616393",
27
24
  # :rev => "9616393b8924ef36639c7e82aa88a51a24d16949",
28
25
  # :number => "2.1.0",
29
- # :date => DateTime.parse("Apr 30 13:52:01 2009 -0700"),
30
26
  # :major => 2, :minor => 1, :teeny => 0
31
27
  # }
32
28
  #
@@ -40,7 +36,6 @@ module Sass
40
36
  # {
41
37
  # :string => "3.0.beta.1",
42
38
  # :number => "3.0.beta.1",
43
- # :date => DateTime.parse("Mar 31 00:38:04 2010 -0700"),
44
39
  # :major => 3, :minor => 0, :teeny => -1,
45
40
  # :prerelease => "beta",
46
41
  # :prerelease_number => 1
@@ -60,10 +55,6 @@ module Sass
60
55
  :name => name
61
56
  }
62
57
 
63
- if date = version_date
64
- @@version[:date] = date
65
- end
66
-
67
58
  if numbers[3].is_a?(String)
68
59
  @@version[:teeny] = -1
69
60
  @@version[:prerelease] = numbers[3]
@@ -110,11 +101,6 @@ module Sass
110
101
  end
111
102
  return nil
112
103
  end
113
-
114
- def version_date
115
- return unless File.exists?(scope('VERSION_DATE'))
116
- return DateTime.parse(File.read(scope('VERSION_DATE')).strip)
117
- end
118
104
  end
119
105
 
120
106
  extend Sass::Version
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require File.dirname(__FILE__) + '/../test_helper'
3
- require File.dirname(__FILE__) + '/test_helper'
4
3
  require 'sass/engine'
5
4
 
6
5
  class CacheTest < Test::Unit::TestCase
@@ -12,7 +11,6 @@ class CacheTest < Test::Unit::TestCase
12
11
 
13
12
  def teardown
14
13
  FileUtils.rm_rf @@cache_dir
15
- clean_up_sassc
16
14
  end
17
15
 
18
16
  def test_file_cache_writes_a_file
@@ -66,19 +64,6 @@ class CacheTest < Test::Unit::TestCase
66
64
  assert_equal an_object, cache.retrieve("an_object", "")
67
65
  end
68
66
 
69
- class Unmarshalable
70
- def _dump(_)
71
- raise 'Unmarshalable'
72
- end
73
- end
74
-
75
- def test_cache_node_with_unmarshalable_option
76
- engine = Sass::Engine.new("foo {a: b + c}",
77
- :syntax => :scss, :object => Unmarshalable.new, :filename => 'file.scss',
78
- :importer => Sass::Importers::Filesystem.new(absolutize('templates')))
79
- engine.to_tree
80
- end
81
-
82
67
  private
83
68
  def root_node
84
69
  Sass::Engine.new(<<-SCSS, :syntax => :scss).to_tree
@@ -180,7 +180,7 @@ SCSS
180
180
  def test_multiline_properties
181
181
  assert_scss_to_sass <<SASS, <<SCSS
182
182
  foo bar
183
- baz: bip bam boon
183
+ baz: bip bam boon
184
184
  SASS
185
185
  foo bar {
186
186
  baz:
@@ -191,7 +191,7 @@ SCSS
191
191
 
192
192
  assert_scss_to_scss <<OUT, <<IN
193
193
  foo bar {
194
- baz: bip bam boon; }
194
+ baz: bip bam boon; }
195
195
  OUT
196
196
  foo bar {
197
197
  baz:
@@ -771,16 +771,6 @@ SASS
771
771
  SCSS
772
772
  end
773
773
 
774
- def test_comma_extendee
775
- assert_renders <<SASS, <<SCSS
776
- .baz
777
- @extend .foo, .bar
778
- SASS
779
- .baz {
780
- @extend .foo, .bar; }
781
- SCSS
782
- end
783
-
784
774
  def test_argless_mixin_definition
785
775
  assert_renders <<SASS, <<SCSS
786
776
  =foo-bar
@@ -1141,13 +1131,17 @@ div
1141
1131
  SASS
1142
1132
  end
1143
1133
 
1144
- def test_loud_comment_conversion
1134
+ def test_loud_comment_conversion
1145
1135
  assert_renders(<<SASS, <<SCSS)
1146
1136
  /*! \#{"interpolated"}
1137
+ /*!
1138
+ * \#{"also interpolated"}
1147
1139
  SASS
1148
1140
  /*! \#{"interpolated"} */
1141
+ /*!
1142
+ * \#{"also interpolated"} */
1149
1143
  SCSS
1150
- silence_warnings {assert_renders(<<SASS, <<SCSS)}
1144
+ assert_renders(<<SASS, <<SCSS)
1151
1145
  //! \#{"interpolated"}
1152
1146
  //!
1153
1147
  //! \#{"also interpolated"}
@@ -1158,42 +1152,6 @@ SASS
1158
1152
  SCSS
1159
1153
  end
1160
1154
 
1161
- ## Regression Tests
1162
-
1163
- def test_empty_lists
1164
- assert_renders(<<SASS, <<SCSS)
1165
- $foo: ()
1166
- SASS
1167
- $foo: ();
1168
- SCSS
1169
- end
1170
-
1171
- def test_nested_if_statements
1172
- assert_renders(<<SASS, <<SCSS)
1173
- @if $foo
1174
- one
1175
- a: b
1176
- @else
1177
- @if $bar
1178
- two
1179
- a: b
1180
- @else
1181
- three
1182
- a: b
1183
- SASS
1184
- @if $foo {
1185
- one {
1186
- a: b; } }
1187
- @else {
1188
- @if $bar {
1189
- two {
1190
- a: b; } }
1191
- @else {
1192
- three {
1193
- a: b; } } }
1194
- SCSS
1195
- end
1196
-
1197
1155
  private
1198
1156
 
1199
1157
  def assert_sass_to_sass(sass, options = {})
@@ -268,39 +268,6 @@ SASS
268
268
  CSS
269
269
  end
270
270
 
271
- def test_double_comma
272
- assert_equal(<<SASS, css2sass(<<CSS))
273
- foo, bar
274
- a: b
275
- SASS
276
- foo, , bar { a: b }
277
- CSS
278
- end
279
-
280
- def test_selector_splitting
281
- assert_equal(<<SASS, css2sass(<<CSS))
282
- .foo >
283
- .bar
284
- a: b
285
- .baz
286
- c: d
287
- SASS
288
- .foo>.bar {a: b}
289
- .foo>.baz {c: d}
290
- CSS
291
-
292
- assert_equal(<<SASS, css2sass(<<CSS))
293
- .foo
294
- &::bar
295
- a: b
296
- &::baz
297
- c: d
298
- SASS
299
- .foo::bar {a: b}
300
- .foo::baz {c: d}
301
- CSS
302
- end
303
-
304
271
  # Error reporting
305
272
 
306
273
  def test_error_reporting
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require File.dirname(__FILE__) + '/../test_helper'
4
- require File.dirname(__FILE__) + '/test_helper'
3
+ require 'test_helper'
4
+ require 'sass/test_helper'
5
5
  require 'sass/engine'
6
6
  require 'stringio'
7
7
  require 'mock_importer'
@@ -57,14 +57,16 @@ MSG
57
57
  "& a\n :b c" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
58
58
  "a\n :b\n c" => "Illegal nesting: Only properties may be nested beneath properties.",
59
59
  "$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
60
+ "@import foo.sass" => "File to import not found or unreadable: foo.sass.",
60
61
  "$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
62
+ "@import foo.sass" => <<MSG,
63
+ File to import not found or unreadable: foo.sass.
64
+ Load path: .
65
+ MSG
61
66
  "@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.",
62
67
  "foo\n @import foo.css" => "CSS import directives may only be used at the root of a document.",
63
68
  "@if true\n @import foo" => "Import directives may not be used within control directives or mixins.",
64
- "@if true\n .foo\n @import foo" => "Import directives may not be used within control directives or mixins.",
65
69
  "@mixin foo\n @import foo" => "Import directives may not be used within control directives or mixins.",
66
- "@mixin foo\n .foo\n @import foo" => "Import directives may not be used within control directives or mixins.",
67
- "@import foo;" => "Invalid @import: expected end of line, was \";\".",
68
70
  '$foo: "bar" "baz" !' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "!"},
69
71
  '$foo: "bar" "baz" $' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "$"},
70
72
  "=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.",
@@ -142,7 +144,6 @@ MSG
142
144
  "$var: true\n@while $var\n @extend .bar\n $var: false" => ["Extend directives may only be used within rules.", 3],
143
145
  "@for $i from 0 to 1\n @extend .bar" => ["Extend directives may only be used within rules.", 2],
144
146
  "@mixin foo\n @extend .bar\n@include foo" => ["Extend directives may only be used within rules.", 2],
145
- "@import \"foo\" // bar" => "Invalid @import: \"\"foo\" // bar\"",
146
147
 
147
148
  # Regression tests
148
149
  "a\n b:\n c\n d" => ["Illegal nesting: Only properties may be nested beneath properties.", 3],
@@ -262,7 +263,7 @@ SASS
262
263
  end
263
264
 
264
265
  def test_imported_exception
265
- [1, 2, 3, 4, 5].each do |i|
266
+ [1, 2, 3, 4].each do |i|
266
267
  begin
267
268
  Sass::Engine.new("@import bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
268
269
  rescue Sass::SyntaxError => err
@@ -284,7 +285,7 @@ SASS
284
285
  end
285
286
 
286
287
  def test_double_imported_exception
287
- [1, 2, 3, 4, 5].each do |i|
288
+ [1, 2, 3, 4].each do |i|
288
289
  begin
289
290
  Sass::Engine.new("@import nested_bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
290
291
  rescue Sass::SyntaxError => err
@@ -309,23 +310,6 @@ SASS
309
310
  end
310
311
  end
311
312
 
312
- def test_selector_tracing
313
- actual_css = render(<<-SCSS, :syntax => :scss, :trace_selectors => true)
314
- @mixin mixed {
315
- .mixed { color: red; }
316
- }
317
- .context {
318
- @include mixed;
319
- }
320
- SCSS
321
- assert_equal(<<CSS,actual_css)
322
- /* on line 2 of test_selector_tracing_inline.scss, in `mixed'
323
- from line 5 of test_selector_tracing_inline.scss */
324
- .context .mixed {
325
- color: red; }
326
- CSS
327
- end
328
-
329
313
  def test_mixin_exception
330
314
  render(<<SASS)
331
315
  =error-mixin($a)
@@ -473,53 +457,6 @@ MESSAGE
473
457
  assert_hash_has(err.sass_backtrace[2], :mixin => "foo", :line => 2)
474
458
  end
475
459
 
476
- def test_basic_import_loop_exception
477
- import = filename_for_test
478
- importer = MockImporter.new
479
- importer.add_import(import, "@import '#{import}'")
480
-
481
- engine = Sass::Engine.new("@import '#{import}'", :filename => import,
482
- :load_paths => [importer])
483
-
484
- assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
485
- An @import loop has been found: #{import} imports itself
486
- ERR
487
- end
488
-
489
- def test_double_import_loop_exception
490
- importer = MockImporter.new
491
- importer.add_import("foo", "@import 'bar'")
492
- importer.add_import("bar", "@import 'foo'")
493
-
494
- engine = Sass::Engine.new('@import "foo"', :filename => filename_for_test,
495
- :load_paths => [importer])
496
-
497
- assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
498
- An @import loop has been found:
499
- #{filename_for_test} imports foo
500
- foo imports bar
501
- bar imports foo
502
- ERR
503
- end
504
-
505
- def test_deep_import_loop_exception
506
- importer = MockImporter.new
507
- importer.add_import("foo", "@import 'bar'")
508
- importer.add_import("bar", "@import 'baz'")
509
- importer.add_import("baz", "@import 'foo'")
510
-
511
- engine = Sass::Engine.new('@import "foo"', :filename => filename_for_test,
512
- :load_paths => [importer])
513
-
514
- assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) {engine.render}
515
- An @import loop has been found:
516
- #{filename_for_test} imports foo
517
- foo imports bar
518
- bar imports baz
519
- baz imports foo
520
- ERR
521
- end
522
-
523
460
  def test_exception_css_with_offset
524
461
  opts = {:full_exception => true, :line => 362}
525
462
  render(("a\n b: c\n" * 10) + "d\n e:\n" + ("f\n g: h\n" * 10), opts)
@@ -611,21 +548,13 @@ CSS
611
548
  end
612
549
 
613
550
  def test_http_import
614
- assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
551
+ assert_equal("@import url(http://fonts.googleapis.com/css?family=Droid+Sans);\n",
615
552
  render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\""))
616
553
  end
617
554
 
618
- def test_import_with_interpolation
619
- assert_warning(<<WARNING) do
620
- DEPRECATION WARNING on line 2 of test_import_with_interpolation_inline.sass:
621
- @import directives using \#{} interpolation will need to use url() in Sass 3.2.
622
- For example:
623
-
624
- @import url("http://\#{$url}/style.css");
625
- WARNING
626
- assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
627
- render("$family: unquote(\"Droid+Sans\")\n@import \"http://fonts.googleapis.com/css?family=\#{$family}\"\n"))
628
- end
555
+ def test_http_import_with_interpolation
556
+ assert_equal("@import url(http://fonts.googleapis.com/css?family=Droid+Sans);\n",
557
+ render("$family: unquote(\"Droid+Sans\")\n@import \"http://fonts.googleapis.com/css?family=\#{$family}\"\n"))
629
558
  assert_equal("@import url(\"http://fonts.googleapis.com/css?family=Droid+Sans\");\n",
630
559
  render("$family: unquote(\"Droid+Sans\")\n@import url(\"http://fonts.googleapis.com/css?family=\#{$family}\")\n"))
631
560
  end
@@ -650,21 +579,12 @@ WARNING
650
579
  assert File.exists?(sassc_file)
651
580
  end
652
581
 
653
- def test_nonexistent_import
654
- assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
655
- File to import not found or unreadable: nonexistent.sass.
656
- Load path: #{Dir.pwd}
657
- ERR
658
- render("@import nonexistent.sass")
659
- end
660
- end
661
-
662
582
  def test_nonexistent_extensionless_import
663
583
  assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
664
584
  File to import not found or unreadable: nonexistent.
665
- Load path: #{Dir.pwd}
585
+ Load path: .
666
586
  ERR
667
- render("@import nonexistent")
587
+ assert_equal("@import url(nonexistent.css);\n", render("@import nonexistent"))
668
588
  end
669
589
  end
670
590
 
@@ -1017,23 +937,6 @@ foo
1017
937
  SASS
1018
938
  end
1019
939
 
1020
- def test_debug_info_in_keyframes
1021
- assert_equal(<<CSS, render(<<SASS, :debug_info => true))
1022
- @-webkit-keyframes warm {
1023
- from {
1024
- color: black; }
1025
-
1026
- to {
1027
- color: red; } }
1028
- CSS
1029
- @-webkit-keyframes warm
1030
- from
1031
- color: black
1032
- to
1033
- color: red
1034
- SASS
1035
- end
1036
-
1037
940
  def test_empty_first_line
1038
941
  assert_equal("#a {\n b: c; }\n", render("#a\n\n b: c"))
1039
942
  end
@@ -1278,18 +1181,6 @@ bar
1278
1181
  SASS
1279
1182
  end
1280
1183
 
1281
- def test_control_directive_in_nested_property
1282
- assert_equal(<<CSS, render(<<SASS))
1283
- foo {
1284
- a-b: c; }
1285
- CSS
1286
- foo
1287
- a:
1288
- @if true
1289
- b: c
1290
- SASS
1291
- end
1292
-
1293
1184
  def test_interpolation
1294
1185
  assert_equal("a-1 {\n b-2-3: c-3; }\n", render(<<SASS))
1295
1186
  $a: 1
@@ -1657,11 +1548,11 @@ foo
1657
1548
  */
1658
1549
  SASS
1659
1550
  end
1660
-
1661
1551
  def test_loud_comment_in_silent_comment
1662
- silence_warnings {assert_equal <<CSS, render(<<SASS, :style => :compressed)}
1552
+ assert_equal <<CSS, render(<<SASS, :style => :compressed)
1663
1553
  foo{color:blue;/* foo */
1664
1554
  /* bar */
1555
+ /* */
1665
1556
  /* bip */
1666
1557
  /* baz */}
1667
1558
  CSS
@@ -1677,7 +1568,8 @@ SASS
1677
1568
 
1678
1569
  def test_loud_comment_is_evaluated
1679
1570
  assert_equal <<CSS, render(<<SASS)
1680
- /* Hue: 327.216deg */
1571
+ /*
1572
+ * Hue: 327.216deg */
1681
1573
  CSS
1682
1574
  /*!
1683
1575
  Hue: \#{hue(#f836a0)}
@@ -1880,22 +1772,22 @@ SASS
1880
1772
 
1881
1773
  def test_interpolation_doesnt_deep_unquote_strings
1882
1774
  assert_equal(<<CSS, render(<<SASS))
1883
- .foo {
1884
- a: "bar" "baz"; }
1775
+ .foo- "bar" "baz" {
1776
+ a: b; }
1885
1777
  CSS
1886
- .foo
1887
- a: \#{"bar" "baz"}
1778
+ .foo-\#{"bar" "baz"}
1779
+ a: b
1888
1780
  SASS
1889
1781
  end
1890
1782
 
1891
1783
  def test_warn_directive
1892
1784
  expected_warning = <<EXPECTATION
1893
1785
  WARNING: this is a warning
1894
- on line 4 of test_warn_directive_inline.sass
1786
+ on line 4 of test_warn_directive_inline.sass
1895
1787
 
1896
1788
  WARNING: this is a mixin warning
1897
- on line 2 of test_warn_directive_inline.sass, in `foo'
1898
- from line 7 of test_warn_directive_inline.sass
1789
+ on line 2 of test_warn_directive_inline.sass, in `foo'
1790
+ from line 7 of test_warn_directive_inline.sass
1899
1791
  EXPECTATION
1900
1792
  assert_warning expected_warning do
1901
1793
  assert_equal <<CSS, render(<<SASS)
@@ -1925,15 +1817,15 @@ SASS
1925
1817
  def test_warn_with_imports
1926
1818
  expected_warning = <<WARN
1927
1819
  WARNING: In the main file
1928
- on line 1 of #{File.dirname(__FILE__)}/templates/warn.sass
1820
+ on line 1 of #{File.dirname(__FILE__)}/templates/warn.sass
1929
1821
 
1930
1822
  WARNING: Imported
1931
- on line 1 of #{File.dirname(__FILE__)}/templates/warn_imported.sass
1932
- from line 2 of #{File.dirname(__FILE__)}/templates/warn.sass
1823
+ on line 1 of #{File.dirname(__FILE__)}/templates/warn_imported.sass
1824
+ from line 2 of #{File.dirname(__FILE__)}/templates/warn.sass
1933
1825
 
1934
1826
  WARNING: In an imported mixin
1935
- on line 4 of #{File.dirname(__FILE__)}/templates/warn_imported.sass, in `emits-a-warning'
1936
- from line 3 of #{File.dirname(__FILE__)}/templates/warn.sass
1827
+ on line 4 of #{File.dirname(__FILE__)}/templates/warn_imported.sass, in `emits-a-warning'
1828
+ from line 3 of #{File.dirname(__FILE__)}/templates/warn.sass
1937
1829
  WARN
1938
1830
  assert_warning expected_warning do
1939
1831
  renders_correctly "warn", :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"]
@@ -2054,19 +1946,6 @@ CSS
2054
1946
  SASS
2055
1947
  end
2056
1948
 
2057
- def test_double_media_bubbling_with_commas
2058
- assert_equal <<CSS, render(<<SASS)
2059
- @media foo and baz, foo and bang, bar and baz, bar and bang {
2060
- .foo {
2061
- c: d; } }
2062
- CSS
2063
- @media foo, bar
2064
- @media baz, bang
2065
- .foo
2066
- c: d
2067
- SASS
2068
- end
2069
-
2070
1949
  def test_rule_media_rule_bubbling
2071
1950
  assert_equal <<CSS, render(<<SASS)
2072
1951
  @media bar {
@@ -2129,49 +2008,6 @@ CSS
2129
2008
 
2130
2009
  # Regression tests
2131
2010
 
2132
- def test_tricky_mixin_loop_exception
2133
- render <<SASS
2134
- @mixin foo($a)
2135
- @if $a
2136
- @include foo(false)
2137
- @include foo(true)
2138
- @else
2139
- a: b
2140
-
2141
- a
2142
- @include foo(true)
2143
- SASS
2144
- assert(false, "Exception not raised")
2145
- rescue Sass::SyntaxError => err
2146
- assert_equal("An @include loop has been found: foo includes itself", err.message)
2147
- assert_hash_has(err.sass_backtrace[0], :mixin => "foo", :line => 3)
2148
- end
2149
-
2150
- def test_interpolated_comment_in_mixin
2151
- assert_equal <<CSS, render(<<SASS)
2152
- /* color: red */
2153
- .foo {
2154
- color: red; }
2155
-
2156
- /* color: blue */
2157
- .foo {
2158
- color: blue; }
2159
-
2160
- /* color: green */
2161
- .foo {
2162
- color: green; }
2163
- CSS
2164
- =foo($var)
2165
- /*! color: \#{$var}
2166
- .foo
2167
- color: $var
2168
-
2169
- +foo(red)
2170
- +foo(blue)
2171
- +foo(green)
2172
- SASS
2173
- end
2174
-
2175
2011
  def test_parens_in_mixins
2176
2012
  assert_equal(<<CSS, render(<<SASS))
2177
2013
  .foo {
@@ -2450,16 +2286,7 @@ SASS
2450
2286
  WARNING:
2451
2287
  On line 1 of 'test_comment_interpolation_warning_inline.sass'
2452
2288
  Comments will evaluate the contents of interpolations (\#{ ... }) in Sass 3.2.
2453
- Please escape the interpolation by adding a backslash before the `#`.
2454
- END
2455
- end
2456
-
2457
- def test_loud_silent_comment_warning
2458
- assert_warning(<<END) {render("//! \#{foo}")}
2459
- WARNING:
2460
- On line 1 of 'test_loud_silent_comment_warning_inline.sass'
2461
- `//` comments will no longer be allowed to use the `!` flag in Sass 3.2.
2462
- Please change to `/*` comments.
2289
+ Please escape the interpolation by adding a backslash before the hash sign.
2463
2290
  END
2464
2291
  end
2465
2292
 
@@ -2476,38 +2303,6 @@ CSS
2476
2303
  SASS
2477
2304
  end
2478
2305
 
2479
- def test_selector_compression
2480
- assert_equal <<CSS, render(<<SASS, :style => :compressed)
2481
- a>b,c+d,:-moz-any(e,f,g){h:i}
2482
- CSS
2483
- a > b, c + d, :-moz-any(e, f, g)
2484
- h: i
2485
- SASS
2486
- end
2487
-
2488
- def test_comment_like_selector
2489
- assert_raise_message(Sass::SyntaxError, 'Invalid CSS after "": expected selector, was "/ foo"') {render(<<SASS)}
2490
- / foo
2491
- a: b
2492
- SASS
2493
- end
2494
-
2495
- def test_nested_empty_directive
2496
- assert_equal <<CSS, render(<<SASS)
2497
- @media screen {
2498
- .foo {
2499
- a: b; }
2500
-
2501
- @unknown-directive; }
2502
- CSS
2503
- @media screen
2504
- .foo
2505
- a: b
2506
-
2507
- @unknown-directive
2508
- SASS
2509
- end
2510
-
2511
2306
  # Encodings
2512
2307
 
2513
2308
  unless Sass::Util.ruby1_8?
@@ -2620,31 +2415,6 @@ CSS
2620
2415
  a: b
2621
2416
  SASS
2622
2417
  end
2623
-
2624
- # Encoding Regression Test
2625
-
2626
- def test_multibyte_prop_name
2627
- assert_equal(<<CSS, render(<<SASS))
2628
- @charset "UTF-8";
2629
- #bar {
2630
- cölor: blue; }
2631
- CSS
2632
- #bar
2633
- cölor: blue
2634
- SASS
2635
- end
2636
-
2637
- def test_multibyte_and_interpolation
2638
- assert_equal(<<CSS, render(<<SCSS, :syntax => :scss))
2639
- #bar {
2640
- background: a 0%; }
2641
- CSS
2642
- #bar {
2643
- // 
2644
- background: \#{a} 0%;
2645
- }
2646
- SCSS
2647
- end
2648
2418
  end
2649
2419
 
2650
2420
  def test_original_filename_set
@@ -2660,27 +2430,6 @@ SCSS
2660
2430
  assert_equal original_filename, importer.engine("imported").options[:original_filename]
2661
2431
  end
2662
2432
 
2663
- def test_deprecated_PRECISION
2664
- assert_warning(<<END) {assert_equal 1000.0, Sass::Script::Number::PRECISION}
2665
- Sass::Script::Number::PRECISION is deprecated and will be removed in a future release. Use Sass::Script::Number.precision_factor instead.
2666
- END
2667
- end
2668
- def test_changing_precision
2669
- begin
2670
- Sass::Script::Number.precision = 8
2671
- assert_equal <<CSS, render(<<SASS)
2672
- div {
2673
- maximum: 1.00000001;
2674
- too-much: 1.0; }
2675
- CSS
2676
- div
2677
- maximum : 1.00000001
2678
- too-much: 1.000000001
2679
- SASS
2680
- ensure
2681
- Sass::Script::Number.precision = 3
2682
- end
2683
- end
2684
2433
 
2685
2434
  private
2686
2435