haml 3.0.21 → 3.0.22

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 (195) hide show
  1. data/Rakefile +1 -41
  2. data/VERSION +1 -1
  3. data/lib/haml/precompiler.rb +8 -6
  4. data/lib/haml/template/plugin.rb +16 -6
  5. data/lib/sass/less.rb +31 -12
  6. data/lib/sass/script/funcall.rb +2 -1
  7. data/lib/sass/script/operation.rb +10 -5
  8. data/lib/sass/script/parser.rb +9 -0
  9. data/test/haml/engine_test.rb +25 -0
  10. data/test/sass/less_conversion_test.rb +24 -3
  11. data/test/sass/script_conversion_test.rb +60 -0
  12. metadata +243 -426
  13. data/vendor/sass/CONTRIBUTING +0 -3
  14. data/vendor/sass/MIT-LICENSE +0 -20
  15. data/vendor/sass/README.md +0 -201
  16. data/vendor/sass/Rakefile +0 -363
  17. data/vendor/sass/TODO +0 -39
  18. data/vendor/sass/VERSION +0 -1
  19. data/vendor/sass/VERSION_NAME +0 -1
  20. data/vendor/sass/bin/css2sass +0 -13
  21. data/vendor/sass/bin/sass +0 -8
  22. data/vendor/sass/bin/sass-convert +0 -7
  23. data/vendor/sass/doc-src/FAQ.md +0 -35
  24. data/vendor/sass/doc-src/INDENTED_SYNTAX.md +0 -210
  25. data/vendor/sass/doc-src/SASS_CHANGELOG.md +0 -1870
  26. data/vendor/sass/doc-src/SASS_REFERENCE.md +0 -1713
  27. data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +0 -155
  28. data/vendor/sass/ext/extconf.rb +0 -10
  29. data/vendor/sass/extra/update_watch.rb +0 -13
  30. data/vendor/sass/init.rb +0 -18
  31. data/vendor/sass/lib/sass.rb +0 -71
  32. data/vendor/sass/lib/sass/cache_store.rb +0 -208
  33. data/vendor/sass/lib/sass/callbacks.rb +0 -66
  34. data/vendor/sass/lib/sass/css.rb +0 -294
  35. data/vendor/sass/lib/sass/engine.rb +0 -792
  36. data/vendor/sass/lib/sass/environment.rb +0 -143
  37. data/vendor/sass/lib/sass/error.rb +0 -201
  38. data/vendor/sass/lib/sass/exec.rb +0 -619
  39. data/vendor/sass/lib/sass/importers.rb +0 -22
  40. data/vendor/sass/lib/sass/importers/base.rb +0 -138
  41. data/vendor/sass/lib/sass/importers/filesystem.rb +0 -121
  42. data/vendor/sass/lib/sass/less.rb +0 -363
  43. data/vendor/sass/lib/sass/plugin.rb +0 -126
  44. data/vendor/sass/lib/sass/plugin/compiler.rb +0 -346
  45. data/vendor/sass/lib/sass/plugin/configuration.rb +0 -123
  46. data/vendor/sass/lib/sass/plugin/generic.rb +0 -15
  47. data/vendor/sass/lib/sass/plugin/merb.rb +0 -48
  48. data/vendor/sass/lib/sass/plugin/rack.rb +0 -47
  49. data/vendor/sass/lib/sass/plugin/rails.rb +0 -41
  50. data/vendor/sass/lib/sass/plugin/staleness_checker.rb +0 -145
  51. data/vendor/sass/lib/sass/railtie.rb +0 -8
  52. data/vendor/sass/lib/sass/repl.rb +0 -58
  53. data/vendor/sass/lib/sass/root.rb +0 -7
  54. data/vendor/sass/lib/sass/script.rb +0 -63
  55. data/vendor/sass/lib/sass/script/bool.rb +0 -18
  56. data/vendor/sass/lib/sass/script/color.rb +0 -491
  57. data/vendor/sass/lib/sass/script/css_lexer.rb +0 -29
  58. data/vendor/sass/lib/sass/script/css_parser.rb +0 -31
  59. data/vendor/sass/lib/sass/script/funcall.rb +0 -79
  60. data/vendor/sass/lib/sass/script/functions.rb +0 -852
  61. data/vendor/sass/lib/sass/script/interpolation.rb +0 -70
  62. data/vendor/sass/lib/sass/script/lexer.rb +0 -337
  63. data/vendor/sass/lib/sass/script/literal.rb +0 -236
  64. data/vendor/sass/lib/sass/script/node.rb +0 -101
  65. data/vendor/sass/lib/sass/script/number.rb +0 -423
  66. data/vendor/sass/lib/sass/script/operation.rb +0 -92
  67. data/vendor/sass/lib/sass/script/parser.rb +0 -392
  68. data/vendor/sass/lib/sass/script/string.rb +0 -67
  69. data/vendor/sass/lib/sass/script/string_interpolation.rb +0 -93
  70. data/vendor/sass/lib/sass/script/unary_operation.rb +0 -57
  71. data/vendor/sass/lib/sass/script/variable.rb +0 -48
  72. data/vendor/sass/lib/sass/scss.rb +0 -17
  73. data/vendor/sass/lib/sass/scss/css_parser.rb +0 -51
  74. data/vendor/sass/lib/sass/scss/parser.rb +0 -838
  75. data/vendor/sass/lib/sass/scss/rx.rb +0 -126
  76. data/vendor/sass/lib/sass/scss/sass_parser.rb +0 -11
  77. data/vendor/sass/lib/sass/scss/script_lexer.rb +0 -15
  78. data/vendor/sass/lib/sass/scss/script_parser.rb +0 -25
  79. data/vendor/sass/lib/sass/scss/static_parser.rb +0 -40
  80. data/vendor/sass/lib/sass/selector.rb +0 -361
  81. data/vendor/sass/lib/sass/selector/abstract_sequence.rb +0 -62
  82. data/vendor/sass/lib/sass/selector/comma_sequence.rb +0 -82
  83. data/vendor/sass/lib/sass/selector/sequence.rb +0 -236
  84. data/vendor/sass/lib/sass/selector/simple.rb +0 -113
  85. data/vendor/sass/lib/sass/selector/simple_sequence.rb +0 -135
  86. data/vendor/sass/lib/sass/shared.rb +0 -78
  87. data/vendor/sass/lib/sass/tree/comment_node.rb +0 -128
  88. data/vendor/sass/lib/sass/tree/debug_node.rb +0 -36
  89. data/vendor/sass/lib/sass/tree/directive_node.rb +0 -75
  90. data/vendor/sass/lib/sass/tree/extend_node.rb +0 -65
  91. data/vendor/sass/lib/sass/tree/for_node.rb +0 -67
  92. data/vendor/sass/lib/sass/tree/if_node.rb +0 -81
  93. data/vendor/sass/lib/sass/tree/import_node.rb +0 -124
  94. data/vendor/sass/lib/sass/tree/mixin_def_node.rb +0 -60
  95. data/vendor/sass/lib/sass/tree/mixin_node.rb +0 -123
  96. data/vendor/sass/lib/sass/tree/node.rb +0 -490
  97. data/vendor/sass/lib/sass/tree/prop_node.rb +0 -220
  98. data/vendor/sass/lib/sass/tree/root_node.rb +0 -125
  99. data/vendor/sass/lib/sass/tree/rule_node.rb +0 -273
  100. data/vendor/sass/lib/sass/tree/variable_node.rb +0 -39
  101. data/vendor/sass/lib/sass/tree/warn_node.rb +0 -42
  102. data/vendor/sass/lib/sass/tree/while_node.rb +0 -48
  103. data/vendor/sass/lib/sass/util.rb +0 -700
  104. data/vendor/sass/lib/sass/util/subset_map.rb +0 -101
  105. data/vendor/sass/lib/sass/version.rb +0 -109
  106. data/vendor/sass/rails/init.rb +0 -1
  107. data/vendor/sass/sass.gemspec +0 -32
  108. data/vendor/sass/test/sass/cache_test.rb +0 -74
  109. data/vendor/sass/test/sass/callbacks_test.rb +0 -61
  110. data/vendor/sass/test/sass/conversion_test.rb +0 -1210
  111. data/vendor/sass/test/sass/css2sass_test.rb +0 -364
  112. data/vendor/sass/test/sass/data/hsl-rgb.txt +0 -319
  113. data/vendor/sass/test/sass/engine_test.rb +0 -2283
  114. data/vendor/sass/test/sass/extend_test.rb +0 -1348
  115. data/vendor/sass/test/sass/functions_test.rb +0 -565
  116. data/vendor/sass/test/sass/importer_test.rb +0 -104
  117. data/vendor/sass/test/sass/less_conversion_test.rb +0 -632
  118. data/vendor/sass/test/sass/mock_importer.rb +0 -49
  119. data/vendor/sass/test/sass/more_results/more1.css +0 -9
  120. data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +0 -26
  121. data/vendor/sass/test/sass/more_results/more_import.css +0 -29
  122. data/vendor/sass/test/sass/more_templates/_more_partial.sass +0 -2
  123. data/vendor/sass/test/sass/more_templates/more1.sass +0 -23
  124. data/vendor/sass/test/sass/more_templates/more_import.sass +0 -11
  125. data/vendor/sass/test/sass/plugin_test.rb +0 -430
  126. data/vendor/sass/test/sass/results/alt.css +0 -4
  127. data/vendor/sass/test/sass/results/basic.css +0 -9
  128. data/vendor/sass/test/sass/results/compact.css +0 -5
  129. data/vendor/sass/test/sass/results/complex.css +0 -86
  130. data/vendor/sass/test/sass/results/compressed.css +0 -1
  131. data/vendor/sass/test/sass/results/expanded.css +0 -19
  132. data/vendor/sass/test/sass/results/import.css +0 -31
  133. data/vendor/sass/test/sass/results/line_numbers.css +0 -49
  134. data/vendor/sass/test/sass/results/mixins.css +0 -95
  135. data/vendor/sass/test/sass/results/multiline.css +0 -24
  136. data/vendor/sass/test/sass/results/nested.css +0 -22
  137. data/vendor/sass/test/sass/results/options.css +0 -1
  138. data/vendor/sass/test/sass/results/parent_ref.css +0 -13
  139. data/vendor/sass/test/sass/results/script.css +0 -16
  140. data/vendor/sass/test/sass/results/scss_import.css +0 -31
  141. data/vendor/sass/test/sass/results/scss_importee.css +0 -2
  142. data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +0 -1
  143. data/vendor/sass/test/sass/results/subdir/subdir.css +0 -3
  144. data/vendor/sass/test/sass/results/units.css +0 -11
  145. data/vendor/sass/test/sass/results/warn.css +0 -0
  146. data/vendor/sass/test/sass/results/warn_imported.css +0 -0
  147. data/vendor/sass/test/sass/script_conversion_test.rb +0 -254
  148. data/vendor/sass/test/sass/script_test.rb +0 -470
  149. data/vendor/sass/test/sass/scss/css_test.rb +0 -897
  150. data/vendor/sass/test/sass/scss/rx_test.rb +0 -156
  151. data/vendor/sass/test/sass/scss/scss_test.rb +0 -1088
  152. data/vendor/sass/test/sass/scss/test_helper.rb +0 -37
  153. data/vendor/sass/test/sass/templates/_partial.sass +0 -2
  154. data/vendor/sass/test/sass/templates/alt.sass +0 -16
  155. data/vendor/sass/test/sass/templates/basic.sass +0 -23
  156. data/vendor/sass/test/sass/templates/bork1.sass +0 -2
  157. data/vendor/sass/test/sass/templates/bork2.sass +0 -2
  158. data/vendor/sass/test/sass/templates/bork3.sass +0 -2
  159. data/vendor/sass/test/sass/templates/bork4.sass +0 -2
  160. data/vendor/sass/test/sass/templates/compact.sass +0 -17
  161. data/vendor/sass/test/sass/templates/complex.sass +0 -305
  162. data/vendor/sass/test/sass/templates/compressed.sass +0 -15
  163. data/vendor/sass/test/sass/templates/expanded.sass +0 -17
  164. data/vendor/sass/test/sass/templates/import.sass +0 -12
  165. data/vendor/sass/test/sass/templates/importee.less +0 -2
  166. data/vendor/sass/test/sass/templates/importee.sass +0 -19
  167. data/vendor/sass/test/sass/templates/line_numbers.sass +0 -13
  168. data/vendor/sass/test/sass/templates/mixin_bork.sass +0 -5
  169. data/vendor/sass/test/sass/templates/mixins.sass +0 -76
  170. data/vendor/sass/test/sass/templates/multiline.sass +0 -20
  171. data/vendor/sass/test/sass/templates/nested.sass +0 -25
  172. data/vendor/sass/test/sass/templates/nested_bork1.sass +0 -2
  173. data/vendor/sass/test/sass/templates/nested_bork2.sass +0 -2
  174. data/vendor/sass/test/sass/templates/nested_bork3.sass +0 -2
  175. data/vendor/sass/test/sass/templates/nested_bork4.sass +0 -2
  176. data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +0 -6
  177. data/vendor/sass/test/sass/templates/options.sass +0 -2
  178. data/vendor/sass/test/sass/templates/parent_ref.sass +0 -25
  179. data/vendor/sass/test/sass/templates/script.sass +0 -101
  180. data/vendor/sass/test/sass/templates/scss_import.scss +0 -11
  181. data/vendor/sass/test/sass/templates/scss_importee.scss +0 -1
  182. data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +0 -2
  183. data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +0 -3
  184. data/vendor/sass/test/sass/templates/subdir/subdir.sass +0 -6
  185. data/vendor/sass/test/sass/templates/units.sass +0 -11
  186. data/vendor/sass/test/sass/templates/warn.sass +0 -3
  187. data/vendor/sass/test/sass/templates/warn_imported.sass +0 -4
  188. data/vendor/sass/test/sass/test_helper.rb +0 -8
  189. data/vendor/sass/test/sass/util/subset_map_test.rb +0 -91
  190. data/vendor/sass/test/sass/util_test.rb +0 -275
  191. data/vendor/sass/test/test_helper.rb +0 -64
  192. data/vendor/sass/yard/callbacks.rb +0 -29
  193. data/vendor/sass/yard/default/fulldoc/html/css/common.sass +0 -26
  194. data/vendor/sass/yard/default/layout/html/footer.erb +0 -12
  195. data/vendor/sass/yard/inherited_hash.rb +0 -41
@@ -1,275 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require File.dirname(__FILE__) + '/../test_helper'
3
- require 'pathname'
4
-
5
- class UtilTest < Test::Unit::TestCase
6
- include Sass::Util
7
-
8
- class Dumpable
9
- attr_reader :arr
10
- def initialize; @arr = []; end
11
- def _before_dump; @arr << :before; end
12
- def _after_dump; @arr << :after; end
13
- def _around_dump
14
- @arr << :around_before
15
- yield
16
- @arr << :around_after
17
- end
18
- def _after_load; @arr << :loaded; end
19
- end
20
-
21
- def test_scope
22
- assert(File.exist?(scope("Rakefile")))
23
- end
24
-
25
- def test_to_hash
26
- assert_equal({
27
- :foo => 1,
28
- :bar => 2,
29
- :baz => 3
30
- }, to_hash([[:foo, 1], [:bar, 2], [:baz, 3]]))
31
- end
32
-
33
- def test_map_keys
34
- assert_equal({
35
- "foo" => 1,
36
- "bar" => 2,
37
- "baz" => 3
38
- }, map_keys({:foo => 1, :bar => 2, :baz => 3}) {|k| k.to_s})
39
- end
40
-
41
- def test_map_vals
42
- assert_equal({
43
- :foo => "1",
44
- :bar => "2",
45
- :baz => "3"
46
- }, map_vals({:foo => 1, :bar => 2, :baz => 3}) {|k| k.to_s})
47
- end
48
-
49
- def test_map_hash
50
- assert_equal({
51
- "foo" => "1",
52
- "bar" => "2",
53
- "baz" => "3"
54
- }, map_hash({:foo => 1, :bar => 2, :baz => 3}) {|k, v| [k.to_s, v.to_s]})
55
- end
56
-
57
- def test_powerset
58
- return unless Set[Set[]] == Set[Set[]] # There's a bug in Ruby 1.8.6 that breaks nested set equality
59
- assert_equal([[].to_set].to_set,
60
- powerset([]))
61
- assert_equal([[].to_set, [1].to_set].to_set,
62
- powerset([1]))
63
- assert_equal([[].to_set, [1].to_set, [2].to_set, [1, 2].to_set].to_set,
64
- powerset([1, 2]))
65
- assert_equal([[].to_set, [1].to_set, [2].to_set, [3].to_set,
66
- [1, 2].to_set, [2, 3].to_set, [1, 3].to_set, [1, 2, 3].to_set].to_set,
67
- powerset([1, 2, 3]))
68
- end
69
-
70
- def test_restrict
71
- assert_equal(0.5, restrict(0.5, 0..1))
72
- assert_equal(1, restrict(2, 0..1))
73
- assert_equal(1.3, restrict(2, 0..1.3))
74
- assert_equal(0, restrict(-1, 0..1))
75
- end
76
-
77
- def test_merge_adjacent_strings
78
- assert_equal(["foo bar baz", :bang, "biz bop", 12],
79
- merge_adjacent_strings(["foo ", "bar ", "baz", :bang, "biz", " bop", 12]))
80
- str = "foo"
81
- assert_equal(["foo foo foo", :bang, "foo foo", 12],
82
- merge_adjacent_strings([str, " ", str, " ", str, :bang, str, " ", str, 12]))
83
- end
84
-
85
- def test_intersperse
86
- assert_equal(["foo", " ", "bar", " ", "baz"],
87
- intersperse(%w[foo bar baz], " "))
88
- assert_equal([], intersperse([], " "))
89
- end
90
-
91
- def test_substitute
92
- assert_equal(["foo", "bar", "baz", 3, 4],
93
- substitute([1, 2, 3, 4], [1, 2], ["foo", "bar", "baz"]))
94
- assert_equal([1, "foo", "bar", "baz", 4],
95
- substitute([1, 2, 3, 4], [2, 3], ["foo", "bar", "baz"]))
96
- assert_equal([1, 2, "foo", "bar", "baz"],
97
- substitute([1, 2, 3, 4], [3, 4], ["foo", "bar", "baz"]))
98
-
99
- assert_equal([1, "foo", "bar", "baz", 2, 3, 4],
100
- substitute([1, 2, 2, 2, 3, 4], [2, 2], ["foo", "bar", "baz"]))
101
- end
102
-
103
- def test_strip_string_array
104
- assert_equal(["foo ", " bar ", " baz"],
105
- strip_string_array([" foo ", " bar ", " baz "]))
106
- assert_equal([:foo, " bar ", " baz"],
107
- strip_string_array([:foo, " bar ", " baz "]))
108
- assert_equal(["foo ", " bar ", :baz],
109
- strip_string_array([" foo ", " bar ", :baz]))
110
- end
111
-
112
- def test_paths
113
- assert_equal([[1, 3, 5], [2, 3, 5], [1, 4, 5], [2, 4, 5]],
114
- paths([[1, 2], [3, 4], [5]]))
115
- assert_equal([[]], paths([]))
116
- assert_equal([[1, 2, 3]], paths([[1], [2], [3]]))
117
- end
118
-
119
- def test_lcs
120
- assert_equal([1, 2, 3], lcs([1, 2, 3], [1, 2, 3]))
121
- assert_equal([], lcs([], [1, 2, 3]))
122
- assert_equal([], lcs([1, 2, 3], []))
123
- assert_equal([1, 2, 3], lcs([5, 1, 4, 2, 3, 17], [0, 0, 1, 2, 6, 3]))
124
-
125
- assert_equal([1], lcs([1, 2, 3, 4], [4, 3, 2, 1]))
126
- assert_equal([1, 2], lcs([1, 2, 3, 4], [3, 4, 1, 2]))
127
- end
128
-
129
- def test_lcs_with_block
130
- assert_equal(["1", "2", "3"],
131
- lcs([1, 4, 2, 5, 3], [1, 2, 3]) {|a, b| a == b && a.to_s})
132
- assert_equal([-4, 2, 8],
133
- lcs([-5, 3, 2, 8], [-4, 1, 8]) {|a, b| (a - b).abs <= 1 && [a, b].max})
134
- end
135
-
136
- def test_silence_warnings
137
- old_stderr, $stderr = $stderr, StringIO.new
138
- warn "Out"
139
- assert_equal("Out\n", $stderr.string)
140
- silence_warnings {warn "In"}
141
- assert_equal("Out\n", $stderr.string)
142
- ensure
143
- $stderr = old_stderr
144
- end
145
-
146
- def test_sass_warn
147
- assert_warning("Foo!") {sass_warn "Foo!"}
148
- end
149
-
150
- def test_silence_sass_warnings
151
- old_stderr, $stderr = $stderr, StringIO.new
152
- silence_sass_warnings {warn "Out"}
153
- assert_equal("Out\n", $stderr.string)
154
- silence_sass_warnings {sass_warn "In"}
155
- assert_equal("Out\n", $stderr.string)
156
- ensure
157
- $stderr = old_stderr
158
- end
159
-
160
- def test_has
161
- assert(has?(:instance_method, String, :chomp!))
162
- assert(has?(:private_instance_method, Sass::Engine, :parse_interp))
163
- end
164
-
165
- def test_enum_with_index
166
- assert_equal(%w[foo0 bar1 baz2],
167
- enum_with_index(%w[foo bar baz]).map {|s, i| "#{s}#{i}"})
168
- end
169
-
170
- def test_enum_cons
171
- assert_equal(%w[foobar barbaz],
172
- enum_cons(%w[foo bar baz], 2).map {|s1, s2| "#{s1}#{s2}"})
173
- end
174
-
175
- def test_ord
176
- assert_equal(102, ord("f"))
177
- assert_equal(98, ord("bar"))
178
- end
179
-
180
- def test_flatten
181
- assert_equal([1, 2, 3], flatten([1, 2, 3], 0))
182
- assert_equal([1, 2, 3], flatten([1, 2, 3], 1))
183
- assert_equal([1, 2, 3], flatten([1, 2, 3], 2))
184
-
185
- assert_equal([[1, 2], 3], flatten([[1, 2], 3], 0))
186
- assert_equal([1, 2, 3], flatten([[1, 2], 3], 1))
187
- assert_equal([1, 2, 3], flatten([[1, 2], 3], 2))
188
-
189
- assert_equal([[[1], 2], [3], 4], flatten([[[1], 2], [3], 4], 0))
190
- assert_equal([[1], 2, 3, 4], flatten([[[1], 2], [3], 4], 1))
191
- assert_equal([1, 2, 3, 4], flatten([[[1], 2], [3], 4], 2))
192
- end
193
-
194
- def test_set_hash
195
- assert(set_hash(Set[1, 2, 3]) == set_hash(Set[3, 2, 1]))
196
- assert(set_hash(Set[1, 2, 3]) == set_hash(Set[1, 2, 3]))
197
-
198
- s1 = Set[]
199
- s1 << 1
200
- s1 << 2
201
- s1 << 3
202
- s2 = Set[]
203
- s2 << 3
204
- s2 << 2
205
- s2 << 1
206
- assert(set_hash(s1) == set_hash(s2))
207
- end
208
-
209
- def test_set_eql
210
- assert(set_eql?(Set[1, 2, 3], Set[3, 2, 1]))
211
- assert(set_eql?(Set[1, 2, 3], Set[1, 2, 3]))
212
-
213
- s1 = Set[]
214
- s1 << 1
215
- s1 << 2
216
- s1 << 3
217
- s2 = Set[]
218
- s2 << 3
219
- s2 << 2
220
- s2 << 1
221
- assert(set_eql?(s1, s2))
222
- end
223
-
224
- def test_caller_info
225
- assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle'"))
226
- assert_equal(["/tmp/foo.rb", 12, nil], caller_info("/tmp/foo.rb:12"))
227
- assert_equal(["(sass)", 12, "blah"], caller_info("(sass):12: in `blah'"))
228
- assert_equal(["", 12, "boop"], caller_info(":12: in `boop'"))
229
- assert_equal(["/tmp/foo.rb", -12, "fizzle"], caller_info("/tmp/foo.rb:-12: in `fizzle'"))
230
- assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle {}'"))
231
- end
232
-
233
- def test_version_gt
234
- assert_version_gt("2.0.0", "1.0.0")
235
- assert_version_gt("1.1.0", "1.0.0")
236
- assert_version_gt("1.0.1", "1.0.0")
237
- assert_version_gt("1.0.0", "1.0.0.rc")
238
- assert_version_gt("1.0.0.1", "1.0.0.rc")
239
- assert_version_gt("1.0.0.rc", "0.9.9")
240
- assert_version_gt("1.0.0.beta", "1.0.0.alpha")
241
-
242
- assert_version_eq("1.0.0", "1.0.0")
243
- assert_version_eq("1.0.0", "1.0.0.0")
244
- end
245
-
246
- def assert_version_gt(v1, v2)
247
- #assert(version_gt(v1, v2), "Expected #{v1} > #{v2}")
248
- assert(!version_gt(v2, v1), "Expected #{v2} < #{v1}")
249
- end
250
-
251
- def assert_version_eq(v1, v2)
252
- assert(!version_gt(v1, v2), "Expected #{v1} = #{v2}")
253
- assert(!version_gt(v2, v1), "Expected #{v2} = #{v1}")
254
- end
255
-
256
- def test_dump_and_load
257
- obj = Dumpable.new
258
- data = dump(obj)
259
- assert_equal([:before, :around_before, :around_after, :after], obj.arr)
260
- obj2 = load(data)
261
- assert_equal([:before, :around_before, :loaded], obj2.arr)
262
- end
263
-
264
- class FooBar
265
- def foo
266
- Sass::Util.abstract(self)
267
- end
268
- end
269
-
270
- def test_abstract
271
- assert_raise_message(NotImplementedError,
272
- "UtilTest::FooBar must implement #foo") {FooBar.new.foo}
273
- end
274
-
275
- end
@@ -1,64 +0,0 @@
1
- lib_dir = File.dirname(__FILE__) + '/../lib'
2
-
3
- require 'test/unit'
4
- require 'fileutils'
5
- $:.unshift lib_dir unless $:.include?(lib_dir)
6
- require 'sass'
7
-
8
- Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
9
-
10
- module Sass::Script::Functions
11
- module UserFunctions; end
12
- include UserFunctions
13
-
14
- def option(name)
15
- Sass::Script::String.new(@options[name.value.to_sym].to_s)
16
- end
17
- end
18
-
19
- class Test::Unit::TestCase
20
- def munge_filename(opts = {})
21
- return if opts.has_key?(:filename)
22
- opts[:filename] = filename_for_test(opts[:syntax] || :sass)
23
- end
24
-
25
- def filename_for_test(syntax = :sass)
26
- test_name = caller.
27
- map {|c| Sass::Util.caller_info(c)[2]}.
28
- compact.
29
- map {|c| c.sub(/^(block|rescue) in /, '')}.
30
- find {|c| c =~ /^test_/}
31
- "#{test_name}_inline.#{syntax}"
32
- end
33
-
34
- def clean_up_sassc
35
- path = File.dirname(__FILE__) + "/../.sass-cache"
36
- FileUtils.rm_r(path) if File.exist?(path)
37
- end
38
-
39
- def assert_warning(message)
40
- the_real_stderr, $stderr = $stderr, StringIO.new
41
- yield
42
-
43
- if message.is_a?(Regexp)
44
- assert_match message, $stderr.string.strip
45
- else
46
- assert_equal message.strip, $stderr.string.strip
47
- end
48
- ensure
49
- $stderr = the_real_stderr
50
- end
51
-
52
- def silence_warnings(&block)
53
- Sass::Util.silence_warnings(&block)
54
- end
55
-
56
- def assert_raise_message(klass, message)
57
- yield
58
- rescue Exception => e
59
- assert_instance_of(klass, e)
60
- assert_equal(message, e.message)
61
- else
62
- flunk "Expected exception #{klass}, none raised"
63
- end
64
- end
@@ -1,29 +0,0 @@
1
- class CallbacksHandler < YARD::Handlers::Ruby::Legacy::Base
2
- handles /\Adefine_callback(\s|\()/
3
-
4
- def process
5
- callback_name = tokval(statement.tokens[2])
6
- attr_index = statement.comments.each_with_index {|c, i| break i if c[0] == ?@}
7
- if attr_index.is_a?(Fixnum)
8
- docstring = statement.comments[0...attr_index]
9
- attrs = statement.comments[attr_index..-1]
10
- else
11
- docstring = statement.comments
12
- attrs = []
13
- end
14
-
15
- yieldparams = ""
16
- attrs.reject! do |a|
17
- next unless a =~ /^@yield *(\[.*?\])/
18
- yieldparams = $1
19
- true
20
- end
21
-
22
- o = register(MethodObject.new(namespace, "on_#{callback_name}", scope))
23
- o.docstring = docstring + [
24
- "@return [void]",
25
- "@yield #{yieldparams} When the callback is run"
26
- ] + attrs
27
- o.signature = true
28
- end
29
- end
@@ -1,26 +0,0 @@
1
- .maruku_toc
2
- background: #ddd
3
- border: 1px solid #ccc
4
- margin-right: 2em
5
- float: left
6
- ul
7
- padding: 0 1em
8
- #frequently_asked_questions + &
9
- float: none
10
- margin: 0 2em
11
-
12
- #filecontents
13
- *:target, dt:target + dd
14
- background-color: #ccf
15
- border: 1px solid #88b
16
- dt
17
- font-weight: bold
18
- dd
19
- margin:
20
- left: 0
21
- bottom: 0.7em
22
- padding-left: 3em
23
- dt:target
24
- border-bottom-style: none
25
- & + dd
26
- border-top-style: none
@@ -1,12 +0,0 @@
1
- <%= superb :footer %>
2
- <% if ENV["ANALYTICS"] %>
3
- <script type="text/javascript">
4
- var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
5
- document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
6
- </script>
7
- <script type="text/javascript">
8
- try {
9
- var pageTracker = _gat._getTracker("<%= ENV["ANALYTICS"] %>");
10
- pageTracker._trackPageview();
11
- } catch(err) {}</script>
12
- <% end %>
@@ -1,41 +0,0 @@
1
- class InheritedHashHandler < YARD::Handlers::Ruby::Legacy::Base
2
- handles /\Ainherited_hash(\s|\()/
3
-
4
- def process
5
- hash_name = tokval(statement.tokens[2])
6
- name = statement.comments.first.strip
7
- type = statement.comments[1].strip
8
-
9
- o = register(MethodObject.new(namespace, hash_name, scope))
10
- o.docstring = [
11
- "Gets a #{name} from this {Environment} or one of its \\{#parent}s.",
12
- "@param name [String] The name of the #{name}",
13
- "@return [#{type}] The #{name} value",
14
- ]
15
- o.signature = true
16
- o.parameters = ["name"]
17
-
18
- o = register(MethodObject.new(namespace, "set_#{hash_name}", scope))
19
- o.docstring = [
20
- "Sets a #{name} in this {Environment} or one of its \\{#parent}s.",
21
- "If the #{name} is already defined in some environment,",
22
- "that one is set; otherwise, a new one is created in this environment.",
23
- "@param name [String] The name of the #{name}",
24
- "@param value [#{type}] The value of the #{name}",
25
- "@return [#{type}] `value`",
26
- ]
27
- o.signature = true
28
- o.parameters = ["name", "value"]
29
-
30
- o = register(MethodObject.new(namespace, "set_local_#{hash_name}", scope))
31
- o.docstring = [
32
- "Sets a #{name} in this {Environment}.",
33
- "Ignores any parent environments.",
34
- "@param name [String] The name of the #{name}",
35
- "@param value [#{type}] The value of the #{name}",
36
- "@return [#{type}] `value`",
37
- ]
38
- o.signature = true
39
- o.parameters = ["name", "value"]
40
- end
41
- end