haml 3.1.8 → 3.2.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

Files changed (148) hide show
  1. data/CONTRIBUTING +1 -1
  2. data/README.md +2 -2
  3. data/REVISION +1 -1
  4. data/Rakefile +16 -41
  5. data/VERSION +1 -1
  6. data/VERSION_NAME +1 -1
  7. data/lib/haml/buffer.rb +1 -5
  8. data/lib/haml/compiler.rb +7 -8
  9. data/lib/haml/exec.rb +1 -1
  10. data/lib/haml/helpers.rb +3 -5
  11. data/lib/haml/helpers/action_view_mods.rb +5 -21
  12. data/lib/haml/parser.rb +1 -1
  13. data/lib/haml/template.rb +1 -3
  14. data/lib/haml/util.rb +1 -1
  15. data/test/haml/engine_test.rb +12 -51
  16. data/test/haml/helper_test.rb +8 -25
  17. data/test/haml/html2haml_test.rb +1 -1
  18. data/test/haml/results/whitespace_handling.xhtml +50 -46
  19. data/test/haml/template_test.rb +2 -28
  20. data/test/haml/templates/partial_layout.haml +1 -4
  21. data/test/linked_rails.rb +4 -4
  22. data/vendor/sass/VERSION +1 -1
  23. data/vendor/sass/doc-src/SASS_CHANGELOG.md +2 -115
  24. data/vendor/sass/doc-src/SASS_REFERENCE.md +4 -12
  25. data/vendor/sass/lib/sass.rb +0 -1
  26. data/vendor/sass/lib/sass/cache_stores/base.rb +1 -3
  27. data/vendor/sass/lib/sass/cache_stores/filesystem.rb +0 -2
  28. data/vendor/sass/lib/sass/css.rb +1 -2
  29. data/vendor/sass/lib/sass/engine.rb +23 -39
  30. data/vendor/sass/lib/sass/environment.rb +0 -11
  31. data/vendor/sass/lib/sass/exec.rb +1 -14
  32. data/vendor/sass/lib/sass/importers/base.rb +1 -2
  33. data/vendor/sass/lib/sass/importers/filesystem.rb +13 -18
  34. data/vendor/sass/lib/sass/less.rb +2 -2
  35. data/vendor/sass/lib/sass/plugin.rb +8 -4
  36. data/vendor/sass/lib/sass/plugin/compiler.rb +17 -42
  37. data/vendor/sass/lib/sass/plugin/configuration.rb +2 -0
  38. data/vendor/sass/lib/sass/railtie.rb +1 -1
  39. data/vendor/sass/lib/sass/script/funcall.rb +1 -14
  40. data/vendor/sass/lib/sass/script/functions.rb +1 -44
  41. data/vendor/sass/lib/sass/script/interpolation.rb +0 -9
  42. data/vendor/sass/lib/sass/script/lexer.rb +1 -6
  43. data/vendor/sass/lib/sass/script/list.rb +0 -7
  44. data/vendor/sass/lib/sass/script/literal.rb +0 -5
  45. data/vendor/sass/lib/sass/script/node.rb +0 -8
  46. data/vendor/sass/lib/sass/script/number.rb +5 -28
  47. data/vendor/sass/lib/sass/script/operation.rb +0 -8
  48. data/vendor/sass/lib/sass/script/parser.rb +5 -12
  49. data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -9
  50. data/vendor/sass/lib/sass/script/unary_operation.rb +0 -7
  51. data/vendor/sass/lib/sass/script/variable.rb +0 -5
  52. data/vendor/sass/lib/sass/scss/parser.rb +38 -78
  53. data/vendor/sass/lib/sass/scss/rx.rb +1 -2
  54. data/vendor/sass/lib/sass/scss/static_parser.rb +2 -2
  55. data/vendor/sass/lib/sass/shared.rb +1 -1
  56. data/vendor/sass/lib/sass/tree/comment_node.rb +11 -24
  57. data/vendor/sass/lib/sass/tree/debug_node.rb +1 -1
  58. data/vendor/sass/lib/sass/tree/each_node.rb +1 -1
  59. data/vendor/sass/lib/sass/tree/extend_node.rb +1 -1
  60. data/vendor/sass/lib/sass/tree/for_node.rb +2 -2
  61. data/vendor/sass/lib/sass/tree/function_node.rb +1 -1
  62. data/vendor/sass/lib/sass/tree/if_node.rb +14 -1
  63. data/vendor/sass/lib/sass/tree/mixin_def_node.rb +1 -1
  64. data/vendor/sass/lib/sass/tree/mixin_node.rb +2 -2
  65. data/vendor/sass/lib/sass/tree/node.rb +5 -2
  66. data/vendor/sass/lib/sass/tree/prop_node.rb +9 -2
  67. data/vendor/sass/lib/sass/tree/return_node.rb +1 -1
  68. data/vendor/sass/lib/sass/tree/rule_node.rb +2 -9
  69. data/vendor/sass/lib/sass/tree/variable_node.rb +1 -1
  70. data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +18 -17
  71. data/vendor/sass/lib/sass/tree/visitors/convert.rb +5 -10
  72. data/vendor/sass/lib/sass/tree/visitors/perform.rb +19 -50
  73. data/vendor/sass/lib/sass/tree/visitors/to_css.rb +15 -9
  74. data/vendor/sass/lib/sass/tree/warn_node.rb +1 -1
  75. data/vendor/sass/lib/sass/tree/while_node.rb +1 -1
  76. data/vendor/sass/lib/sass/util.rb +6 -58
  77. data/vendor/sass/sass.gemspec +1 -2
  78. data/vendor/sass/test/sass/cache_test.rb +0 -15
  79. data/vendor/sass/test/sass/conversion_test.rb +6 -2
  80. data/vendor/sass/test/sass/css2sass_test.rb +0 -9
  81. data/vendor/sass/test/sass/engine_test.rb +26 -124
  82. data/vendor/sass/test/sass/functions_test.rb +0 -13
  83. data/vendor/sass/test/sass/importer_test.rb +0 -110
  84. data/vendor/sass/test/sass/plugin_test.rb +13 -16
  85. data/vendor/sass/test/sass/script_conversion_test.rb +0 -2
  86. data/vendor/sass/test/sass/script_test.rb +0 -18
  87. data/vendor/sass/test/sass/scss/css_test.rb +1 -7
  88. data/vendor/sass/test/sass/scss/scss_test.rb +13 -37
  89. data/vendor/sass/test/sass/test_helper.rb +1 -1
  90. data/vendor/sass/test/sass/util_test.rb +0 -12
  91. data/vendor/sass/vendor/fssm/LICENSE +1 -1
  92. data/vendor/sass/vendor/fssm/README.markdown +27 -55
  93. data/vendor/sass/vendor/fssm/Rakefile +54 -6
  94. data/vendor/sass/vendor/fssm/VERSION.yml +5 -0
  95. data/vendor/sass/vendor/fssm/example.rb +3 -6
  96. data/vendor/sass/vendor/fssm/fssm.gemspec +70 -17
  97. data/vendor/sass/vendor/fssm/lib/fssm.rb +3 -7
  98. data/vendor/sass/vendor/fssm/lib/fssm/backends/fsevents.rb +1 -1
  99. data/vendor/sass/vendor/fssm/lib/fssm/backends/inotify.rb +2 -2
  100. data/vendor/sass/vendor/fssm/lib/fssm/backends/polling.rb +2 -2
  101. data/vendor/sass/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +10 -10
  102. data/vendor/sass/vendor/fssm/lib/fssm/monitor.rb +9 -19
  103. data/vendor/sass/vendor/fssm/lib/fssm/path.rb +21 -24
  104. data/vendor/sass/vendor/fssm/lib/fssm/pathname.rb +479 -13
  105. data/vendor/sass/vendor/fssm/lib/fssm/state/directory.rb +11 -29
  106. data/vendor/sass/vendor/fssm/lib/fssm/state/file.rb +1 -1
  107. data/vendor/sass/vendor/fssm/lib/fssm/support.rb +12 -41
  108. data/vendor/sass/vendor/fssm/lib/fssm/tree.rb +6 -6
  109. data/vendor/sass/vendor/fssm/profile/prof-cache.rb +3 -3
  110. data/vendor/sass/vendor/fssm/profile/prof-pathname.rb +7 -7
  111. data/vendor/sass/vendor/fssm/spec/path_spec.rb +15 -36
  112. data/vendor/sass/vendor/fssm/spec/spec_helper.rb +6 -6
  113. metadata +78 -125
  114. data/lib/haml/helpers/rails_323_textarea_fix.rb +0 -41
  115. data/test/gemfiles/Gemfile.rails-2.0.x +0 -8
  116. data/test/gemfiles/Gemfile.rails-2.0.x.lock +0 -38
  117. data/test/gemfiles/Gemfile.rails-2.1.x +0 -8
  118. data/test/gemfiles/Gemfile.rails-2.1.x.lock +0 -38
  119. data/test/gemfiles/Gemfile.rails-2.2.x +0 -8
  120. data/test/gemfiles/Gemfile.rails-2.2.x.lock +0 -38
  121. data/test/gemfiles/Gemfile.rails-2.3.x +0 -8
  122. data/test/gemfiles/Gemfile.rails-2.3.x.lock +0 -40
  123. data/test/gemfiles/Gemfile.rails-3.0.x +0 -8
  124. data/test/gemfiles/Gemfile.rails-3.0.x.lock +0 -85
  125. data/test/gemfiles/Gemfile.rails-3.1.x +0 -8
  126. data/test/gemfiles/Gemfile.rails-3.1.x.lock +0 -97
  127. data/test/gemfiles/Gemfile.rails-3.2.x +0 -8
  128. data/test/gemfiles/Gemfile.rails-3.2.x.lock +0 -95
  129. data/test/gemfiles/Gemfile.rails-xss-2.3.x +0 -9
  130. data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +0 -42
  131. data/vendor/sass/lib/sass/logger.rb +0 -15
  132. data/vendor/sass/lib/sass/logger/base.rb +0 -32
  133. data/vendor/sass/lib/sass/logger/log_level.rb +0 -49
  134. data/vendor/sass/lib/sass/tree/visitors/deep_copy.rb +0 -87
  135. data/vendor/sass/lib/sass/tree/visitors/set_options.rb +0 -97
  136. data/vendor/sass/test/Gemfile +0 -4
  137. data/vendor/sass/test/Gemfile.lock +0 -19
  138. data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.css +0 -1
  139. data/vendor/sass/test/sass/fixtures/test_staleness_check_across_importers.scss +0 -1
  140. data/vendor/sass/test/sass/logger_test.rb +0 -58
  141. data/vendor/sass/test/sass/templates/bork5.sass +0 -3
  142. data/vendor/sass/test/sass/templates/nested_bork5.sass +0 -2
  143. data/vendor/sass/vendor/fssm/Gemfile +0 -3
  144. data/vendor/sass/vendor/fssm/lib/fssm/backends/rbfsevent.rb +0 -42
  145. data/vendor/sass/vendor/fssm/lib/fssm/version.rb +0 -3
  146. data/vendor/sass/vendor/fssm/profile/prof-pathname-rubinius.rb +0 -35
  147. data/vendor/sass/vendor/fssm/spec/count_down_latch.rb +0 -151
  148. data/vendor/sass/vendor/fssm/spec/monitor_spec.rb +0 -202
@@ -57,11 +57,21 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
57
57
 
58
58
  def visit_comment(node)
59
59
  return if node.invisible?
60
- spaces = (' ' * [@tabs - node.resolved_value[/^ */].size, 0].max)
60
+ spaces = (' ' * [@tabs - node.value[/^ */].size, 0].max)
61
61
 
62
- content = node.resolved_value.gsub(/^/, spaces).gsub(%r{^(\s*)//(.*)$}) do |md|
62
+ content = node.value.gsub(/^/, spaces).gsub(%r{^(\s*)//(.*)$}) do |md|
63
63
  "#{$1}/*#{$2} */"
64
64
  end
65
+ if content =~ /[^\\]\#\{.*\}/
66
+ Sass::Util.sass_warn <<MESSAGE
67
+ WARNING:
68
+ On line #{node.line}#{" of '#{node.filename}'" if node.filename}
69
+ Comments will evaluate the contents of interpolations (\#{ ... }) in Sass 3.2.
70
+ Please escape the interpolation by adding a backslash before the hash sign.
71
+ MESSAGE
72
+ elsif content =~ /\\\#\{.*\}/
73
+ content.gsub!(/\\(\#\{.*\})/, '\1')
74
+ end
65
75
  content.gsub!(/\n +(\* *(?!\/))?/, ' ') if (node.style == :compact || node.style == :compressed) && !node.loud
66
76
  content
67
77
  end
@@ -112,9 +122,9 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
112
122
  def visit_prop(node)
113
123
  tab_str = ' ' * (@tabs + node.tabs)
114
124
  if node.style == :compressed
115
- "#{tab_str}#{node.resolved_name}:#{node.resolved_value}"
125
+ "#{tab_str}#{node.resolved_name}:#{node.resolved_value}#{'!important' if node.important}"
116
126
  else
117
- "#{tab_str}#{node.resolved_name}: #{node.resolved_value};"
127
+ "#{tab_str}#{node.resolved_name}: #{node.resolved_value}#{' !important' if node.important};"
118
128
  end
119
129
  end
120
130
 
@@ -146,10 +156,6 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
146
156
  if node.style != :compressed
147
157
  if node.options[:debug_info]
148
158
  to_return << visit(debug_info_rule(node.debug_info, node.options)) << "\n"
149
- elsif node.options[:trace_selectors]
150
- to_return << "#{old_spaces}/* "
151
- to_return << node.stack_trace.join("\n #{old_spaces}")
152
- to_return << " */\n"
153
159
  elsif node.options[:line_comments]
154
160
  to_return << "#{old_spaces}/* line #{node.line}"
155
161
 
@@ -198,7 +204,7 @@ class Sass::Tree::Visitors::ToCss < Sass::Tree::Visitors::Base
198
204
  [Sass::Selector::Element.new(k.to_s.gsub(/[^\w-]/, "\\\\\\0"), nil)])
199
205
  ])
200
206
  ])
201
- prop = Sass::Tree::PropNode.new([""], Sass::Script::String.new(''), :new)
207
+ prop = Sass::Tree::PropNode.new([""], "", false, :new)
202
208
  prop.resolved_name = "font-family"
203
209
  prop.resolved_value = Sass::SCSS::RX.escape_ident(v.to_s)
204
210
  rule << prop
@@ -6,7 +6,7 @@ module Sass
6
6
  class WarnNode < Node
7
7
  # The expression to print.
8
8
  # @return [Script::Node]
9
- attr_accessor :expr
9
+ attr_reader :expr
10
10
 
11
11
  # @param expr [Script::Node] The expression to print
12
12
  def initialize(expr)
@@ -7,7 +7,7 @@ module Sass::Tree
7
7
  class WhileNode < Node
8
8
  # The parse tree for the continuation expression.
9
9
  # @return [Script::Node]
10
- attr_accessor :expr
10
+ attr_reader :expr
11
11
 
12
12
  # @param expr [Script::Node] See \{#expr}
13
13
  def initialize(expr)
@@ -293,17 +293,19 @@ module Sass
293
293
  #
294
294
  # @yield A block in which no Sass warnings will be printed
295
295
  def silence_sass_warnings
296
- old_level, Sass.logger.log_level = Sass.logger.log_level, :error
296
+ old_silence_warnings = @@silence_warnings
297
+ @@silence_warnings = true
297
298
  yield
298
299
  ensure
299
- Sass.logger.log_level = old_level
300
+ @@silence_warnings = old_silence_warnings
300
301
  end
301
302
 
302
303
  # The same as `Kernel#warn`, but is silenced by \{#silence\_sass\_warnings}.
303
304
  #
304
305
  # @param msg [String]
305
306
  def sass_warn(msg)
306
- Sass.logger.warn(msg)
307
+ return if @@silence_warnings
308
+ warn(msg)
307
309
  end
308
310
 
309
311
  ## Cross Rails Version Compatibility
@@ -467,8 +469,7 @@ MSG
467
469
  # We allow any printable ASCII characters but double quotes in the charset decl
468
470
  bin = str.dup.force_encoding("BINARY")
469
471
  encoding = Sass::Util::ENCODINGS_TO_CHECK.find do |enc|
470
- re = Sass::Util::CHARSET_REGEXPS[enc]
471
- re && bin =~ re
472
+ bin =~ Sass::Util::CHARSET_REGEXPS[enc]
472
473
  end
473
474
  charset, bom = $1, $2
474
475
  if charset
@@ -509,8 +510,6 @@ MSG
509
510
  Regexp.new(/\A(?:#{_enc("\uFEFF", e)})?#{
510
511
  _enc('@charset "', e)}(.*?)#{_enc('"', e)}|\A(#{
511
512
  _enc("\uFEFF", e)})/)
512
- rescue Encoding::ConverterNotFound => _
513
- nil # JRuby on Java 5 doesn't support UTF-32
514
513
  rescue
515
514
  # /\A@charset "(.*?)"/
516
515
  Regexp.new(/\A#{_enc('@charset "', e)}(.*?)#{_enc('"', e)}/)
@@ -615,57 +614,6 @@ MSG
615
614
  '"' + obj.gsub(/[\x00-\x7F]+/) {|s| s.inspect[1...-1]} + '"'
616
615
  end
617
616
 
618
- # Extracts the non-string vlaues from an array containing both strings and non-strings.
619
- # These values are replaced with escape sequences.
620
- # This can be undone using \{#inject\_values}.
621
- #
622
- # This is useful e.g. when we want to do string manipulation
623
- # on an interpolated string.
624
- #
625
- # The precise format of the resulting string is not guaranteed.
626
- # However, it is guaranteed that newlines and whitespace won't be affected.
627
- #
628
- # @param arr [Array] The array from which values are extracted.
629
- # @return [(String, Array)] The resulting string, and an array of extracted values.
630
- def extract_values(arr)
631
- values = []
632
- return arr.map do |e|
633
- next e.gsub('{', '{{') if e.is_a?(String)
634
- values << e
635
- next "{#{values.count - 1}}"
636
- end.join, values
637
- end
638
-
639
- # Undoes \{#extract\_values} by transforming a string with escape sequences
640
- # into an array of strings and non-string values.
641
- #
642
- # @param str [String] The string with escape sequences.
643
- # @param values [Array] The array of values to inject.
644
- # @return [Array] The array of strings and values.
645
- def inject_values(str, values)
646
- return [str.gsub('{{', '{')] if values.empty?
647
- # Add an extra { so that we process the tail end of the string
648
- result = (str + '{{').scan(/(.*?)(?:(\{\{)|\{(\d+)\})/m).map do |(pre, esc, n)|
649
- [pre, esc ? '{' : '', n ? values[n.to_i] : '']
650
- end.flatten(1)
651
- result[-2] = '' # Get rid of the extra {
652
- merge_adjacent_strings(result).reject {|s| s == ''}
653
- end
654
-
655
- # Allows modifications to be performed on the string form
656
- # of an array containing both strings and non-strings.
657
- #
658
- # @param arr [Array] The array from which values are extracted.
659
- # @yield [str] A block in which string manipulation can be done to the array.
660
- # @yieldparam str [String] The string form of `arr`.
661
- # @yieldreturn [String] The modified string.
662
- # @return [Array] The modified, interpolated array.
663
- def with_extracted_values(arr)
664
- str, vals = extract_values(arr)
665
- str = yield str
666
- inject_values(str, vals)
667
- end
668
-
669
617
  ## Static Method Stuff
670
618
 
671
619
  # The context in which the ERB for \{#def\_static\_method} will be run.
@@ -18,12 +18,11 @@ SASS_GEMSPEC = Gem::Specification.new do |spec|
18
18
  command line tool or a web-framework plugin.
19
19
  END
20
20
 
21
- spec.required_ruby_version = '>= 1.8.7'
22
21
  spec.add_development_dependency 'yard', '>= 0.5.3'
23
22
  spec.add_development_dependency 'maruku', '>= 0.5.9'
24
23
 
25
24
  readmes = Dir['*'].reject{ |x| x =~ /(^|[^.a-z])[a-z]+/ || x == "TODO" }
26
- spec.executables = ['sass', 'sass-convert', 'scss']
25
+ spec.executables = ['sass', 'sass-convert']
27
26
  spec.files = Dir['rails/init.rb', 'lib/**/*', 'vendor/**/*',
28
27
  'bin/*', 'test/**/*', 'extra/**/*', 'Rakefile', 'init.rb',
29
28
  '.yardopts'] + readmes
@@ -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
@@ -1131,13 +1131,17 @@ div
1131
1131
  SASS
1132
1132
  end
1133
1133
 
1134
- def test_loud_comment_conversion
1134
+ def test_loud_comment_conversion
1135
1135
  assert_renders(<<SASS, <<SCSS)
1136
1136
  /*! \#{"interpolated"}
1137
+ /*!
1138
+ * \#{"also interpolated"}
1137
1139
  SASS
1138
1140
  /*! \#{"interpolated"} */
1141
+ /*!
1142
+ * \#{"also interpolated"} */
1139
1143
  SCSS
1140
- silence_warnings {assert_renders(<<SASS, <<SCSS)}
1144
+ assert_renders(<<SASS, <<SCSS)
1141
1145
  //! \#{"interpolated"}
1142
1146
  //!
1143
1147
  //! \#{"also interpolated"}
@@ -268,15 +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
271
  # Error reporting
281
272
 
282
273
  def test_error_reporting
@@ -57,12 +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
69
  "@mixin foo\n @import foo" => "Import directives may not be used within control directives or mixins.",
65
- "@import foo;" => "Invalid @import: expected end of line, was \";\".",
66
70
  '$foo: "bar" "baz" !' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "!"},
67
71
  '$foo: "bar" "baz" $' => %Q{Invalid CSS after ""bar" "baz" ": expected expression (e.g. 1px, bold), was "$"},
68
72
  "=foo\n :color red\n.bar\n +bang" => "Undefined mixin 'bang'.",
@@ -259,7 +263,7 @@ SASS
259
263
  end
260
264
 
261
265
  def test_imported_exception
262
- [1, 2, 3, 4, 5].each do |i|
266
+ [1, 2, 3, 4].each do |i|
263
267
  begin
264
268
  Sass::Engine.new("@import bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
265
269
  rescue Sass::SyntaxError => err
@@ -281,7 +285,7 @@ SASS
281
285
  end
282
286
 
283
287
  def test_double_imported_exception
284
- [1, 2, 3, 4, 5].each do |i|
288
+ [1, 2, 3, 4].each do |i|
285
289
  begin
286
290
  Sass::Engine.new("@import nested_bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render
287
291
  rescue Sass::SyntaxError => err
@@ -306,23 +310,6 @@ SASS
306
310
  end
307
311
  end
308
312
 
309
- def test_selector_tracing
310
- actual_css = render(<<-SCSS, :syntax => :scss, :trace_selectors => true)
311
- @mixin mixed {
312
- .mixed { color: red; }
313
- }
314
- .context {
315
- @include mixed;
316
- }
317
- SCSS
318
- assert_equal(<<CSS,actual_css)
319
- /* on line 2 of test_selector_tracing_inline.scss, in `mixed'
320
- from line 5 of test_selector_tracing_inline.scss */
321
- .context .mixed {
322
- color: red; }
323
- CSS
324
- end
325
-
326
313
  def test_mixin_exception
327
314
  render(<<SASS)
328
315
  =error-mixin($a)
@@ -592,21 +579,12 @@ CSS
592
579
  assert File.exists?(sassc_file)
593
580
  end
594
581
 
595
- def test_nonexistent_import
596
- assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
597
- File to import not found or unreadable: nonexistent.sass.
598
- Load path: #{Dir.pwd}
599
- ERR
600
- render("@import nonexistent.sass")
601
- end
602
- end
603
-
604
582
  def test_nonexistent_extensionless_import
605
583
  assert_raise_message(Sass::SyntaxError, <<ERR.rstrip) do
606
584
  File to import not found or unreadable: nonexistent.
607
- Load path: #{Dir.pwd}
585
+ Load path: .
608
586
  ERR
609
- render("@import nonexistent")
587
+ assert_equal("@import url(nonexistent.css);\n", render("@import nonexistent"))
610
588
  end
611
589
  end
612
590
 
@@ -1203,18 +1181,6 @@ bar
1203
1181
  SASS
1204
1182
  end
1205
1183
 
1206
- def test_control_directive_in_nested_property
1207
- assert_equal(<<CSS, render(<<SASS))
1208
- foo {
1209
- a-b: c; }
1210
- CSS
1211
- foo
1212
- a:
1213
- @if true
1214
- b: c
1215
- SASS
1216
- end
1217
-
1218
1184
  def test_interpolation
1219
1185
  assert_equal("a-1 {\n b-2-3: c-3; }\n", render(<<SASS))
1220
1186
  $a: 1
@@ -1582,11 +1548,11 @@ foo
1582
1548
  */
1583
1549
  SASS
1584
1550
  end
1585
-
1586
1551
  def test_loud_comment_in_silent_comment
1587
- silence_warnings {assert_equal <<CSS, render(<<SASS, :style => :compressed)}
1552
+ assert_equal <<CSS, render(<<SASS, :style => :compressed)
1588
1553
  foo{color:blue;/* foo */
1589
1554
  /* bar */
1555
+ /* */
1590
1556
  /* bip */
1591
1557
  /* baz */}
1592
1558
  CSS
@@ -1602,7 +1568,8 @@ SASS
1602
1568
 
1603
1569
  def test_loud_comment_is_evaluated
1604
1570
  assert_equal <<CSS, render(<<SASS)
1605
- /* Hue: 327.216deg */
1571
+ /*
1572
+ * Hue: 327.216deg */
1606
1573
  CSS
1607
1574
  /*!
1608
1575
  Hue: \#{hue(#f836a0)}
@@ -1805,22 +1772,22 @@ SASS
1805
1772
 
1806
1773
  def test_interpolation_doesnt_deep_unquote_strings
1807
1774
  assert_equal(<<CSS, render(<<SASS))
1808
- .foo {
1809
- a: "bar" "baz"; }
1775
+ .foo- "bar" "baz" {
1776
+ a: b; }
1810
1777
  CSS
1811
- .foo
1812
- a: \#{"bar" "baz"}
1778
+ .foo-\#{"bar" "baz"}
1779
+ a: b
1813
1780
  SASS
1814
1781
  end
1815
1782
 
1816
1783
  def test_warn_directive
1817
1784
  expected_warning = <<EXPECTATION
1818
1785
  WARNING: this is a warning
1819
- on line 4 of test_warn_directive_inline.sass
1786
+ on line 4 of test_warn_directive_inline.sass
1820
1787
 
1821
1788
  WARNING: this is a mixin warning
1822
- on line 2 of test_warn_directive_inline.sass, in `foo'
1823
- 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
1824
1791
  EXPECTATION
1825
1792
  assert_warning expected_warning do
1826
1793
  assert_equal <<CSS, render(<<SASS)
@@ -1850,15 +1817,15 @@ SASS
1850
1817
  def test_warn_with_imports
1851
1818
  expected_warning = <<WARN
1852
1819
  WARNING: In the main file
1853
- on line 1 of #{File.dirname(__FILE__)}/templates/warn.sass
1820
+ on line 1 of #{File.dirname(__FILE__)}/templates/warn.sass
1854
1821
 
1855
1822
  WARNING: Imported
1856
- on line 1 of #{File.dirname(__FILE__)}/templates/warn_imported.sass
1857
- 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
1858
1825
 
1859
1826
  WARNING: In an imported mixin
1860
- on line 4 of #{File.dirname(__FILE__)}/templates/warn_imported.sass, in `emits-a-warning'
1861
- 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
1862
1829
  WARN
1863
1830
  assert_warning expected_warning do
1864
1831
  renders_correctly "warn", :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"]
@@ -2041,31 +2008,6 @@ CSS
2041
2008
 
2042
2009
  # Regression tests
2043
2010
 
2044
- def test_interpolated_comment_in_mixin
2045
- assert_equal <<CSS, render(<<SASS)
2046
- /* color: red */
2047
- .foo {
2048
- color: red; }
2049
-
2050
- /* color: blue */
2051
- .foo {
2052
- color: blue; }
2053
-
2054
- /* color: green */
2055
- .foo {
2056
- color: green; }
2057
- CSS
2058
- =foo($var)
2059
- /*! color: \#{$var}
2060
- .foo
2061
- color: $var
2062
-
2063
- +foo(red)
2064
- +foo(blue)
2065
- +foo(green)
2066
- SASS
2067
- end
2068
-
2069
2011
  def test_parens_in_mixins
2070
2012
  assert_equal(<<CSS, render(<<SASS))
2071
2013
  .foo {
@@ -2206,16 +2148,6 @@ CSS
2206
2148
  SASS
2207
2149
  end
2208
2150
 
2209
- def test_silent_comment_in_prop_val_after_important
2210
- assert_equal(<<CSS, render(<<SASS))
2211
- .advanced {
2212
- display: none !important; }
2213
- CSS
2214
- .advanced
2215
- display: none !important // yeah, yeah. it's not really a style anyway.
2216
- SASS
2217
- end
2218
-
2219
2151
  def test_mixin_with_keyword_args
2220
2152
  assert_equal <<CSS, render(<<SASS)
2221
2153
  .mixed {
@@ -2344,16 +2276,7 @@ SASS
2344
2276
  WARNING:
2345
2277
  On line 1 of 'test_comment_interpolation_warning_inline.sass'
2346
2278
  Comments will evaluate the contents of interpolations (\#{ ... }) in Sass 3.2.
2347
- Please escape the interpolation by adding a backslash before the `#`.
2348
- END
2349
- end
2350
-
2351
- def test_loud_silent_comment_warning
2352
- assert_warning(<<END) {render("//! \#{foo}")}
2353
- WARNING:
2354
- On line 1 of 'test_loud_silent_comment_warning_inline.sass'
2355
- `//` comments will no longer be allowed to use the `!` flag in Sass 3.2.
2356
- Please change to `/*` comments.
2279
+ Please escape the interpolation by adding a backslash before the hash sign.
2357
2280
  END
2358
2281
  end
2359
2282
 
@@ -2497,27 +2420,6 @@ SASS
2497
2420
  assert_equal original_filename, importer.engine("imported").options[:original_filename]
2498
2421
  end
2499
2422
 
2500
- def test_deprecated_PRECISION
2501
- assert_warning(<<END) {assert_equal 1000.0, Sass::Script::Number::PRECISION}
2502
- Sass::Script::Number::PRECISION is deprecated and will be removed in a future release. Use Sass::Script::Number.precision_factor instead.
2503
- END
2504
- end
2505
- def test_changing_precision
2506
- begin
2507
- Sass::Script::Number.precision = 8
2508
- assert_equal <<CSS, render(<<SASS)
2509
- div {
2510
- maximum: 1.00000001;
2511
- too-much: 1.0; }
2512
- CSS
2513
- div
2514
- maximum : 1.00000001
2515
- too-much: 1.000000001
2516
- SASS
2517
- ensure
2518
- Sass::Script::Number.precision = 3
2519
- end
2520
- end
2521
2423
 
2522
2424
  private
2523
2425