sass 3.4.25 → 3.5.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/README.md +1 -1
  4. data/Rakefile +13 -157
  5. data/VERSION +1 -1
  6. data/VERSION_DATE +1 -1
  7. data/VERSION_NAME +1 -1
  8. data/lib/sass.rb +3 -10
  9. data/lib/sass/cache_stores/filesystem.rb +1 -1
  10. data/lib/sass/css.rb +2 -3
  11. data/lib/sass/engine.rb +46 -32
  12. data/lib/sass/environment.rb +27 -6
  13. data/lib/sass/error.rb +5 -5
  14. data/lib/sass/exec/base.rb +3 -12
  15. data/lib/sass/features.rb +1 -0
  16. data/lib/sass/importers/filesystem.rb +2 -2
  17. data/lib/sass/plugin.rb +1 -1
  18. data/lib/sass/plugin/compiler.rb +21 -51
  19. data/lib/sass/plugin/configuration.rb +1 -1
  20. data/lib/sass/plugin/rack.rb +3 -3
  21. data/lib/sass/plugin/staleness_checker.rb +3 -3
  22. data/lib/sass/railtie.rb +1 -1
  23. data/lib/sass/script.rb +3 -3
  24. data/lib/sass/script/functions.rb +238 -47
  25. data/lib/sass/script/lexer.rb +8 -6
  26. data/lib/sass/script/parser.rb +76 -75
  27. data/lib/sass/script/tree/funcall.rb +35 -30
  28. data/lib/sass/script/tree/list_literal.rb +23 -8
  29. data/lib/sass/script/tree/map_literal.rb +2 -2
  30. data/lib/sass/script/tree/node.rb +2 -10
  31. data/lib/sass/script/tree/operation.rb +16 -50
  32. data/lib/sass/script/value.rb +2 -0
  33. data/lib/sass/script/value/arg_list.rb +1 -1
  34. data/lib/sass/script/value/base.rb +20 -3
  35. data/lib/sass/script/value/callable.rb +25 -0
  36. data/lib/sass/script/value/color.rb +10 -10
  37. data/lib/sass/script/value/function.rb +19 -0
  38. data/lib/sass/script/value/helpers.rb +16 -7
  39. data/lib/sass/script/value/list.rb +33 -12
  40. data/lib/sass/script/value/map.rb +2 -2
  41. data/lib/sass/script/value/number.rb +3 -3
  42. data/lib/sass/script/value/string.rb +12 -5
  43. data/lib/sass/scss/parser.rb +101 -45
  44. data/lib/sass/scss/rx.rb +5 -11
  45. data/lib/sass/scss/static_parser.rb +0 -7
  46. data/lib/sass/selector.rb +4 -0
  47. data/lib/sass/selector/abstract_sequence.rb +5 -5
  48. data/lib/sass/selector/comma_sequence.rb +3 -15
  49. data/lib/sass/selector/pseudo.rb +4 -0
  50. data/lib/sass/selector/sequence.rb +30 -3
  51. data/lib/sass/selector/simple.rb +13 -7
  52. data/lib/sass/selector/simple_sequence.rb +1 -1
  53. data/lib/sass/shared.rb +3 -5
  54. data/lib/sass/source/map.rb +4 -4
  55. data/lib/sass/source/position.rb +4 -4
  56. data/lib/sass/stack.rb +21 -1
  57. data/lib/sass/tree/charset_node.rb +1 -1
  58. data/lib/sass/tree/comment_node.rb +1 -1
  59. data/lib/sass/tree/node.rb +3 -3
  60. data/lib/sass/tree/prop_node.rb +46 -54
  61. data/lib/sass/tree/rule_node.rb +7 -15
  62. data/lib/sass/tree/visitors/check_nesting.rb +1 -1
  63. data/lib/sass/tree/visitors/convert.rb +2 -3
  64. data/lib/sass/tree/visitors/cssize.rb +1 -10
  65. data/lib/sass/tree/visitors/deep_copy.rb +2 -2
  66. data/lib/sass/tree/visitors/perform.rb +23 -12
  67. data/lib/sass/tree/visitors/set_options.rb +1 -1
  68. data/lib/sass/tree/visitors/to_css.rb +46 -12
  69. data/lib/sass/util.rb +16 -321
  70. data/lib/sass/util/multibyte_string_scanner.rb +127 -131
  71. data/lib/sass/util/normalized_map.rb +1 -8
  72. data/lib/sass/version.rb +2 -2
  73. data/test/sass-spec.yml +1 -1
  74. data/test/sass/compiler_test.rb +4 -14
  75. data/test/sass/conversion_test.rb +113 -162
  76. data/test/sass/css2sass_test.rb +17 -19
  77. data/test/sass/css_variable_test.rb +176 -70
  78. data/test/sass/encoding_test.rb +2 -32
  79. data/test/sass/engine_test.rb +114 -65
  80. data/test/sass/extend_test.rb +37 -51
  81. data/test/sass/functions_test.rb +57 -15
  82. data/test/sass/importer_test.rb +2 -2
  83. data/test/sass/more_templates/more1.sass +10 -10
  84. data/test/sass/more_templates/more_import.sass +2 -2
  85. data/test/sass/plugin_test.rb +9 -12
  86. data/test/sass/script_conversion_test.rb +9 -0
  87. data/test/sass/script_test.rb +38 -48
  88. data/test/sass/scss/css_test.rb +5 -19
  89. data/test/sass/scss/scss_test.rb +58 -39
  90. data/test/sass/source_map_test.rb +26 -28
  91. data/test/sass/templates/_partial.sass +1 -1
  92. data/test/sass/templates/basic.sass +10 -10
  93. data/test/sass/templates/bork1.sass +1 -1
  94. data/test/sass/templates/bork5.sass +1 -1
  95. data/test/sass/templates/compact.sass +10 -10
  96. data/test/sass/templates/complex.sass +187 -187
  97. data/test/sass/templates/compressed.sass +10 -10
  98. data/test/sass/templates/expanded.sass +10 -10
  99. data/test/sass/templates/import.sass +2 -2
  100. data/test/sass/templates/importee.sass +3 -3
  101. data/test/sass/templates/mixins.sass +22 -22
  102. data/test/sass/templates/multiline.sass +4 -4
  103. data/test/sass/templates/nested.sass +13 -13
  104. data/test/sass/templates/parent_ref.sass +12 -12
  105. data/test/sass/templates/script.sass +70 -70
  106. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  107. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  108. data/test/sass/templates/subdir/subdir.sass +3 -3
  109. data/test/sass/templates/units.sass +10 -10
  110. data/test/sass/util/multibyte_string_scanner_test.rb +139 -149
  111. data/test/sass/util_test.rb +0 -36
  112. data/test/test_helper.rb +39 -0
  113. metadata +30 -57
  114. data/extra/sass-spec-ref.sh +0 -32
  115. data/lib/sass/deprecation.rb +0 -55
  116. data/lib/sass/script/css_variable_warning.rb +0 -52
  117. data/lib/sass/util/cross_platform_random.rb +0 -19
  118. data/lib/sass/util/ordered_hash.rb +0 -192
  119. data/test/sass/results/import_charset_1_8.css +0 -5
  120. data/test/sass/templates/import_charset_1_8.sass +0 -6
  121. data/vendor/listen/CHANGELOG.md +0 -1
  122. data/vendor/listen/CONTRIBUTING.md +0 -38
  123. data/vendor/listen/Gemfile +0 -20
  124. data/vendor/listen/Guardfile +0 -8
  125. data/vendor/listen/LICENSE +0 -20
  126. data/vendor/listen/README.md +0 -349
  127. data/vendor/listen/Rakefile +0 -5
  128. data/vendor/listen/Vagrantfile +0 -96
  129. data/vendor/listen/lib/listen.rb +0 -54
  130. data/vendor/listen/lib/listen/adapter.rb +0 -327
  131. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  132. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  133. data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  134. data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  135. data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  136. data/vendor/listen/lib/listen/directory_record.rb +0 -406
  137. data/vendor/listen/lib/listen/listener.rb +0 -323
  138. data/vendor/listen/lib/listen/turnstile.rb +0 -32
  139. data/vendor/listen/lib/listen/version.rb +0 -3
  140. data/vendor/listen/listen.gemspec +0 -28
  141. data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  142. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  143. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  144. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  145. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  146. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  147. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  148. data/vendor/listen/spec/listen/listener_spec.rb +0 -258
  149. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  150. data/vendor/listen/spec/listen_spec.rb +0 -67
  151. data/vendor/listen/spec/spec_helper.rb +0 -25
  152. data/vendor/listen/spec/support/adapter_helper.rb +0 -666
  153. data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  154. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  155. data/vendor/listen/spec/support/listeners_helper.rb +0 -179
  156. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -1,155 +1,151 @@
1
1
  require 'strscan'
2
2
 
3
- if Sass::Util.ruby1_8?
4
- Sass::Util::MultibyteStringScanner = StringScanner
5
- else
6
- if Sass::Util.rbx?
7
- # Rubinius's StringScanner class implements some of its methods in terms of
8
- # others, which causes us to double-count bytes in some cases if we do
9
- # straightforward inheritance. To work around this, we use a delegate class.
10
- require 'delegate'
11
- class Sass::Util::MultibyteStringScanner < DelegateClass(StringScanner)
12
- def initialize(str)
13
- super(StringScanner.new(str))
14
- @mb_pos = 0
15
- @mb_matched_size = nil
16
- @mb_last_pos = nil
17
- end
18
-
19
- def is_a?(klass)
20
- __getobj__.is_a?(klass) || super
21
- end
3
+ if Sass::Util.rbx?
4
+ # Rubinius's StringScanner class implements some of its methods in terms of
5
+ # others, which causes us to double-count bytes in some cases if we do
6
+ # straightforward inheritance. To work around this, we use a delegate class.
7
+ require 'delegate'
8
+ class Sass::Util::MultibyteStringScanner < DelegateClass(StringScanner)
9
+ def initialize(str)
10
+ super(StringScanner.new(str))
11
+ @mb_pos = 0
12
+ @mb_matched_size = nil
13
+ @mb_last_pos = nil
22
14
  end
23
- else
24
- class Sass::Util::MultibyteStringScanner < StringScanner
25
- def initialize(str)
26
- super
27
- @mb_pos = 0
28
- @mb_matched_size = nil
29
- @mb_last_pos = nil
30
- end
15
+
16
+ def is_a?(klass)
17
+ __getobj__.is_a?(klass) || super
31
18
  end
32
19
  end
33
-
34
- # A wrapper of the native StringScanner class that works correctly with
35
- # multibyte character encodings. The native class deals only in bytes, not
36
- # characters, for methods like [#pos] and [#matched_size]. This class deals
37
- # only in characters, instead.
38
- class Sass::Util::MultibyteStringScanner
39
- def self.new(str)
40
- return StringScanner.new(str) if str.ascii_only?
20
+ else
21
+ class Sass::Util::MultibyteStringScanner < StringScanner
22
+ def initialize(str)
41
23
  super
24
+ @mb_pos = 0
25
+ @mb_matched_size = nil
26
+ @mb_last_pos = nil
42
27
  end
28
+ end
29
+ end
43
30
 
44
- alias_method :byte_pos, :pos
45
- alias_method :byte_matched_size, :matched_size
46
-
47
- def check(pattern); _match super; end
48
- def check_until(pattern); _matched super; end
49
- def getch; _forward _match super; end
50
- def match?(pattern); _size check(pattern); end
51
- def matched_size; @mb_matched_size; end
52
- def peek(len); string[@mb_pos, len]; end
53
- alias_method :peep, :peek
54
- def pos; @mb_pos; end
55
- alias_method :pointer, :pos
56
- def rest_size; rest.size; end
57
- def scan(pattern); _forward _match super; end
58
- def scan_until(pattern); _forward _matched super; end
59
- def skip(pattern); _size scan(pattern); end
60
- def skip_until(pattern); _matched _size scan_until(pattern); end
61
-
62
- def get_byte
63
- raise "MultibyteStringScanner doesn't support #get_byte."
64
- end
31
+ # A wrapper of the native StringScanner class that works correctly with
32
+ # multibyte character encodings. The native class deals only in bytes, not
33
+ # characters, for methods like [#pos] and [#matched_size]. This class deals
34
+ # only in characters, instead.
35
+ class Sass::Util::MultibyteStringScanner
36
+ def self.new(str)
37
+ return StringScanner.new(str) if str.ascii_only?
38
+ super
39
+ end
65
40
 
66
- def getbyte
67
- raise "MultibyteStringScanner doesn't support #getbyte."
68
- end
41
+ alias_method :byte_pos, :pos
42
+ alias_method :byte_matched_size, :matched_size
43
+
44
+ def check(pattern); _match super; end
45
+ def check_until(pattern); _matched super; end
46
+ def getch; _forward _match super; end
47
+ def match?(pattern); _size check(pattern); end
48
+ def matched_size; @mb_matched_size; end
49
+ def peek(len); string[@mb_pos, len]; end
50
+ alias_method :peep, :peek
51
+ def pos; @mb_pos; end
52
+ alias_method :pointer, :pos
53
+ def rest_size; rest.size; end
54
+ def scan(pattern); _forward _match super; end
55
+ def scan_until(pattern); _forward _matched super; end
56
+ def skip(pattern); _size scan(pattern); end
57
+ def skip_until(pattern); _matched _size scan_until(pattern); end
58
+
59
+ def get_byte
60
+ raise "MultibyteStringScanner doesn't support #get_byte."
61
+ end
69
62
 
70
- def pos=(n)
71
- @mb_last_pos = nil
63
+ def getbyte
64
+ raise "MultibyteStringScanner doesn't support #getbyte."
65
+ end
72
66
 
73
- # We set position kind of a lot during parsing, so we want it to be as
74
- # efficient as possible. This is complicated by the fact that UTF-8 is a
75
- # variable-length encoding, so it's difficult to find the byte length that
76
- # corresponds to a given character length.
77
- #
78
- # Our heuristic here is to try to count the fewest possible characters. So
79
- # if the new position is close to the current one, just count the
80
- # characters between the two; if the new position is closer to the
81
- # beginning of the string, just count the characters from there.
82
- if @mb_pos - n < @mb_pos / 2
83
- # New position is close to old position
84
- byte_delta = @mb_pos > n ? -string[n...@mb_pos].bytesize : string[@mb_pos...n].bytesize
85
- super(byte_pos + byte_delta)
86
- else
87
- # New position is close to BOS
88
- super(string[0...n].bytesize)
89
- end
90
- @mb_pos = n
91
- end
67
+ def pos=(n)
68
+ @mb_last_pos = nil
69
+
70
+ # We set position kind of a lot during parsing, so we want it to be as
71
+ # efficient as possible. This is complicated by the fact that UTF-8 is a
72
+ # variable-length encoding, so it's difficult to find the byte length that
73
+ # corresponds to a given character length.
74
+ #
75
+ # Our heuristic here is to try to count the fewest possible characters. So
76
+ # if the new position is close to the current one, just count the
77
+ # characters between the two; if the new position is closer to the
78
+ # beginning of the string, just count the characters from there.
79
+ if @mb_pos - n < @mb_pos / 2
80
+ # New position is close to old position
81
+ byte_delta = @mb_pos > n ? -string[n...@mb_pos].bytesize : string[@mb_pos...n].bytesize
82
+ super(byte_pos + byte_delta)
83
+ else
84
+ # New position is close to BOS
85
+ super(string[0...n].bytesize)
86
+ end
87
+ @mb_pos = n
88
+ end
92
89
 
93
- def reset
94
- @mb_pos = 0
95
- @mb_matched_size = nil
96
- @mb_last_pos = nil
97
- super
98
- end
90
+ def reset
91
+ @mb_pos = 0
92
+ @mb_matched_size = nil
93
+ @mb_last_pos = nil
94
+ super
95
+ end
99
96
 
100
- def scan_full(pattern, advance_pointer_p, return_string_p)
101
- res = _match super(pattern, advance_pointer_p, true)
102
- _forward res if advance_pointer_p
103
- return res if return_string_p
104
- end
97
+ def scan_full(pattern, advance_pointer_p, return_string_p)
98
+ res = _match super(pattern, advance_pointer_p, true)
99
+ _forward res if advance_pointer_p
100
+ return res if return_string_p
101
+ end
105
102
 
106
- def search_full(pattern, advance_pointer_p, return_string_p)
107
- res = super(pattern, advance_pointer_p, true)
108
- _forward res if advance_pointer_p
109
- _matched((res if return_string_p))
110
- end
103
+ def search_full(pattern, advance_pointer_p, return_string_p)
104
+ res = super(pattern, advance_pointer_p, true)
105
+ _forward res if advance_pointer_p
106
+ _matched((res if return_string_p))
107
+ end
111
108
 
112
- def string=(str)
113
- @mb_pos = 0
114
- @mb_matched_size = nil
115
- @mb_last_pos = nil
116
- super
117
- end
109
+ def string=(str)
110
+ @mb_pos = 0
111
+ @mb_matched_size = nil
112
+ @mb_last_pos = nil
113
+ super
114
+ end
118
115
 
119
- def terminate
120
- @mb_pos = string.size
121
- @mb_matched_size = nil
122
- @mb_last_pos = nil
123
- super
124
- end
125
- alias_method :clear, :terminate
116
+ def terminate
117
+ @mb_pos = string.size
118
+ @mb_matched_size = nil
119
+ @mb_last_pos = nil
120
+ super
121
+ end
122
+ alias_method :clear, :terminate
126
123
 
127
- def unscan
128
- super
129
- @mb_pos = @mb_last_pos
130
- @mb_last_pos = @mb_matched_size = nil
131
- end
124
+ def unscan
125
+ super
126
+ @mb_pos = @mb_last_pos
127
+ @mb_last_pos = @mb_matched_size = nil
128
+ end
132
129
 
133
- private
130
+ private
134
131
 
135
- def _size(str)
136
- str && str.size
137
- end
132
+ def _size(str)
133
+ str && str.size
134
+ end
138
135
 
139
- def _match(str)
140
- @mb_matched_size = str && str.size
141
- str
142
- end
136
+ def _match(str)
137
+ @mb_matched_size = str && str.size
138
+ str
139
+ end
143
140
 
144
- def _matched(res)
145
- _match matched
146
- res
147
- end
141
+ def _matched(res)
142
+ _match matched
143
+ res
144
+ end
148
145
 
149
- def _forward(str)
150
- @mb_last_pos = @mb_pos
151
- @mb_pos += str.size if str
152
- str
153
- end
146
+ def _forward(str)
147
+ @mb_last_pos = @mb_pos
148
+ @mb_pos += str.size if str
149
+ str
154
150
  end
155
151
  end
@@ -5,12 +5,11 @@ module Sass
5
5
  # A hash that normalizes its string keys while still allowing you to get back
6
6
  # to the original keys that were stored. If several different values normalize
7
7
  # to the same value, whichever is stored last wins.
8
- require 'sass/util/ordered_hash' if ruby1_8?
9
8
  class NormalizedMap
10
9
  # Create a normalized map
11
10
  def initialize(map = nil)
12
11
  @key_strings = {}
13
- @map = Util.ruby1_8? ? OrderedHash.new : {}
12
+ @map = {}
14
13
 
15
14
  map.each {|key, value| self[key] = value} if map
16
15
  end
@@ -115,12 +114,6 @@ module Sass
115
114
  @map.send(method, *args, &block)
116
115
  end
117
116
 
118
- if Sass::Util.ruby1_8?
119
- def respond_to?(method, include_private = false)
120
- super || @map.respond_to?(method, include_private)
121
- end
122
- end
123
-
124
117
  def respond_to_missing?(method, include_private = false)
125
118
  @map.respond_to?(method, include_private)
126
119
  end
@@ -8,7 +8,7 @@ module Sass
8
8
  # if it was installed from Git.
9
9
  module Version
10
10
  # Returns a hash representing the version of Sass.
11
- # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Integers.
11
+ # The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums.
12
12
  # The `:name` key has the name of the version.
13
13
  # The `:string` key contains a human-readable string representation of the version.
14
14
  # The `:number` key is the major, minor, and teeny keys separated by periods.
@@ -41,7 +41,7 @@ module Sass
41
41
  # :prerelease_number => 1
42
42
  # }
43
43
  #
44
- # @return [{Symbol => String/Integer}] The version hash
44
+ # @return [{Symbol => String/Fixnum}] The version hash
45
45
  # @comment
46
46
  # rubocop:disable ClassVars
47
47
  def version
@@ -1,3 +1,3 @@
1
1
  ---
2
2
  :enabled: true
3
- :language_version: '3.4'
3
+ :language_version: '3.5'
@@ -40,12 +40,10 @@ class CompilerTest < MiniTest::Test
40
40
  @run_during_start = run_during_start
41
41
  end
42
42
 
43
- # used for Listen < 2.0
44
43
  def start!
45
44
  @run_during_start.call(self) if @run_during_start
46
45
  end
47
46
 
48
- # used for Listen >= 2.0
49
47
  def start
50
48
  parent = Thread.current
51
49
  @thread = Thread.new do
@@ -86,18 +84,10 @@ class CompilerTest < MiniTest::Test
86
84
 
87
85
  private
88
86
  def create_listener(*args, &on_filesystem_event)
89
- if Sass::Util.listen_geq_2?
90
- args.pop if args.last.is_a?(Hash)
91
- args.map do |dir|
92
- @fake_listener = FakeListener.new(*args, &on_filesystem_event)
93
- @fake_listener.on_start!(&run_during_start)
94
- @fake_listener
95
- end
96
- else
97
- @fake_listener = FakeListener.new(*args, &on_filesystem_event)
98
- @fake_listener.on_start!(&run_during_start)
99
- @fake_listener
100
- end
87
+ args.pop if args.last.is_a?(Hash)
88
+ @fake_listener = FakeListener.new(*args, &on_filesystem_event)
89
+ @fake_listener.on_start!(&run_during_start)
90
+ @fake_listener
101
91
  end
102
92
  end
103
93
 
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
3
3
 
4
4
  class ConversionTest < MiniTest::Test
5
5
  def test_basic
6
- assert_renders <<SASS, <<SCSS
6
+ assert_converts <<SASS, <<SCSS
7
7
  foo bar
8
8
  baz: bang
9
9
  bip: bop
@@ -13,7 +13,7 @@ foo bar {
13
13
  bip: bop;
14
14
  }
15
15
  SCSS
16
- silence_warnings {assert_renders <<SASS, <<SCSS, :old => true}
16
+ assert_converts <<SASS, <<SCSS, options: {old: true}
17
17
  foo bar
18
18
  :baz bang
19
19
  :bip bop
@@ -26,19 +26,19 @@ SCSS
26
26
  end
27
27
 
28
28
  def test_empty_selector
29
- assert_renders "foo bar", "foo bar {}"
29
+ assert_converts "foo bar", "foo bar {}"
30
30
  end
31
31
 
32
32
  def test_empty_directive
33
- assert_renders "@media screen", "@media screen {}"
33
+ assert_converts "@media screen", "@media screen {}"
34
34
  end
35
35
 
36
36
  def test_empty_control_directive
37
- assert_renders "@if false", "@if false {}"
37
+ assert_converts "@if false", "@if false {}"
38
38
  end
39
39
 
40
40
  def test_nesting
41
- assert_renders <<SASS, <<SCSS
41
+ assert_converts <<SASS, <<SCSS
42
42
  foo bar
43
43
  baz bang
44
44
  baz: bang
@@ -58,7 +58,7 @@ SCSS
58
58
  end
59
59
 
60
60
  def test_nesting_with_parent_ref
61
- assert_renders <<SASS, <<SCSS
61
+ assert_converts <<SASS, <<SCSS
62
62
  foo bar
63
63
  &:hover
64
64
  baz: bang
@@ -72,7 +72,7 @@ SCSS
72
72
  end
73
73
 
74
74
  def test_selector_interpolation
75
- assert_renders <<SASS, <<SCSS
75
+ assert_converts <<SASS, <<SCSS
76
76
  foo \#{$bar + "baz"}.bip
77
77
  baz: bang
78
78
 
@@ -90,7 +90,7 @@ SCSS
90
90
  end
91
91
 
92
92
  def test_multiline_selector_with_commas
93
- assert_renders <<SASS, <<SCSS
93
+ assert_converts <<SASS, <<SCSS
94
94
  foo bar,
95
95
  baz bang
96
96
  baz: bang
@@ -101,7 +101,7 @@ baz bang {
101
101
  }
102
102
  SCSS
103
103
 
104
- assert_renders <<SASS, <<SCSS
104
+ assert_converts <<SASS, <<SCSS
105
105
  blat
106
106
  foo bar,
107
107
  baz bang
@@ -136,7 +136,7 @@ SCSS
136
136
  end
137
137
 
138
138
  def test_escaped_selector
139
- assert_renders <<SASS, <<SCSS
139
+ assert_converts <<SASS, <<SCSS
140
140
  foo bar
141
141
  \\:hover
142
142
  baz: bang
@@ -150,7 +150,7 @@ SCSS
150
150
  end
151
151
 
152
152
  def test_property_name_interpolation
153
- assert_renders <<SASS, <<SCSS
153
+ assert_converts <<SASS, <<SCSS
154
154
  foo bar
155
155
  baz\#{$bang}bip\#{$bop}: 12
156
156
  SASS
@@ -161,7 +161,7 @@ SCSS
161
161
  end
162
162
 
163
163
  def test_property_value_interpolation
164
- assert_renders <<SASS, <<SCSS
164
+ assert_converts <<SASS, <<SCSS
165
165
  foo bar
166
166
  baz: 12 \#{$bang} bip \#{"bop"} blat
167
167
  SASS
@@ -172,7 +172,7 @@ SCSS
172
172
  end
173
173
 
174
174
  def test_dynamic_properties
175
- assert_renders <<SASS, <<SCSS
175
+ assert_converts <<SASS, <<SCSS
176
176
  foo bar
177
177
  baz: 12 $bang "bip"
178
178
  SASS
@@ -183,7 +183,7 @@ SCSS
183
183
  end
184
184
 
185
185
  def test_dynamic_properties_with_old
186
- silence_warnings {assert_renders <<SASS, <<SCSS, :old => true}
186
+ assert_converts <<SASS, <<SCSS, options: {old: true}
187
187
  foo bar
188
188
  :baz 12 $bang "bip"
189
189
  SASS
@@ -206,7 +206,7 @@ foo bar {
206
206
  }
207
207
  SCSS
208
208
 
209
- assert_scss_to_scss <<OUT, <<IN
209
+ assert_scss_to_scss <<OUT, source: <<IN
210
210
  foo bar {
211
211
  baz: bip bam boon;
212
212
  }
@@ -233,7 +233,7 @@ foo bar {
233
233
  }
234
234
  SCSS
235
235
 
236
- assert_scss_to_scss <<OUT, <<IN
236
+ assert_scss_to_scss <<OUT, source: <<IN
237
237
  foo bar {
238
238
  baz: $bip "bam" 12px;
239
239
  }
@@ -248,7 +248,7 @@ IN
248
248
  end
249
249
 
250
250
  def test_silent_comments
251
- assert_renders <<SASS, <<SCSS
251
+ assert_converts <<SASS, <<SCSS
252
252
  // foo
253
253
 
254
254
  // bar
@@ -269,7 +269,7 @@ foo bar {
269
269
  }
270
270
  SCSS
271
271
 
272
- assert_renders <<SASS, <<SCSS
272
+ assert_converts <<SASS, <<SCSS
273
273
  // foo
274
274
  // bar
275
275
  // baz
@@ -288,7 +288,7 @@ foo bar {
288
288
  }
289
289
  SCSS
290
290
 
291
- assert_renders <<SASS, <<SCSS
291
+ assert_converts <<SASS, <<SCSS
292
292
  // foo
293
293
  // bar
294
294
  // baz
@@ -309,7 +309,7 @@ SCSS
309
309
  end
310
310
 
311
311
  def test_nested_silent_comments
312
- assert_renders <<SASS, <<SCSS
312
+ assert_converts <<SASS, <<SCSS
313
313
  foo
314
314
  bar: baz
315
315
 
@@ -361,7 +361,7 @@ SASS
361
361
  end
362
362
 
363
363
  def test_preserves_triple_slash_comments
364
- assert_renders <<SASS, <<SCSS
364
+ assert_converts <<SASS, <<SCSS
365
365
  /// foo
366
366
  /// bar
367
367
  foo
@@ -378,7 +378,7 @@ SCSS
378
378
  end
379
379
 
380
380
  def test_loud_comments
381
- assert_renders <<SASS, <<SCSS
381
+ assert_converts <<SASS, <<SCSS
382
382
  /* foo
383
383
 
384
384
  /* bar
@@ -429,7 +429,7 @@ foo bar {
429
429
  }
430
430
  SCSS
431
431
 
432
- assert_renders <<SASS, <<SCSS
432
+ assert_converts <<SASS, <<SCSS
433
433
  /* foo
434
434
  * bar
435
435
  * baz
@@ -450,7 +450,7 @@ SCSS
450
450
  end
451
451
 
452
452
  def test_nested_loud_comments
453
- assert_renders <<SASS, <<SCSS
453
+ assert_converts <<SASS, <<SCSS
454
454
  foo
455
455
  bar: baz
456
456
 
@@ -502,7 +502,7 @@ SASS
502
502
  end
503
503
 
504
504
  def test_preserves_double_star_comments
505
- assert_renders <<SASS, <<SCSS
505
+ assert_converts <<SASS, <<SCSS
506
506
  /** foo
507
507
  * bar
508
508
  foo
@@ -574,7 +574,7 @@ SCSS
574
574
  end
575
575
 
576
576
  def test_immediately_preceding_comments
577
- assert_renders <<SASS, <<SCSS
577
+ assert_converts <<SASS, <<SCSS
578
578
  /* Foo
579
579
  * Bar
580
580
  * Baz
@@ -589,7 +589,7 @@ SASS
589
589
  }
590
590
  SCSS
591
591
 
592
- assert_renders <<SASS, <<SCSS
592
+ assert_converts <<SASS, <<SCSS
593
593
  // Foo
594
594
  // Bar
595
595
  // Baz
@@ -628,7 +628,7 @@ SASS
628
628
  end
629
629
 
630
630
  def test_debug
631
- assert_renders <<SASS, <<SCSS
631
+ assert_converts <<SASS, <<SCSS
632
632
  foo
633
633
  @debug 12px
634
634
 
@@ -643,7 +643,7 @@ SCSS
643
643
  end
644
644
 
645
645
  def test_error
646
- assert_renders <<SASS, <<SCSS
646
+ assert_converts <<SASS, <<SCSS
647
647
  foo
648
648
  @error "oh no!"
649
649
 
@@ -658,7 +658,7 @@ SCSS
658
658
  end
659
659
 
660
660
  def test_directive_without_children
661
- assert_renders <<SASS, <<SCSS
661
+ assert_converts <<SASS, <<SCSS
662
662
  foo
663
663
  @foo #bar "baz"
664
664
 
@@ -673,7 +673,7 @@ SCSS
673
673
  end
674
674
 
675
675
  def test_directive_with_prop_children
676
- assert_renders <<SASS, <<SCSS
676
+ assert_converts <<SASS, <<SCSS
677
677
  foo
678
678
  @foo #bar "baz"
679
679
  a: b
@@ -693,7 +693,7 @@ SCSS
693
693
  end
694
694
 
695
695
  def test_directive_with_rule_children
696
- assert_renders <<SASS, <<SCSS
696
+ assert_converts <<SASS, <<SCSS
697
697
  foo
698
698
  @foo #bar "baz"
699
699
  #blat
@@ -723,7 +723,7 @@ SCSS
723
723
  end
724
724
 
725
725
  def test_directive_with_rule_and_prop_children
726
- assert_renders <<SASS, <<SCSS
726
+ assert_converts <<SASS, <<SCSS
727
727
  foo
728
728
  @foo #bar "baz"
729
729
  g: h
@@ -761,7 +761,7 @@ SCSS
761
761
  end
762
762
 
763
763
  def test_charset
764
- assert_renders <<SASS, <<SCSS
764
+ assert_converts <<SASS, <<SCSS
765
765
  @charset "utf-8"
766
766
  SASS
767
767
  @charset "utf-8";
@@ -769,7 +769,7 @@ SCSS
769
769
  end
770
770
 
771
771
  def test_for
772
- assert_renders <<SASS, <<SCSS
772
+ assert_converts <<SASS, <<SCSS
773
773
  foo
774
774
  @for $a from $b to $c
775
775
  a: b
@@ -792,7 +792,7 @@ SCSS
792
792
  end
793
793
 
794
794
  def test_while
795
- assert_renders <<SASS, <<SCSS
795
+ assert_converts <<SASS, <<SCSS
796
796
  foo
797
797
  @while flaz($a + $b)
798
798
  a: b
@@ -815,7 +815,7 @@ SCSS
815
815
  end
816
816
 
817
817
  def test_if
818
- assert_renders <<SASS, <<SCSS
818
+ assert_converts <<SASS, <<SCSS
819
819
  foo
820
820
  @if $foo or $bar
821
821
  a: b
@@ -846,7 +846,7 @@ SCSS
846
846
  end
847
847
 
848
848
  def test_each
849
- assert_renders <<SASS, <<SCSS
849
+ assert_converts <<SASS, <<SCSS
850
850
  a
851
851
  @each $number in 1px 2px 3px 4px
852
852
  b: $number
@@ -880,7 +880,7 @@ SCSS
880
880
  end
881
881
 
882
882
  def test_import
883
- assert_renders <<SASS, <<SCSS
883
+ assert_converts <<SASS, <<SCSS
884
884
  @import foo
885
885
 
886
886
  @import url(bar.css)
@@ -897,7 +897,7 @@ foo {
897
897
  }
898
898
  SCSS
899
899
 
900
- assert_renders <<SASS, <<SCSS
900
+ assert_converts <<SASS, <<SCSS
901
901
  @import foo.css
902
902
 
903
903
  @import url(bar.css)
@@ -920,13 +920,13 @@ SCSS
920
920
  end
921
921
 
922
922
  def test_import_as_directive_in_scss
923
- assert_renders <<SASS, <<SCSS
923
+ assert_converts <<SASS, <<SCSS
924
924
  @import "foo.css" print
925
925
  SASS
926
926
  @import "foo.css" print;
927
927
  SCSS
928
928
 
929
- assert_renders <<SASS, <<SCSS
929
+ assert_converts <<SASS, <<SCSS
930
930
  @import url(foo.css) screen, print
931
931
  SASS
932
932
  @import url(foo.css) screen, print;
@@ -934,7 +934,7 @@ SCSS
934
934
  end
935
935
 
936
936
  def test_adjacent_imports
937
- assert_renders <<SASS, <<SCSS
937
+ assert_converts <<SASS, <<SCSS
938
938
  @import foo.sass
939
939
  @import bar.scss
940
940
  @import baz
@@ -946,7 +946,7 @@ SCSS
946
946
  end
947
947
 
948
948
  def test_non_adjacent_imports
949
- assert_renders <<SASS, <<SCSS
949
+ assert_converts <<SASS, <<SCSS
950
950
  @import foo.sass
951
951
 
952
952
  @import bar.scss
@@ -962,7 +962,7 @@ SCSS
962
962
  end
963
963
 
964
964
  def test_import_with_interpolation
965
- assert_renders <<SASS, <<SCSS
965
+ assert_converts <<SASS, <<SCSS
966
966
  $family: unquote("Droid+Sans")
967
967
 
968
968
  @import url("http://fonts.googleapis.com/css?family=\#{$family}")
@@ -974,7 +974,7 @@ SCSS
974
974
  end
975
975
 
976
976
  def test_extend
977
- assert_renders <<SASS, <<SCSS
977
+ assert_converts <<SASS, <<SCSS
978
978
  .foo
979
979
  @extend .bar
980
980
 
@@ -989,7 +989,7 @@ SCSS
989
989
  end
990
990
 
991
991
  def test_comma_extendee
992
- assert_renders <<SASS, <<SCSS
992
+ assert_converts <<SASS, <<SCSS
993
993
  .baz
994
994
  @extend .foo, .bar
995
995
  SASS
@@ -1000,7 +1000,7 @@ SCSS
1000
1000
  end
1001
1001
 
1002
1002
  def test_argless_mixin_definition
1003
- assert_renders <<SASS, <<SCSS
1003
+ assert_converts <<SASS, <<SCSS
1004
1004
  =foo-bar
1005
1005
  baz
1006
1006
  a: b
@@ -1038,7 +1038,7 @@ SASS
1038
1038
  end
1039
1039
 
1040
1040
  def test_mixin_definition_without_defaults
1041
- assert_renders <<SASS, <<SCSS
1041
+ assert_converts <<SASS, <<SCSS
1042
1042
  =foo-bar($baz, $bang)
1043
1043
  baz
1044
1044
  a: $baz $bang
@@ -1052,7 +1052,7 @@ SCSS
1052
1052
  end
1053
1053
 
1054
1054
  def test_mixin_definition_with_defaults
1055
- assert_renders <<SASS, <<SCSS
1055
+ assert_converts <<SASS, <<SCSS
1056
1056
  =foo-bar($baz, $bang: 12px)
1057
1057
  baz
1058
1058
  a: $baz $bang
@@ -1078,7 +1078,7 @@ SASS
1078
1078
  end
1079
1079
 
1080
1080
  def test_argless_mixin_include
1081
- assert_renders <<SASS, <<SCSS
1081
+ assert_converts <<SASS, <<SCSS
1082
1082
  foo
1083
1083
  +foo-bar
1084
1084
 
@@ -1093,7 +1093,7 @@ SCSS
1093
1093
  end
1094
1094
 
1095
1095
  def test_mixin_include
1096
- assert_renders <<SASS, <<SCSS
1096
+ assert_converts <<SASS, <<SCSS
1097
1097
  foo
1098
1098
  +foo-bar(12px, "blaz")
1099
1099
 
@@ -1108,7 +1108,7 @@ SCSS
1108
1108
  end
1109
1109
 
1110
1110
  def test_mixin_include_with_keyword_args
1111
- assert_renders <<SASS, <<SCSS
1111
+ assert_converts <<SASS, <<SCSS
1112
1112
  foo
1113
1113
  +foo-bar(12px, "blaz", $blip: blap, $bloop: blop)
1114
1114
 
@@ -1127,7 +1127,7 @@ SCSS
1127
1127
  end
1128
1128
 
1129
1129
  def test_consecutive_mixin_includes
1130
- assert_renders <<SASS, <<SCSS
1130
+ assert_converts <<SASS, <<SCSS
1131
1131
  foo
1132
1132
  +foo-bar
1133
1133
  +foo-bar
@@ -1144,7 +1144,7 @@ SCSS
1144
1144
  end
1145
1145
 
1146
1146
  def test_mixin_include_with_hyphen_conversion_keyword_arg
1147
- assert_renders <<SASS, <<SCSS
1147
+ assert_converts <<SASS, <<SCSS
1148
1148
  foo
1149
1149
  +foo-bar($a-b_c: val)
1150
1150
 
@@ -1159,7 +1159,7 @@ SCSS
1159
1159
  end
1160
1160
 
1161
1161
  def test_argless_function_definition
1162
- assert_renders <<SASS, <<SCSS
1162
+ assert_converts <<SASS, <<SCSS
1163
1163
  @function foo()
1164
1164
  $var: 1 + 1
1165
1165
 
@@ -1174,7 +1174,7 @@ SCSS
1174
1174
  end
1175
1175
 
1176
1176
  def test_function_definition_without_defaults
1177
- assert_renders <<SASS, <<SCSS
1177
+ assert_converts <<SASS, <<SCSS
1178
1178
  @function foo($var1, $var2)
1179
1179
  @if $var1
1180
1180
  @return $var1 + $var2
@@ -1188,7 +1188,7 @@ SCSS
1188
1188
  end
1189
1189
 
1190
1190
  def test_function_definition_with_defaults
1191
- assert_renders <<SASS, <<SCSS
1191
+ assert_converts <<SASS, <<SCSS
1192
1192
  @function foo($var1, $var2: foo)
1193
1193
  @if $var1
1194
1194
  @return $var1 + $var2
@@ -1202,7 +1202,7 @@ SCSS
1202
1202
  end
1203
1203
 
1204
1204
  def test_variable_definition
1205
- assert_renders <<SASS, <<SCSS
1205
+ assert_converts <<SASS, <<SCSS
1206
1206
  $var1: 12px + 15px
1207
1207
 
1208
1208
  foo
@@ -1221,7 +1221,7 @@ SCSS
1221
1221
  end
1222
1222
 
1223
1223
  def test_guarded_variable_definition
1224
- assert_renders <<SASS, <<SCSS
1224
+ assert_converts <<SASS, <<SCSS
1225
1225
  $var1: 12px + 15px !default
1226
1226
 
1227
1227
  foo
@@ -1240,7 +1240,7 @@ SCSS
1240
1240
  end
1241
1241
 
1242
1242
  def test_multiple_variable_definitions
1243
- assert_renders <<SASS, <<SCSS
1243
+ assert_converts <<SASS, <<SCSS
1244
1244
  $var1: foo
1245
1245
  $var2: bar
1246
1246
  $var3: baz
@@ -1258,7 +1258,7 @@ SCSS
1258
1258
  end
1259
1259
 
1260
1260
  def test_division_asserted_with_parens
1261
- assert_renders <<SASS, <<SCSS
1261
+ assert_converts <<SASS, <<SCSS
1262
1262
  foo
1263
1263
  a: (1px / 2px)
1264
1264
  SASS
@@ -1269,7 +1269,7 @@ SCSS
1269
1269
  end
1270
1270
 
1271
1271
  def test_division_not_asserted_when_unnecessary
1272
- assert_renders <<SASS, <<SCSS
1272
+ assert_converts <<SASS, <<SCSS
1273
1273
  $var: 1px / 2px
1274
1274
 
1275
1275
  foo
@@ -1282,7 +1282,7 @@ foo {
1282
1282
  }
1283
1283
  SCSS
1284
1284
 
1285
- assert_renders <<SASS, <<SCSS
1285
+ assert_converts <<SASS, <<SCSS
1286
1286
  $var: 1px
1287
1287
 
1288
1288
  foo
@@ -1295,7 +1295,7 @@ foo {
1295
1295
  }
1296
1296
  SCSS
1297
1297
 
1298
- assert_renders <<SASS, <<SCSS
1298
+ assert_converts <<SASS, <<SCSS
1299
1299
  foo
1300
1300
  a: 1 + 1px / 2px
1301
1301
  SASS
@@ -1306,7 +1306,7 @@ SCSS
1306
1306
  end
1307
1307
 
1308
1308
  def test_literal_slash
1309
- assert_renders <<SASS, <<SCSS
1309
+ assert_converts <<SASS, <<SCSS
1310
1310
  foo
1311
1311
  a: 1px / 2px
1312
1312
  SASS
@@ -1316,7 +1316,7 @@ foo {
1316
1316
  SCSS
1317
1317
 
1318
1318
  # Regression test for issue 1787
1319
- assert_renders <<SASS, <<SCSS
1319
+ assert_converts <<SASS, <<SCSS
1320
1320
  foo
1321
1321
  a: 1px / 2px 3px
1322
1322
  SASS
@@ -1327,7 +1327,7 @@ SCSS
1327
1327
  end
1328
1328
 
1329
1329
  def test_directive_with_interpolation
1330
- assert_renders <<SASS, <<SCSS
1330
+ assert_converts <<SASS, <<SCSS
1331
1331
  $baz: 12
1332
1332
 
1333
1333
  @foo bar\#{$baz} qux
@@ -1342,7 +1342,7 @@ SCSS
1342
1342
  end
1343
1343
 
1344
1344
  def test_media_with_interpolation
1345
- assert_renders <<SASS, <<SCSS
1345
+ assert_converts <<SASS, <<SCSS
1346
1346
  $baz: 12
1347
1347
 
1348
1348
  @media bar\#{$baz}
@@ -1357,7 +1357,7 @@ SCSS
1357
1357
  end
1358
1358
 
1359
1359
  def test_media_with_expressions
1360
- assert_renders <<SASS, <<SCSS
1360
+ assert_converts <<SASS, <<SCSS
1361
1361
  $media1: screen
1362
1362
  $media2: print
1363
1363
  $var: -webkit-min-device-pixel-ratio
@@ -1378,7 +1378,7 @@ SCSS
1378
1378
  end
1379
1379
 
1380
1380
  def test_media_with_feature
1381
- assert_renders <<SASS, <<SCSS
1381
+ assert_converts <<SASS, <<SCSS
1382
1382
  @media screen and (-webkit-transform-3d)
1383
1383
  a: b
1384
1384
  SASS
@@ -1389,7 +1389,7 @@ SCSS
1389
1389
  end
1390
1390
 
1391
1391
  def test_supports_with_expressions
1392
- assert_renders <<SASS, <<SCSS
1392
+ assert_converts <<SASS, <<SCSS
1393
1393
  $query: "(feature1: val)"
1394
1394
  $feature: feature2
1395
1395
  $val: val
@@ -1413,7 +1413,7 @@ SCSS
1413
1413
  # Hacks
1414
1414
 
1415
1415
  def test_declaration_hacks
1416
- assert_renders <<SASS, <<SCSS
1416
+ assert_converts <<SASS, <<SCSS
1417
1417
  foo
1418
1418
  _name: val
1419
1419
  *name: val
@@ -1436,7 +1436,7 @@ SCSS
1436
1436
  end
1437
1437
 
1438
1438
  def test_old_declaration_hacks
1439
- silence_warnings {assert_renders <<SASS, <<SCSS, :old => true}
1439
+ assert_converts <<SASS, <<SCSS, options: {old: true}
1440
1440
  foo
1441
1441
  :_name val
1442
1442
  :*name val
@@ -1456,7 +1456,7 @@ SCSS
1456
1456
 
1457
1457
  def test_selector_hacks
1458
1458
  assert_selector_renders = lambda do |s|
1459
- assert_renders <<SASS, <<SCSS
1459
+ assert_converts <<SASS, <<SCSS
1460
1460
  #{s}
1461
1461
  a: b
1462
1462
  SASS
@@ -1483,7 +1483,7 @@ SCSS
1483
1483
  end
1484
1484
 
1485
1485
  def test_nested_properties
1486
- assert_renders <<SASS, <<SCSS
1486
+ assert_converts <<SASS, <<SCSS
1487
1487
  div
1488
1488
  before: before
1489
1489
  background:
@@ -1504,7 +1504,7 @@ SCSS
1504
1504
  end
1505
1505
 
1506
1506
  def test_dasherize
1507
- assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
1507
+ assert_sass_to_scss(<<SCSS, <<SASS, options: {dasherize: true})
1508
1508
  @mixin under-scored-mixin($under-scored-arg: $under-scored-default) {
1509
1509
  bar: $under-scored-arg;
1510
1510
  }
@@ -1539,7 +1539,7 @@ SASS
1539
1539
  end
1540
1540
 
1541
1541
  def test_loud_comment_conversion
1542
- assert_renders(<<SASS, <<SCSS)
1542
+ assert_converts(<<SASS, <<SCSS)
1543
1543
  /*! \#{"interpolated"}
1544
1544
  SASS
1545
1545
  /*! \#{"interpolated"} */
@@ -1547,7 +1547,7 @@ SCSS
1547
1547
  end
1548
1548
 
1549
1549
  def test_content_conversion
1550
- assert_renders(<<SASS, <<SCSS)
1550
+ assert_converts(<<SASS, <<SCSS)
1551
1551
  $color: blue
1552
1552
 
1553
1553
  =context($class, $color: red)
@@ -1594,7 +1594,7 @@ SCSS
1594
1594
  end
1595
1595
 
1596
1596
  def test_placeholder_conversion
1597
- assert_renders(<<SASS, <<SCSS)
1597
+ assert_converts(<<SASS, <<SCSS)
1598
1598
  #content a%foo.bar
1599
1599
  color: blue
1600
1600
  SASS
@@ -1605,7 +1605,7 @@ SCSS
1605
1605
  end
1606
1606
 
1607
1607
  def test_reference_selector
1608
- assert_renders(<<SASS, <<SCSS)
1608
+ assert_converts(<<SASS, <<SCSS)
1609
1609
  foo /bar|baz/ bang
1610
1610
  a: b
1611
1611
  SASS
@@ -1616,7 +1616,7 @@ SCSS
1616
1616
  end
1617
1617
 
1618
1618
  def test_subject
1619
- assert_renders(<<SASS, <<SCSS)
1619
+ assert_converts(<<SASS, <<SCSS)
1620
1620
  foo bar! baz
1621
1621
  a: b
1622
1622
  SASS
@@ -1627,7 +1627,7 @@ SCSS
1627
1627
  end
1628
1628
 
1629
1629
  def test_placeholder_interoplation_conversion
1630
- assert_renders(<<SASS, <<SCSS)
1630
+ assert_converts(<<SASS, <<SCSS)
1631
1631
  $foo: foo
1632
1632
 
1633
1633
  %\#{$foo}
@@ -1649,7 +1649,7 @@ SCSS
1649
1649
  end
1650
1650
 
1651
1651
  def test_indent
1652
- assert_renders <<SASS, <<SCSS, :indent => " "
1652
+ assert_converts <<SASS, <<SCSS, options: {indent: " "}
1653
1653
  foo bar
1654
1654
  baz bang
1655
1655
  baz: bang
@@ -1667,7 +1667,7 @@ foo bar {
1667
1667
  }
1668
1668
  SCSS
1669
1669
 
1670
- assert_renders <<SASS, <<SCSS, :indent => "\t"
1670
+ assert_converts <<SASS, <<SCSS, options: {indent: "\t"}
1671
1671
  foo bar
1672
1672
  baz bang
1673
1673
  baz: bang
@@ -1685,7 +1685,7 @@ foo bar {
1685
1685
  }
1686
1686
  SCSS
1687
1687
 
1688
- assert_sass_to_scss <<SCSS, <<SASS, :indent => " "
1688
+ assert_sass_to_scss <<SCSS, <<SASS, options: {indent: " "}
1689
1689
  foo bar {
1690
1690
  baz bang {
1691
1691
  baz: bang;
@@ -1703,7 +1703,7 @@ foo bar
1703
1703
  blat: boo
1704
1704
  SASS
1705
1705
 
1706
- assert_sass_to_scss <<SCSS, <<SASS, :indent => "\t"
1706
+ assert_sass_to_scss <<SCSS, <<SASS, options: {indent: "\t"}
1707
1707
  foo bar {
1708
1708
  baz bang {
1709
1709
  baz: bang;
@@ -1721,7 +1721,7 @@ foo bar
1721
1721
  blat: boo
1722
1722
  SASS
1723
1723
 
1724
- assert_scss_to_sass <<SASS, <<SCSS, :indent => " "
1724
+ assert_scss_to_sass <<SASS, <<SCSS, options: {indent: " "}
1725
1725
  foo bar
1726
1726
  baz bang
1727
1727
  baz: bang
@@ -1739,7 +1739,7 @@ foo bar {
1739
1739
  }
1740
1740
  SCSS
1741
1741
 
1742
- assert_scss_to_sass <<SASS, <<SCSS, :indent => "\t"
1742
+ assert_scss_to_sass <<SASS, <<SCSS, options: {indent: "\t"}
1743
1743
  foo bar
1744
1744
  baz bang
1745
1745
  baz: bang
@@ -1759,7 +1759,7 @@ SCSS
1759
1759
  end
1760
1760
 
1761
1761
  def test_extend_with_optional
1762
- assert_renders <<SASS, <<SCSS
1762
+ assert_converts <<SASS, <<SCSS
1763
1763
  foo
1764
1764
  @extend .bar !optional
1765
1765
  SASS
@@ -1770,7 +1770,7 @@ SCSS
1770
1770
  end
1771
1771
 
1772
1772
  def test_mixin_var_args
1773
- assert_renders <<SASS, <<SCSS
1773
+ assert_converts <<SASS, <<SCSS
1774
1774
  =foo($args...)
1775
1775
  a: b
1776
1776
 
@@ -1799,7 +1799,7 @@ SCSS
1799
1799
  end
1800
1800
 
1801
1801
  def test_mixin_var_kwargs
1802
- assert_renders <<SASS, <<SCSS
1802
+ assert_converts <<SASS, <<SCSS
1803
1803
  =foo($a: b, $c: d)
1804
1804
  a: $a
1805
1805
  c: $c
@@ -1823,7 +1823,7 @@ SCSS
1823
1823
  end
1824
1824
 
1825
1825
  def test_function_var_args
1826
- assert_renders <<SASS, <<SCSS
1826
+ assert_converts <<SASS, <<SCSS
1827
1827
  @function foo($args...)
1828
1828
  @return foo
1829
1829
 
@@ -1850,7 +1850,7 @@ SCSS
1850
1850
  end
1851
1851
 
1852
1852
  def test_function_var_kwargs
1853
- assert_renders <<SASS, <<SCSS
1853
+ assert_converts <<SASS, <<SCSS
1854
1854
  @function foo($a: b, $c: d)
1855
1855
  @return foo
1856
1856
 
@@ -1870,7 +1870,7 @@ SCSS
1870
1870
  end
1871
1871
 
1872
1872
  def test_at_root
1873
- assert_renders <<SASS, <<SCSS
1873
+ assert_converts <<SASS, <<SCSS
1874
1874
  .foo
1875
1875
  @at-root
1876
1876
  .bar
@@ -1894,7 +1894,7 @@ SCSS
1894
1894
  end
1895
1895
 
1896
1896
  def test_at_root_with_selector
1897
- assert_renders <<SASS, <<SCSS
1897
+ assert_converts <<SASS, <<SCSS
1898
1898
  .foo
1899
1899
  @at-root .bar
1900
1900
  a: b
@@ -1908,7 +1908,7 @@ SCSS
1908
1908
  end
1909
1909
 
1910
1910
  def test_at_root_without
1911
- assert_renders <<SASS, <<SCSS
1911
+ assert_converts <<SASS, <<SCSS
1912
1912
  .foo
1913
1913
  @at-root (without: media rule)
1914
1914
  a: b
@@ -1922,7 +1922,7 @@ SCSS
1922
1922
  end
1923
1923
 
1924
1924
  def test_at_root_with
1925
- assert_renders <<SASS, <<SCSS
1925
+ assert_converts <<SASS, <<SCSS
1926
1926
  .foo
1927
1927
  @at-root (with: media rule)
1928
1928
  a: b
@@ -1936,7 +1936,7 @@ SCSS
1936
1936
  end
1937
1937
 
1938
1938
  def test_function_var_kwargs_with_list
1939
- assert_renders <<SASS, <<SCSS
1939
+ assert_converts <<SASS, <<SCSS
1940
1940
  @function foo($a: b, $c: d)
1941
1941
  @return $a, $c
1942
1942
 
@@ -1954,7 +1954,7 @@ SCSS
1954
1954
  end
1955
1955
 
1956
1956
  def test_keyframes
1957
- assert_renders(<<SASS, <<SCSS)
1957
+ assert_converts(<<SASS, <<SCSS)
1958
1958
  @keyframes identifier
1959
1959
  0%
1960
1960
  top: 0
@@ -1995,7 +1995,7 @@ SCSS
1995
1995
  ## Regression Tests
1996
1996
 
1997
1997
  def test_list_in_args
1998
- assert_renders(<<SASS, <<SCSS)
1998
+ assert_converts(<<SASS, <<SCSS)
1999
1999
  +mixin((a, b, c))
2000
2000
 
2001
2001
  +mixin($arg: (a, b, c))
@@ -2011,7 +2011,7 @@ SCSS
2011
2011
  end
2012
2012
 
2013
2013
  def test_media_query_with_expr
2014
- assert_renders <<SASS, <<SCSS
2014
+ assert_converts <<SASS, <<SCSS
2015
2015
  @media foo and (bar: baz)
2016
2016
  a: b
2017
2017
  SASS
@@ -2022,7 +2022,7 @@ SCSS
2022
2022
  end
2023
2023
 
2024
2024
  def test_nested_if_statements
2025
- assert_renders(<<SASS, <<SCSS)
2025
+ assert_converts(<<SASS, <<SCSS)
2026
2026
  @if $foo
2027
2027
  one
2028
2028
  a: b
@@ -2055,7 +2055,7 @@ SCSS
2055
2055
  end
2056
2056
 
2057
2057
  def test_comment_indentation
2058
- assert_renders(<<SASS, <<SCSS, :indent => ' ')
2058
+ assert_converts(<<SASS, <<SCSS, options: {indent: ' '})
2059
2059
  foo
2060
2060
  // bar
2061
2061
  /* baz
@@ -2070,27 +2070,27 @@ SCSS
2070
2070
  end
2071
2071
 
2072
2072
  def test_keyword_arguments
2073
- assert_renders(<<SASS, <<SCSS, :dasherize => true)
2073
+ assert_converts(<<SASS, <<SCSS, options: {dasherize: true})
2074
2074
  $foo: foo($dash-ed: 2px)
2075
2075
  SASS
2076
2076
  $foo: foo($dash-ed: 2px);
2077
2077
  SCSS
2078
- assert_scss_to_sass(<<SASS, <<SCSS, :dasherize => true)
2078
+ assert_scss_to_sass(<<SASS, <<SCSS, options: {dasherize: true})
2079
2079
  $foo: foo($dash-ed: 2px)
2080
2080
  SASS
2081
2081
  $foo: foo($dash_ed: 2px);
2082
2082
  SCSS
2083
- assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
2083
+ assert_sass_to_scss(<<SCSS, <<SASS, options: {dasherize: true})
2084
2084
  $foo: foo($dash-ed: 2px);
2085
2085
  SCSS
2086
2086
  $foo: foo($dash_ed: 2px)
2087
2087
  SASS
2088
- assert_renders(<<SASS, <<SCSS)
2088
+ assert_converts(<<SASS, <<SCSS)
2089
2089
  $foo: foo($under_scored: 1px)
2090
2090
  SASS
2091
2091
  $foo: foo($under_scored: 1px);
2092
2092
  SCSS
2093
- assert_renders(<<SASS, <<SCSS)
2093
+ assert_converts(<<SASS, <<SCSS)
2094
2094
  $foo: foo($dash-ed: 2px, $under_scored: 1px)
2095
2095
  SASS
2096
2096
  $foo: foo($dash-ed: 2px, $under_scored: 1px);
@@ -2098,7 +2098,7 @@ SCSS
2098
2098
  end
2099
2099
 
2100
2100
  def test_ambiguous_negation
2101
- assert_renders(<<SASS, <<SCSS, :indent => ' ')
2101
+ assert_converts(<<SASS, <<SCSS, options: {indent: ' '})
2102
2102
  foo
2103
2103
  ok: -$foo
2104
2104
  comma: 10px, -$foo
@@ -2113,7 +2113,7 @@ SCSS
2113
2113
  end
2114
2114
 
2115
2115
  def test_variable_with_global
2116
- assert_renders(<<SASS, <<SCSS)
2116
+ assert_converts(<<SASS, <<SCSS)
2117
2117
  $var: 1
2118
2118
 
2119
2119
  foo
@@ -2130,59 +2130,10 @@ SCSS
2130
2130
  end
2131
2131
 
2132
2132
  def test_import_with_supports_clause
2133
- assert_renders(<<'SASS', <<'SCSS')
2133
+ assert_converts(<<'SASS', <<'SCSS')
2134
2134
  @import url("fallback-layout.css") supports(not (display: #{$display-type}))
2135
2135
  SASS
2136
2136
  @import url("fallback-layout.css") supports(not (display: #{$display-type}));
2137
2137
  SCSS
2138
2138
  end
2139
-
2140
- private
2141
-
2142
- def assert_sass_to_sass(sass, options = {})
2143
- assert_equal(sass.rstrip, to_sass(sass, options).rstrip,
2144
- "Expected Sass to transform to itself")
2145
- end
2146
-
2147
- def assert_scss_to_sass(sass, scss, options = {})
2148
- assert_equal(sass.rstrip, to_sass(scss, options.merge(:syntax => :scss)).rstrip,
2149
- "Expected SCSS to transform to Sass")
2150
- end
2151
-
2152
- def assert_scss_to_scss(scss, in_scss = nil, options = nil)
2153
- if in_scss.is_a?(Hash)
2154
- options = in_scss
2155
- in_scss = nil
2156
- end
2157
-
2158
- in_scss ||= scss
2159
- options ||= {}
2160
-
2161
- assert_equal(scss.rstrip, to_scss(in_scss, options.merge(:syntax => :scss)).rstrip,
2162
- "Expected SCSS to transform to #{scss == in_scss ? 'itself' : 'SCSS'}")
2163
- end
2164
-
2165
- def assert_sass_to_scss(scss, sass, options = {})
2166
- assert_equal(scss.rstrip, to_scss(sass, options).rstrip,
2167
- "Expected Sass to transform to SCSS")
2168
- end
2169
-
2170
- def assert_renders(sass, scss, options = {})
2171
- assert_sass_to_sass(sass, options)
2172
- assert_scss_to_sass(sass, scss, options)
2173
- assert_scss_to_scss(scss, options)
2174
- assert_sass_to_scss(scss, sass, options)
2175
- end
2176
-
2177
- def to_sass(scss, options = {})
2178
- Sass::Util.silence_sass_warnings do
2179
- Sass::Engine.new(scss, options).to_tree.to_sass(options)
2180
- end
2181
- end
2182
-
2183
- def to_scss(sass, options = {})
2184
- Sass::Util.silence_sass_warnings do
2185
- Sass::Engine.new(sass, options).to_tree.to_scss(options)
2186
- end
2187
- end
2188
2139
  end