sass 3.3.0.rc.1 → 3.3.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass.rb +5 -0
- data/lib/sass/engine.rb +3 -5
- data/lib/sass/plugin.rb +0 -1
- data/lib/sass/plugin/compiler.rb +1 -2
- data/lib/sass/script/functions.rb +16 -2
- data/lib/sass/script/lexer.rb +22 -12
- data/lib/sass/script/parser.rb +27 -14
- data/lib/sass/script/tree/variable.rb +1 -1
- data/lib/sass/script/value/base.rb +1 -1
- data/lib/sass/script/value/color.rb +29 -17
- data/lib/sass/script/value/list.rb +1 -1
- data/lib/sass/script/value/number.rb +8 -1
- data/lib/sass/scss/parser.rb +2 -2
- data/lib/sass/selector/sequence.rb +18 -19
- data/lib/sass/selector/simple_sequence.rb +5 -5
- data/lib/sass/source/map.rb +1 -1
- data/lib/sass/tree/node.rb +25 -0
- data/lib/sass/tree/variable_node.rb +5 -0
- data/lib/sass/tree/visitors/base.rb +4 -7
- data/lib/sass/tree/visitors/check_nesting.rb +2 -2
- data/lib/sass/tree/visitors/perform.rb +12 -7
- data/lib/sass/util.rb +95 -50
- data/lib/sass/util/normalized_map.rb +63 -14
- data/lib/sass/util/ordered_hash.rb +9 -5
- data/lib/sass/version.rb +10 -12
- data/test/sass/engine_test.rb +37 -0
- data/test/sass/functions_test.rb +9 -2
- data/test/sass/importer_test.rb +3 -3
- data/test/sass/script_test.rb +12 -10
- data/test/sass/source_map_test.rb +8 -8
- data/test/sass/util/normalized_map_test.rb +22 -1
- data/test/sass/util_test.rb +18 -0
- data/test/test_helper.rb +16 -0
- data/vendor/listen/CHANGELOG.md +228 -0
- data/vendor/listen/CONTRIBUTING.md +38 -0
- data/vendor/listen/Gemfile +30 -0
- data/vendor/listen/Guardfile +8 -0
- data/vendor/listen/LICENSE +20 -0
- data/vendor/listen/README.md +315 -0
- data/vendor/listen/Rakefile +47 -0
- data/vendor/listen/Vagrantfile +96 -0
- data/vendor/listen/lib/listen.rb +40 -0
- data/vendor/listen/lib/listen/adapter.rb +214 -0
- data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
- data/vendor/listen/lib/listen/adapters/darwin.rb +85 -0
- data/vendor/listen/lib/listen/adapters/linux.rb +113 -0
- data/vendor/listen/lib/listen/adapters/polling.rb +67 -0
- data/vendor/listen/lib/listen/adapters/windows.rb +87 -0
- data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
- data/vendor/listen/lib/listen/directory_record.rb +371 -0
- data/vendor/listen/lib/listen/listener.rb +225 -0
- data/vendor/listen/lib/listen/multi_listener.rb +143 -0
- data/vendor/listen/lib/listen/turnstile.rb +28 -0
- data/vendor/listen/lib/listen/version.rb +3 -0
- data/vendor/listen/listen.gemspec +22 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +183 -0
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +37 -0
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +47 -0
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +30 -0
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
- data/vendor/listen/spec/listen/directory_record_spec.rb +1225 -0
- data/vendor/listen/spec/listen/listener_spec.rb +169 -0
- data/vendor/listen/spec/listen/multi_listener_spec.rb +174 -0
- data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
- data/vendor/listen/spec/listen_spec.rb +73 -0
- data/vendor/listen/spec/spec_helper.rb +21 -0
- data/vendor/listen/spec/support/adapter_helper.rb +629 -0
- data/vendor/listen/spec/support/directory_record_helper.rb +55 -0
- data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
- data/vendor/listen/spec/support/listeners_helper.rb +156 -0
- data/vendor/listen/spec/support/platform_helper.rb +15 -0
- metadata +318 -300
- data/test/Gemfile.lock +0 -10
@@ -7,14 +7,11 @@ module Sass
|
|
7
7
|
# to the original keys that were stored. If several different values normalize
|
8
8
|
# to the same value, whichever is stored last wins.
|
9
9
|
require 'sass/util/ordered_hash' if ruby1_8?
|
10
|
-
class NormalizedMap
|
10
|
+
class NormalizedMap
|
11
11
|
# Create a normalized map
|
12
12
|
def initialize
|
13
13
|
@key_strings = {}
|
14
14
|
@map = Util.ruby1_8? ? OrderedHash.new : {}
|
15
|
-
|
16
|
-
# We delegate all hash methods that are not overridden here to @map.
|
17
|
-
super(@map)
|
18
15
|
end
|
19
16
|
|
20
17
|
# Specifies how to transform the key.
|
@@ -27,25 +24,26 @@ module Sass
|
|
27
24
|
# @private
|
28
25
|
def []=(k, v)
|
29
26
|
normalized = normalize(k)
|
30
|
-
|
27
|
+
@map[normalized] = v
|
31
28
|
@key_strings[normalized] = k
|
29
|
+
v
|
32
30
|
end
|
33
31
|
|
34
32
|
# @private
|
35
33
|
def [](k)
|
36
|
-
|
34
|
+
@map[normalize(k)]
|
37
35
|
end
|
38
36
|
|
39
37
|
# @private
|
40
38
|
def has_key?(k)
|
41
|
-
|
39
|
+
@map.has_key?(normalize(k))
|
42
40
|
end
|
43
41
|
|
44
42
|
# @private
|
45
43
|
def delete(k)
|
46
44
|
normalized = normalize(k)
|
47
45
|
@key_strings.delete(normalized)
|
48
|
-
|
46
|
+
@map.delete(normalized)
|
49
47
|
end
|
50
48
|
|
51
49
|
# @return [Hash] Hash with the keys as they were stored (before normalization).
|
@@ -53,12 +51,63 @@ module Sass
|
|
53
51
|
Sass::Util.map_keys(@map) {|k| @key_strings[k]}
|
54
52
|
end
|
55
53
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
54
|
+
def empty?
|
55
|
+
@map.empty?
|
56
|
+
end
|
57
|
+
|
58
|
+
def values
|
59
|
+
@map.values
|
60
|
+
end
|
61
|
+
|
62
|
+
def keys
|
63
|
+
@map.keys
|
64
|
+
end
|
65
|
+
|
66
|
+
def each
|
67
|
+
@map.each {|k, v| yield(k, v)}
|
68
|
+
end
|
69
|
+
|
70
|
+
def size
|
71
|
+
@map.size
|
72
|
+
end
|
73
|
+
|
74
|
+
def to_hash
|
75
|
+
@map.dup
|
76
|
+
end
|
77
|
+
|
78
|
+
def to_a
|
79
|
+
@map.to_a
|
80
|
+
end
|
81
|
+
|
82
|
+
def map
|
83
|
+
@map.map {|k, v| yield(k, v)}
|
84
|
+
end
|
85
|
+
|
86
|
+
def dup
|
87
|
+
d = super
|
88
|
+
d.send(:instance_variable_set, "@map", @map.dup)
|
89
|
+
d
|
90
|
+
end
|
91
|
+
|
92
|
+
def sort_by
|
93
|
+
@map.sort_by {|k, v| yield k, v}
|
94
|
+
end
|
95
|
+
|
96
|
+
def method_missing(method, *args, &block)
|
97
|
+
if Sass.tests_running
|
98
|
+
raise ArgumentError.new("The method #{method} must be implemented explicitly")
|
99
|
+
end
|
100
|
+
@map.send(method, *args, &block)
|
101
|
+
end
|
102
|
+
|
103
|
+
if Sass::Util.ruby1_8?
|
104
|
+
def respond_to?(method, include_private = false)
|
105
|
+
super || @map.respond_to?(method, include_private)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def respond_to_missing?(method, include_private = false)
|
110
|
+
@map.respond_to?(method, include_private)
|
62
111
|
end
|
63
112
|
end
|
64
113
|
end
|
@@ -31,7 +31,7 @@ class OrderedHash < ::Hash
|
|
31
31
|
# For instance, we cannot use the inherited #merge! because albeit the algorithm
|
32
32
|
# itself would work, our []= is not being called at all by the C code.
|
33
33
|
|
34
|
-
def initialize(*args
|
34
|
+
def initialize(*args)
|
35
35
|
super
|
36
36
|
@keys = []
|
37
37
|
end
|
@@ -91,8 +91,8 @@ class OrderedHash < ::Hash
|
|
91
91
|
self
|
92
92
|
end
|
93
93
|
|
94
|
-
def reject
|
95
|
-
dup.reject!
|
94
|
+
def reject
|
95
|
+
dup.reject! {|h, k| yield h, k}
|
96
96
|
end
|
97
97
|
|
98
98
|
def keys
|
@@ -160,8 +160,12 @@ class OrderedHash < ::Hash
|
|
160
160
|
|
161
161
|
alias_method :update, :merge!
|
162
162
|
|
163
|
-
def merge(other_hash
|
164
|
-
|
163
|
+
def merge(other_hash)
|
164
|
+
if block_given?
|
165
|
+
dup.merge!(other_hash) {|k, v1, v2| yield k, v1, v2}
|
166
|
+
else
|
167
|
+
dup.merge!(other_hash)
|
168
|
+
end
|
165
169
|
end
|
166
170
|
|
167
171
|
# When replacing with another hash, the initial order of our keys must come from the other hash --
|
data/lib/sass/version.rb
CHANGED
@@ -7,8 +7,6 @@ module Sass
|
|
7
7
|
# but its Git revision hash as well,
|
8
8
|
# if it was installed from Git.
|
9
9
|
module Version
|
10
|
-
include Sass::Util
|
11
|
-
|
12
10
|
# Returns a hash representing the version of Sass.
|
13
11
|
# The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums.
|
14
12
|
# The `:name` key has the name of the version.
|
@@ -49,9 +47,9 @@ module Sass
|
|
49
47
|
def version
|
50
48
|
return @@version if defined?(@@version)
|
51
49
|
|
52
|
-
numbers = File.read(scope('VERSION')).strip.split('.').
|
50
|
+
numbers = File.read(Sass::Util.scope('VERSION')).strip.split('.').
|
53
51
|
map {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
|
54
|
-
name = File.read(scope('VERSION_NAME')).strip
|
52
|
+
name = File.read(Sass::Util.scope('VERSION_NAME')).strip
|
55
53
|
@@version = {
|
56
54
|
:major => numbers[0],
|
57
55
|
:minor => numbers[1],
|
@@ -87,18 +85,18 @@ module Sass
|
|
87
85
|
private
|
88
86
|
|
89
87
|
def revision_number
|
90
|
-
if File.exists?(scope('REVISION'))
|
91
|
-
rev = File.read(scope('REVISION')).strip
|
88
|
+
if File.exists?(Sass::Util.scope('REVISION'))
|
89
|
+
rev = File.read(Sass::Util.scope('REVISION')).strip
|
92
90
|
return rev unless rev =~ /^([a-f0-9]+|\(.*\))$/ || rev == '(unknown)'
|
93
91
|
end
|
94
92
|
|
95
|
-
return unless File.exists?(scope('.git/HEAD'))
|
96
|
-
rev = File.read(scope('.git/HEAD')).strip
|
93
|
+
return unless File.exists?(Sass::Util.scope('.git/HEAD'))
|
94
|
+
rev = File.read(Sass::Util.scope('.git/HEAD')).strip
|
97
95
|
return rev unless rev =~ /^ref: (.*)$/
|
98
96
|
|
99
97
|
ref_name = $1
|
100
|
-
ref_file = scope(".git/#{ref_name}")
|
101
|
-
info_file = scope(".git/info/refs")
|
98
|
+
ref_file = Sass::Util.scope(".git/#{ref_name}")
|
99
|
+
info_file = Sass::Util.scope(".git/info/refs")
|
102
100
|
return File.read(ref_file).strip if File.exists?(ref_file)
|
103
101
|
return unless File.exists?(info_file)
|
104
102
|
File.open(info_file) do |f|
|
@@ -112,8 +110,8 @@ module Sass
|
|
112
110
|
end
|
113
111
|
|
114
112
|
def version_date
|
115
|
-
return unless File.exists?(scope('VERSION_DATE'))
|
116
|
-
DateTime.parse(File.read(scope('VERSION_DATE')).strip)
|
113
|
+
return unless File.exists?(Sass::Util.scope('VERSION_DATE'))
|
114
|
+
DateTime.parse(File.read(Sass::Util.scope('VERSION_DATE')).strip)
|
117
115
|
end
|
118
116
|
end
|
119
117
|
|
data/test/sass/engine_test.rb
CHANGED
@@ -3329,6 +3329,43 @@ SASS
|
|
3329
3329
|
|
3330
3330
|
end
|
3331
3331
|
|
3332
|
+
def test_debug_inspects_sass_objects
|
3333
|
+
assert_warning(<<END) {render("@debug (a: 1, b: 2)")}
|
3334
|
+
test_debug_inspects_sass_objects_inline.sass:1 DEBUG: (a: 1, b: 2)
|
3335
|
+
END
|
3336
|
+
assert_warning(<<END) {render("$map: (a: 1, b: 2); @debug $map", :syntax => :scss)}
|
3337
|
+
test_debug_inspects_sass_objects_inline.scss:1 DEBUG: (a: 1, b: 2)
|
3338
|
+
END
|
3339
|
+
end
|
3340
|
+
|
3341
|
+
def test_default_arg_before_splat
|
3342
|
+
assert_equal <<CSS, render(<<SASS, :syntax => :scss)
|
3343
|
+
.foo-positional {
|
3344
|
+
a: 1;
|
3345
|
+
b: 2;
|
3346
|
+
positional-arguments: 3, 4;
|
3347
|
+
keyword-arguments: (); }
|
3348
|
+
|
3349
|
+
.foo-keywords {
|
3350
|
+
a: true;
|
3351
|
+
positional-arguments: ();
|
3352
|
+
keyword-arguments: (c: c, d: d); }
|
3353
|
+
CSS
|
3354
|
+
@mixin foo($a: true, $b: null, $arguments...) {
|
3355
|
+
a: $a;
|
3356
|
+
b: $b;
|
3357
|
+
positional-arguments: inspect($arguments);
|
3358
|
+
keyword-arguments: inspect(keywords($arguments));
|
3359
|
+
}
|
3360
|
+
.foo-positional {
|
3361
|
+
@include foo(1, 2, 3, 4);
|
3362
|
+
}
|
3363
|
+
.foo-keywords {
|
3364
|
+
@include foo($c: c, $d: d);
|
3365
|
+
}
|
3366
|
+
SASS
|
3367
|
+
end
|
3368
|
+
|
3332
3369
|
private
|
3333
3370
|
|
3334
3371
|
def assert_hash_has(hash, expected)
|
data/test/sass/functions_test.rb
CHANGED
@@ -817,8 +817,8 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
817
817
|
|
818
818
|
def test_grayscale
|
819
819
|
assert_equal("#bbbbbb", evaluate("grayscale(#abc)"))
|
820
|
-
assert_equal("
|
821
|
-
assert_equal("
|
820
|
+
assert_equal("gray", evaluate("grayscale(#f00)"))
|
821
|
+
assert_equal("gray", evaluate("grayscale(#00f)"))
|
822
822
|
assert_equal("white", evaluate("grayscale(white)"))
|
823
823
|
assert_equal("black", evaluate("grayscale(black)"))
|
824
824
|
assert_equal("black", evaluate("grayscale($color: black)"))
|
@@ -1567,6 +1567,13 @@ SCSS
|
|
1567
1567
|
assert_error_message("2px is not a string for `variable-exists'", "variable-exists(2px)")
|
1568
1568
|
end
|
1569
1569
|
|
1570
|
+
def test_inspect
|
1571
|
+
assert_equal "()", evaluate("inspect(())")
|
1572
|
+
assert_equal "null", evaluate("inspect(null)")
|
1573
|
+
assert_equal "1px null 3px", evaluate("inspect(1px null 3px)")
|
1574
|
+
assert_equal "(a: 1, b: 2)", evaluate("inspect((a: 1, b: 2))")
|
1575
|
+
end
|
1576
|
+
|
1570
1577
|
|
1571
1578
|
## Regression Tests
|
1572
1579
|
|
data/test/sass/importer_test.rb
CHANGED
@@ -204,7 +204,7 @@ SCSS
|
|
204
204
|
_, sourcemap = engine.render_with_sourcemap('sourcemap_uri')
|
205
205
|
assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => 'css_uri')
|
206
206
|
{
|
207
|
-
"version":
|
207
|
+
"version": 3,
|
208
208
|
"mappings": "AAAA,QAAS;EACP,KAAK,EAAE,IAAI",
|
209
209
|
"sources": ["http://orange.example.com/style.scss"],
|
210
210
|
"file": "css_uri"
|
@@ -274,7 +274,7 @@ SCSS
|
|
274
274
|
sourcemap_path = 'map/style.map'
|
275
275
|
assert_equal <<JSON.strip, sourcemap.to_json(:css_uri => css_uri, :sourcemap_path => sourcemap_path)
|
276
276
|
{
|
277
|
-
"version":
|
277
|
+
"version": 3,
|
278
278
|
"mappings": "AAAA,IAAK;EAAC,CAAC,EAAE,CAAC",
|
279
279
|
"sources": ["../sass/style.scss"],
|
280
280
|
"file": "css_uri"
|
@@ -299,7 +299,7 @@ SCSS
|
|
299
299
|
sourcemap_path = 'map/style.map'
|
300
300
|
assert_equal <<JSON.strip, sourcemap.to_json(:css_path => css_path, :sourcemap_path => sourcemap_path)
|
301
301
|
{
|
302
|
-
"version":
|
302
|
+
"version": 3,
|
303
303
|
"mappings": "AAAA,IAAK;EAAC,CAAC,EAAE,CAAC",
|
304
304
|
"sources": ["../sass/style.scss"],
|
305
305
|
"file": "../static/style.css"
|
data/test/sass/script_test.rb
CHANGED
@@ -736,6 +736,18 @@ SCSS
|
|
736
736
|
end
|
737
737
|
end
|
738
738
|
|
739
|
+
def test_number_printing
|
740
|
+
assert_equal "1", resolve("1")
|
741
|
+
assert_equal "1", resolve("1.0")
|
742
|
+
assert_equal "1000000000", resolve("1000000000")
|
743
|
+
assert_equal "0.00001", resolve("0.00001")
|
744
|
+
assert_equal "1.12121", resolve("1.121214")
|
745
|
+
assert_equal "1.12122", resolve("1.121215")
|
746
|
+
assert_equal "Infinity", resolve("(1.0/0.0)")
|
747
|
+
assert_equal "-Infinity", resolve("(-1.0/0.0)")
|
748
|
+
assert_equal "NaN", resolve("(0.0/0.0)")
|
749
|
+
end
|
750
|
+
|
739
751
|
private
|
740
752
|
|
741
753
|
def resolve(str, opts = {}, environment = env)
|
@@ -783,16 +795,6 @@ SCSS
|
|
783
795
|
parser.parse_selector
|
784
796
|
end
|
785
797
|
|
786
|
-
def test_number_printing
|
787
|
-
assert_equal "1", eval("1")
|
788
|
-
assert_equal "1", eval("1.0")
|
789
|
-
assert_equal "1.121", eval("1.1214")
|
790
|
-
assert_equal "1.122", eval("1.1215")
|
791
|
-
assert_equal "Infinity", eval("1.0/0.0")
|
792
|
-
assert_equal "-Infinity", eval("-1.0/0.0")
|
793
|
-
assert_equal "NaN", eval("0.0/0.0")
|
794
|
-
end
|
795
|
-
|
796
798
|
def test_null_is_a_singleton
|
797
799
|
assert_same Sass::Script::Value::Null.new, Sass::Script::Value::Null.new
|
798
800
|
end
|
@@ -27,7 +27,7 @@ a {
|
|
27
27
|
/*# sourceMappingURL=test.css.map */
|
28
28
|
CSS
|
29
29
|
{
|
30
|
-
"version":
|
30
|
+
"version": 3,
|
31
31
|
"mappings": "AAAA,CAAE;EACA,GAAG,EAAE,GAAG;;EAER,SAAS,EAAE,IAAI",
|
32
32
|
"sources": ["test_simple_mapping_scss_inline.scss"],
|
33
33
|
"file": "test.css"
|
@@ -50,7 +50,7 @@ a {
|
|
50
50
|
/*# sourceMappingURL=test.css.map */
|
51
51
|
CSS
|
52
52
|
{
|
53
|
-
"version":
|
53
|
+
"version": 3,
|
54
54
|
"mappings": "AAAA,CAAC;EACC,GAAG,EAAE,GAAG;;EAEP,SAAS,EAAC,IAAI",
|
55
55
|
"sources": ["test_simple_mapping_sass_inline.sass"],
|
56
56
|
"file": "test.css"
|
@@ -75,7 +75,7 @@ a {
|
|
75
75
|
/*# sourceMappingURL=style.css.map */
|
76
76
|
CSS
|
77
77
|
{
|
78
|
-
"version":
|
78
|
+
"version": 3,
|
79
79
|
"mappings": "AAAA,CAAE;EACA,GAAG,EAAE,GAAG;;EAER,SAAS,EAAE,IAAI",
|
80
80
|
"sources": ["../scss/style.scss"],
|
81
81
|
"file": "style.css"
|
@@ -99,7 +99,7 @@ a {
|
|
99
99
|
/*# sourceMappingURL=style.css.map */
|
100
100
|
CSS
|
101
101
|
{
|
102
|
-
"version":
|
102
|
+
"version": 3,
|
103
103
|
"mappings": "AAAA,CAAC;EACC,GAAG,EAAE,GAAG;;EAEP,SAAS,EAAC,IAAI",
|
104
104
|
"sources": ["../sass/style.sass"],
|
105
105
|
"file": "style.css"
|
@@ -121,7 +121,7 @@ a {
|
|
121
121
|
/*# sourceMappingURL=test.css.map */
|
122
122
|
CSS
|
123
123
|
{
|
124
|
-
"version":
|
124
|
+
"version": 3,
|
125
125
|
"mappings": ";AAAA,CAAE;EACA,GAAG,EAAE,GAAG",
|
126
126
|
"sources": ["test_simple_charset_mapping_scss_inline.scss"],
|
127
127
|
"file": "test.css"
|
@@ -141,7 +141,7 @@ a {
|
|
141
141
|
/*# sourceMappingURL=test.css.map */
|
142
142
|
CSS
|
143
143
|
{
|
144
|
-
"version":
|
144
|
+
"version": 3,
|
145
145
|
"mappings": ";AAAA,CAAC;EACC,GAAG,EAAE,GAAG",
|
146
146
|
"sources": ["test_simple_charset_mapping_sass_inline.sass"],
|
147
147
|
"file": "test.css"
|
@@ -163,7 +163,7 @@ f\x86\x86 {
|
|
163
163
|
/*# sourceMappingURL=test.css.map */
|
164
164
|
CSS
|
165
165
|
{
|
166
|
-
"version":
|
166
|
+
"version": 3,
|
167
167
|
"mappings": ";AACA,GAAI;EACF,CAAC,EAAE,CAAC",
|
168
168
|
"sources": ["test_different_charset_than_encoding_scss_inline.scss"],
|
169
169
|
"file": "test.css"
|
@@ -184,7 +184,7 @@ f\x86\x86 {
|
|
184
184
|
/*# sourceMappingURL=test.css.map */
|
185
185
|
CSS
|
186
186
|
{
|
187
|
-
"version":
|
187
|
+
"version": 3,
|
188
188
|
"mappings": ";AACA,GAAG;EACD,CAAC,EAAE,CAAC",
|
189
189
|
"sources": ["test_different_charset_than_encoding_sass_inline.sass"],
|
190
190
|
"file": "test.css"
|
@@ -3,6 +3,28 @@ require File.dirname(__FILE__) + '/../../test_helper'
|
|
3
3
|
require 'sass/util/normalized_map'
|
4
4
|
|
5
5
|
class NormalizedMapTest < Test::Unit::TestCase
|
6
|
+
extend PublicApiLinter
|
7
|
+
|
8
|
+
lint_api Hash, Sass::Util::NormalizedMap
|
9
|
+
|
10
|
+
def lint_instance
|
11
|
+
Sass::Util::NormalizedMap.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_normalized_map_errors_unless_explicitly_implemented
|
15
|
+
assert Sass.tests_running
|
16
|
+
assert_raise_message(ArgumentError, "The method invert must be implemented explicitly") do
|
17
|
+
Sass::Util::NormalizedMap.new.invert
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_normalized_map_does_not_error_when_released
|
22
|
+
Sass.tests_running = false
|
23
|
+
assert_equal({}, Sass::Util::NormalizedMap.new.invert)
|
24
|
+
ensure
|
25
|
+
Sass.tests_running = true
|
26
|
+
end
|
27
|
+
|
6
28
|
def test_basic_lifecycle
|
7
29
|
m = Sass::Util::NormalizedMap.new
|
8
30
|
m["a-b"] = 1
|
@@ -26,5 +48,4 @@ class NormalizedMapTest < Test::Unit::TestCase
|
|
26
48
|
assert !m.has_key?("a-b")
|
27
49
|
assert m2.has_key?("a-b")
|
28
50
|
end
|
29
|
-
|
30
51
|
end
|
data/test/sass/util_test.rb
CHANGED
@@ -304,6 +304,15 @@ class UtilTest < Test::Unit::TestCase
|
|
304
304
|
def foo
|
305
305
|
Sass::Util.abstract(self)
|
306
306
|
end
|
307
|
+
def old_method
|
308
|
+
Sass::Util.deprecated(self)
|
309
|
+
end
|
310
|
+
def old_method_with_custom_message
|
311
|
+
Sass::Util.deprecated(self, "Call FooBar#new_method instead.")
|
312
|
+
end
|
313
|
+
def self.another_old_method
|
314
|
+
Sass::Util.deprecated(self)
|
315
|
+
end
|
307
316
|
end
|
308
317
|
|
309
318
|
def test_abstract
|
@@ -311,6 +320,15 @@ class UtilTest < Test::Unit::TestCase
|
|
311
320
|
"UtilTest::FooBar must implement #foo") {FooBar.new.foo}
|
312
321
|
end
|
313
322
|
|
323
|
+
def test_deprecated
|
324
|
+
assert_warning("DEPRECATION WARNING: UtilTest::FooBar#old_method will be removed in a future version of Sass.") { FooBar.new.old_method }
|
325
|
+
assert_warning(<<WARNING) { FooBar.new.old_method_with_custom_message }
|
326
|
+
DEPRECATION WARNING: UtilTest::FooBar#old_method_with_custom_message will be removed in a future version of Sass.
|
327
|
+
Call FooBar#new_method instead.
|
328
|
+
WARNING
|
329
|
+
assert_warning("DEPRECATION WARNING: UtilTest::FooBar.another_old_method will be removed in a future version of Sass.") { FooBar.another_old_method }
|
330
|
+
end
|
331
|
+
|
314
332
|
def test_json_escape_string
|
315
333
|
assert_json_string "", ""
|
316
334
|
alphanum = (("0".."9").to_a).concat(("a".."z").to_a).concat(("A".."Z").to_a).join
|