sourcemap 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +2 -0
- data/README.md +2 -7
- data/examples/foobar.map +1 -1
- data/lib/source_map.rb +1 -0
- data/lib/source_map/map.rb +31 -30
- data/lib/source_map/mapping.rb +26 -0
- data/lib/source_map/offset.rb +5 -1
- data/lib/source_map/version.rb +1 -1
- data/test/test_map.rb +61 -20
- data/test/test_mapping.rb +42 -0
- data/test/test_offset.rb +4 -2
- data/test/test_vlq.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d45b71f869e6eb34bf0c4307a3fce317e29eb35f
|
4
|
+
data.tar.gz: cc38f062d61b03058b367fd1fd43108c75897dcd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9c182c120450f8bcfe19a69c7b93b4898a19fb01f05f7773ff08943f79b9c3bb580eb2f35cf02ea2d6e1614d47a8610d0e21902675c570b46b46dbf9a32cae3
|
7
|
+
data.tar.gz: ba03b03caae7ea67c1a4dcce63572ae751d979b91c03ca6d0f601ad09762d7a23f0c6ac74941538c8d2327de98ede248e54c7fc855306a2b130799387091ba84
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -34,7 +34,7 @@ Base one source map of another.
|
|
34
34
|
``` ruby
|
35
35
|
cs_map = SourceMap::Map.from_json File.read("examples/index.map")
|
36
36
|
min_map = SourceMap::Map.from_json File.read("examples/index.min.map")
|
37
|
-
combined_map = cs_map
|
37
|
+
combined_map = cs_map | min_map
|
38
38
|
combined_map.to_json
|
39
39
|
```
|
40
40
|
|
@@ -64,7 +64,6 @@ Create a new `Map` instance from a hash.
|
|
64
64
|
hash = {
|
65
65
|
'version' => 3,
|
66
66
|
'file' => "script.min.js",
|
67
|
-
'lineCount' => 1,
|
68
67
|
'mappings' => "AAEAA,QAASA,MAAK,EAAG,CACfC,OAAAC,IAAA,CAAY,eAAZ,CADe",
|
69
68
|
'sources' => ["script.js"],
|
70
69
|
'names' => ["hello", "console", "log"]
|
@@ -81,10 +80,6 @@ Instantiate a `Map` instance, passing in an optional array of `Mapping`s and fil
|
|
81
80
|
SourceMap::Mapping.new('c.js', SourceMap::Offset.new(2, 0), SourceMap::Offset.new(30, 0))
|
82
81
|
])
|
83
82
|
|
84
|
-
### Map#line_count
|
85
|
-
|
86
|
-
Returns the line number of the last mapping.
|
87
|
-
|
88
83
|
### Map#size
|
89
84
|
|
90
85
|
Returns the amount of mappings
|
@@ -170,4 +165,4 @@ Compare the position of two offsets, first the line than the column.
|
|
170
165
|
|
171
166
|
## Offset#to_s
|
172
167
|
|
173
|
-
Get a pretty representation of an offset.
|
168
|
+
Get a pretty representation of an offset.
|
data/examples/foobar.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":null,"
|
1
|
+
{"version":3,"file":null,"mappings":";AACA;CAAA,KAAA,gDAAA;KAAA,aAAA;;CAAA,CAAA,CAAW,GAAX;;CAAA,CACA,CAAW,CADX,IACA;;CAGA,CAAA,EAAgB,IAAhB;AAAU,CAAV,CAAA,CAAS,CAAT,EAAA;IAJA;;CAAA,CAOA,CAAS,GAAT,GAAU;CAAM,EAAI,QAAJ;CAPhB,EAOS;;CAPT,CAUA,CAAO,CAAP;;CAVA,CAaA,CACE,CADF;CACE,CAAQ,EAAR;CAAA,CACQ,EAAR,EAAA;CADA,CAEQ,CAAA,CAAR,KAAS;CAAM,EAAI,GAAA,OAAJ;CAFf,IAEQ;CAhBV,GAAA;;CAAA,CAmBA,CAAO,CAAP,KAAO;CACL,OAAA,OAAA;CAAA,CADc,EAAR,mDACN;CAAM,CAAQ,GAAd,CAAA,CAAA,IAAA;CApBF,EAmBO;;CAIP,CAAA,EAAsB,0CAAtB;CAAA,GAAA,CAAA,OAAA;IAvBA;;CAAA,CA0BA,GAAA;;AAAS,CAAA;UAAA,iCAAA;sBAAA;CAAA,EAAA,CAAI;CAAJ;;CA1BT;CAAA;;;ACAA;CAAA,KAAA,6DAAA;;CAAA;CAAA,MAAA,oCAAA;qBAAA;CAAA,EAAA,CAAA;CAAA,EAAA;;CAAA,CAGA,CAAU,GAAA,CAAV,CAAU,EAAA;;AACV,CAAA,MAAA,iDAAA;uBAAA;CAAA,CAAY,CAAH,CAAT;CAAA,EAJA;;CAAA,CAOA,CAAQ,EAAR,IAAQ,CAAA,CAAA;;AACR,CAAA,MAAA,uCAAA;sBAAA;IAAgC,CAAU;CAA1C,EAAA,CAAA,EAAA;MAAA;CAAA,EARA;CAAA;","sources":["foo.coffee","bar.coffee"],"names":[]}
|
data/lib/source_map.rb
CHANGED
data/lib/source_map/map.rb
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
require 'json'
|
2
2
|
|
3
3
|
require 'source_map/offset'
|
4
|
+
require 'source_map/mapping'
|
4
5
|
require 'source_map/vlq'
|
5
6
|
|
6
7
|
module SourceMap
|
7
|
-
Mapping = Struct.new(:source, :generated, :original, :name) do
|
8
|
-
def to_s
|
9
|
-
"#{generated.line}:#{generated.column}->#{original.line}:#{original.column}"
|
10
|
-
end
|
11
|
-
|
12
|
-
alias_method :inspect, :to_s
|
13
|
-
end
|
14
|
-
|
15
8
|
class Map
|
16
9
|
include Enumerable
|
17
10
|
|
@@ -81,10 +74,6 @@ module SourceMap
|
|
81
74
|
|
82
75
|
attr_reader :filename
|
83
76
|
|
84
|
-
def line_count
|
85
|
-
@line_count ||= @mappings.any? ? @mappings.last.generated.line : 0
|
86
|
-
end
|
87
|
-
|
88
77
|
def size
|
89
78
|
@mappings.size
|
90
79
|
end
|
@@ -109,19 +98,31 @@ module SourceMap
|
|
109
98
|
@names ||= @mappings.map(&:name).uniq.compact
|
110
99
|
end
|
111
100
|
|
101
|
+
def ==(other)
|
102
|
+
eql?(other)
|
103
|
+
end
|
104
|
+
|
105
|
+
def eql?(other)
|
106
|
+
other.is_a?(self.class) &&
|
107
|
+
self.mappings == other.mappings &&
|
108
|
+
self.filename == other.filename
|
109
|
+
end
|
110
|
+
|
112
111
|
def +(other)
|
113
112
|
mappings = @mappings.dup
|
114
|
-
offset =
|
113
|
+
offset = @mappings.any? ? @mappings.last.generated.line+1 : 0
|
115
114
|
other.each do |m|
|
116
115
|
mappings << Mapping.new(
|
117
116
|
m.source, m.generated + offset,
|
118
117
|
m.original, m.name
|
119
118
|
)
|
120
119
|
end
|
121
|
-
self.class.new(mappings)
|
120
|
+
self.class.new(mappings, other.filename)
|
122
121
|
end
|
123
122
|
|
124
123
|
def |(other)
|
124
|
+
return other.dup if self.mappings.empty?
|
125
|
+
|
125
126
|
mappings = []
|
126
127
|
|
127
128
|
other.each do |m|
|
@@ -161,14 +162,26 @@ module SourceMap
|
|
161
162
|
{
|
162
163
|
"version" => 3,
|
163
164
|
"file" => filename,
|
164
|
-
"lineCount" => line_count,
|
165
165
|
"mappings" => to_s,
|
166
166
|
"sources" => sources,
|
167
167
|
"names" => names
|
168
168
|
}
|
169
169
|
end
|
170
170
|
|
171
|
+
# Public: Get a pretty inspect output for debugging purposes.
|
172
|
+
#
|
173
|
+
# Returns a String.
|
174
|
+
def inspect
|
175
|
+
str = "#<#{self.class}"
|
176
|
+
str << " filename=#{filename.inspect}" if filename
|
177
|
+
str << " mappings=#{mappings.map(&:to_s).inspect}" if mappings.any?
|
178
|
+
str << ">"
|
179
|
+
str
|
180
|
+
end
|
181
|
+
|
171
182
|
protected
|
183
|
+
attr_reader :mappings
|
184
|
+
|
172
185
|
def build_vlq_string
|
173
186
|
source_id = 0
|
174
187
|
source_line = 1
|
@@ -177,6 +190,9 @@ module SourceMap
|
|
177
190
|
|
178
191
|
by_lines = @mappings.group_by { |m| m.generated.line }
|
179
192
|
|
193
|
+
sources_index = Hash[sources.each_with_index.to_a]
|
194
|
+
names_index = Hash[names.each_with_index.to_a]
|
195
|
+
|
180
196
|
ary = (1..by_lines.keys.max).map do |line|
|
181
197
|
generated_column = 0
|
182
198
|
|
@@ -200,20 +216,5 @@ module SourceMap
|
|
200
216
|
|
201
217
|
VLQ.encode_mappings(ary)
|
202
218
|
end
|
203
|
-
|
204
|
-
def sources_index
|
205
|
-
@sources_index ||= build_index(sources)
|
206
|
-
end
|
207
|
-
|
208
|
-
def names_index
|
209
|
-
@names_index ||= build_index(names)
|
210
|
-
end
|
211
|
-
|
212
|
-
private
|
213
|
-
def build_index(array)
|
214
|
-
index = {}
|
215
|
-
array.each_with_index { |v, i| index[v] = i }
|
216
|
-
index
|
217
|
-
end
|
218
219
|
end
|
219
220
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'source_map/offset'
|
2
|
+
|
3
|
+
module SourceMap
|
4
|
+
class Mapping < Struct.new(:source, :generated, :original, :name)
|
5
|
+
# Public: Get a simple string representation of the mapping.
|
6
|
+
#
|
7
|
+
# Returns a String.
|
8
|
+
def to_s
|
9
|
+
str = "#{generated.line}:#{generated.column}"
|
10
|
+
str << "->#{source}@#{original.line}:#{original.column}"
|
11
|
+
str << "##{name}" if name
|
12
|
+
str
|
13
|
+
end
|
14
|
+
|
15
|
+
# Public: Get a pretty inspect output for debugging purposes.
|
16
|
+
#
|
17
|
+
# Returns a String.
|
18
|
+
def inspect
|
19
|
+
str = "#<#{self.class} source=#{source.inspect}"
|
20
|
+
str << " generated=#{generated}, original=#{original}"
|
21
|
+
str << " name=#{name.inspect}" if name
|
22
|
+
str << ">"
|
23
|
+
str
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/source_map/offset.rb
CHANGED
data/lib/source_map/version.rb
CHANGED
data/test/test_map.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'source_map/map'
|
3
3
|
|
4
|
-
class TestMap < MiniTest::
|
4
|
+
class TestMap < MiniTest::Test
|
5
5
|
include SourceMap
|
6
6
|
|
7
7
|
def setup
|
@@ -16,7 +16,6 @@ class TestMap < MiniTest::Unit::TestCase
|
|
16
16
|
hash = {
|
17
17
|
'version' => 3,
|
18
18
|
'file' => "script.min.js",
|
19
|
-
'lineCount' => 1,
|
20
19
|
'mappings' => "AAEAA,QAASA,MAAK,EAAG,CACfC,OAAAC,IAAA,CAAY,eAAZ,CADe",
|
21
20
|
'sources' => ["script.js"],
|
22
21
|
'names' => ["hello", "console", "log"]
|
@@ -39,10 +38,9 @@ class TestMap < MiniTest::Unit::TestCase
|
|
39
38
|
assert_equal 'script.js', mapping.source
|
40
39
|
assert_equal nil, mapping.name
|
41
40
|
|
42
|
-
assert_equal hash['
|
43
|
-
assert_equal hash['
|
44
|
-
assert_equal hash['
|
45
|
-
assert_equal hash['mappings'], map.to_s
|
41
|
+
assert_equal hash['sources'], map.sources
|
42
|
+
assert_equal hash['names'], map.names
|
43
|
+
assert_equal hash['mappings'], map.to_s
|
46
44
|
|
47
45
|
assert_equal hash, map.as_json
|
48
46
|
end
|
@@ -51,7 +49,6 @@ class TestMap < MiniTest::Unit::TestCase
|
|
51
49
|
hash = {
|
52
50
|
'version' => 3,
|
53
51
|
'file' => "example.js",
|
54
|
-
'lineCount' => 43,
|
55
52
|
'mappings' => ";;;;;EACAA;;EACAC;;EAGA;IAAA;;;EAGAC;IAAS;;;EAGTC;;EAGAC;IACE;IACA;IACA;MAAQ;;;;EAGVC;;;IACE;;;EAGF;IAAA;;;EAGAC;;;IAAQ;;MAAA",
|
56
53
|
'sources' => ["example.coffee"],
|
57
54
|
'names' => ["number", "opposite", "square", "list", "math", "race", "cubes"]
|
@@ -74,17 +71,15 @@ class TestMap < MiniTest::Unit::TestCase
|
|
74
71
|
assert_equal 'example.coffee', mapping.source
|
75
72
|
assert_equal nil, mapping.name
|
76
73
|
|
77
|
-
assert_equal hash['
|
78
|
-
assert_equal hash['
|
79
|
-
assert_equal hash['
|
80
|
-
assert_equal hash['mappings'], map.to_s
|
74
|
+
assert_equal hash['sources'], map.sources
|
75
|
+
assert_equal hash['names'], map.names
|
76
|
+
assert_equal hash['mappings'], map.to_s
|
81
77
|
end
|
82
78
|
|
83
79
|
def test_map3
|
84
80
|
hash = {
|
85
81
|
'version' => 3,
|
86
82
|
'file' => "example.min.js",
|
87
|
-
'lineCount' => 1,
|
88
83
|
'mappings' => "AACC,SAAQ,EAAG,CAAA,IACCA,CADD,CACOC,CADP,CACaC,CADb,CAC0CC,CAWpDA,EAAA,CAASA,QAAQ,CAACC,CAAD,CAAI,CACnB,MAAOA,EAAP,CAAWA,CADQ,CAIrBJ,EAAA,CAAO,CAAC,CAAD,CAAI,CAAJ,CAAO,CAAP,CAAU,CAAV,CAAa,CAAb,CAEPC,EAAA,CAAO,MACCI,IAAAC,KADD,QAEGH,CAFH,MAGCI,QAAQ,CAACH,CAAD,CAAI,CAChB,MAAOA,EAAP,CAAWD,CAAA,CAAOC,CAAP,CADK,CAHb,CAcc,YAArB,GAAI,MAAOI,MAAX,EAA8C,IAA9C,GAAoCA,KAApC,EACEC,KAAA,CAAM,YAAN,CAGO,UAAQ,EAAG,CAAA,IACdC,CADc,CACVC,CADU,CACJC,CACdA,EAAA,CAAW,EACNF,EAAA,CAAK,CAAV,KAAaC,CAAb,CAAoBX,CAAAa,OAApB,CAAiCH,CAAjC,CAAsCC,CAAtC,CAA4CD,CAAA,EAA5C,CACER,CACA,CADMF,CAAA,CAAKU,CAAL,CACN,CAAAE,CAAAE,KAAA,CAAcb,CAAAM,KAAA,CAAUL,CAAV,CAAd,CAEF,OAAOU,EAPW,CAAX,CAAA,EApCC,CAAX,CAAAG,KAAA,CA8CO,IA9CP",
|
89
84
|
'sources' => ["example.js"],
|
90
85
|
'names' => ["list","math","num","square","x","Math","sqrt","cube","elvis","alert","_i","_len","_results","length","push","call"]
|
@@ -107,14 +102,9 @@ class TestMap < MiniTest::Unit::TestCase
|
|
107
102
|
assert_equal 'example.js', mapping.source
|
108
103
|
assert_equal nil, mapping.name
|
109
104
|
|
110
|
-
assert_equal hash['
|
111
|
-
assert_equal hash['
|
112
|
-
assert_equal hash['
|
113
|
-
assert_equal hash['mappings'], map.to_s
|
114
|
-
end
|
115
|
-
|
116
|
-
def test_line_count
|
117
|
-
# assert_equal 3, @mappings.line_count
|
105
|
+
assert_equal hash['sources'], map.sources
|
106
|
+
assert_equal hash['names'], map.names
|
107
|
+
assert_equal hash['mappings'], map.to_s
|
118
108
|
end
|
119
109
|
|
120
110
|
def test_to_s
|
@@ -129,6 +119,40 @@ class TestMap < MiniTest::Unit::TestCase
|
|
129
119
|
assert_equal [], @mappings.names
|
130
120
|
end
|
131
121
|
|
122
|
+
def test_eql
|
123
|
+
map1 = @mappings
|
124
|
+
map2 = @mappings.dup
|
125
|
+
map3 = Map.new([
|
126
|
+
Mapping.new('a.js', Offset.new(0, 0), Offset.new(0, 0)),
|
127
|
+
Mapping.new('b.js', Offset.new(1, 0), Offset.new(20, 0)),
|
128
|
+
Mapping.new('c.js', Offset.new(2, 0), Offset.new(30, 0))
|
129
|
+
])
|
130
|
+
map4 = Map.new
|
131
|
+
map5 = Map.new([
|
132
|
+
Mapping.new('a.js', Offset.new(0, 0), Offset.new(0, 0))
|
133
|
+
])
|
134
|
+
map6 = Map.new([
|
135
|
+
Mapping.new('a.js', Offset.new(0, 0), Offset.new(0, 0)),
|
136
|
+
Mapping.new('b.js', Offset.new(1, 0), Offset.new(20, 0)),
|
137
|
+
Mapping.new('z.js', Offset.new(2, 0), Offset.new(30, 0))
|
138
|
+
])
|
139
|
+
map7 = Map.new([
|
140
|
+
Mapping.new('a.js', Offset.new(0, 0), Offset.new(0, 0)),
|
141
|
+
Mapping.new('b.js', Offset.new(1, 0), Offset.new(20, 0)),
|
142
|
+
Mapping.new('c.js', Offset.new(2, 0), Offset.new(30, 0))
|
143
|
+
], 'bar.js')
|
144
|
+
|
145
|
+
assert map1.eql?(map1)
|
146
|
+
assert map1.eql?(map2)
|
147
|
+
assert map1.eql?(map3)
|
148
|
+
|
149
|
+
refute map1.eql?(true)
|
150
|
+
refute map1.eql?(map4)
|
151
|
+
refute map1.eql?(map5)
|
152
|
+
refute map1.eql?(map6)
|
153
|
+
refute map1.eql?(map7)
|
154
|
+
end
|
155
|
+
|
132
156
|
def test_add
|
133
157
|
mappings2 = Map.new([
|
134
158
|
Mapping.new('d.js', Offset.new(0, 0), Offset.new(0, 0))
|
@@ -140,6 +164,13 @@ class TestMap < MiniTest::Unit::TestCase
|
|
140
164
|
assert_equal 3, mappings3[3].generated.line
|
141
165
|
end
|
142
166
|
|
167
|
+
def test_add_identity
|
168
|
+
identity_map = Map.new
|
169
|
+
|
170
|
+
assert_equal @mappings, identity_map + @mappings
|
171
|
+
assert_equal @mappings, @mappings + identity_map
|
172
|
+
end
|
173
|
+
|
143
174
|
def test_pipe
|
144
175
|
mappings1 = Map.from_json(%{
|
145
176
|
{
|
@@ -168,6 +199,12 @@ class TestMap < MiniTest::Unit::TestCase
|
|
168
199
|
assert_equal 'CAAA,WAAA,GAAA,KAAA,MAAO,WAAA,MACL,OAAM,eAER,IAAW,KAAX,CAAG,SAHH,KAAA', mappings3.to_s
|
169
200
|
end
|
170
201
|
|
202
|
+
def test_pipe_identity
|
203
|
+
identity_map = Map.new
|
204
|
+
|
205
|
+
assert_equal @mappings, identity_map | @mappings
|
206
|
+
end
|
207
|
+
|
171
208
|
def test_bsearch
|
172
209
|
assert_equal Offset.new(0, 0), @mappings.bsearch(Offset.new(0, 0)).original
|
173
210
|
assert_equal Offset.new(0, 0), @mappings.bsearch(Offset.new(0, 5)).original
|
@@ -175,4 +212,8 @@ class TestMap < MiniTest::Unit::TestCase
|
|
175
212
|
assert_equal Offset.new(20, 0), @mappings.bsearch(Offset.new(1, 0)).original
|
176
213
|
assert_equal Offset.new(30, 0), @mappings.bsearch(Offset.new(2, 0)).original
|
177
214
|
end
|
215
|
+
|
216
|
+
def test_inspect
|
217
|
+
assert_equal "#<SourceMap::Map mappings=[\"0:0->a.js@0:0\", \"1:0->b.js@20:0\", \"2:0->c.js@30:0\"]>", @mappings.inspect
|
218
|
+
end
|
178
219
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'source_map/offset'
|
3
|
+
|
4
|
+
class TestMapping < MiniTest::Test
|
5
|
+
include SourceMap
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@mapping = Mapping.new("a.js", Offset.new(1, 5), Offset.new(2, 0), "foo")
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_equal
|
12
|
+
assert @mapping.dup == @mapping
|
13
|
+
assert Mapping.new("b.js", Offset.new(1, 5), Offset.new(2, 0), "foo") != @mapping
|
14
|
+
assert Mapping.new("a.js", Offset.new(1, 5), Offset.new(2, 0), "bar") != @mapping
|
15
|
+
assert Mapping.new("a.js", Offset.new(1, 6), Offset.new(2, 0), "foo") != @mapping
|
16
|
+
assert Mapping.new("a.js", Offset.new(1, 5), Offset.new(3, 0), "foo") != @mapping
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_source
|
20
|
+
assert_equal "a.js", @mapping.source
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_generated
|
24
|
+
assert_equal Offset.new(1, 5), @mapping.generated
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_original
|
28
|
+
assert_equal Offset.new(2, 0), @mapping.original
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_name
|
32
|
+
assert_equal "foo", @mapping.name
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_to_s
|
36
|
+
assert_equal "1:5->a.js@2:0#foo", @mapping.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_inspect
|
40
|
+
assert_equal "#<SourceMap::Mapping source=\"a.js\" generated=1:5, original=2 name=\"foo\">", @mapping.inspect
|
41
|
+
end
|
42
|
+
end
|
data/test/test_offset.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'source_map/offset'
|
3
3
|
|
4
|
-
class TestOffset < MiniTest::
|
4
|
+
class TestOffset < MiniTest::Test
|
5
5
|
include SourceMap
|
6
6
|
|
7
7
|
def setup
|
@@ -31,7 +31,9 @@ class TestOffset < MiniTest::Unit::TestCase
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def test_to_s
|
34
|
-
assert_equal "
|
34
|
+
assert_equal "0", Offset.new(0, 0).to_s
|
35
|
+
assert_equal "1", Offset.new(1, 0).to_s
|
36
|
+
assert_equal "1:5", Offset.new(1, 5).to_s
|
35
37
|
end
|
36
38
|
|
37
39
|
def test_inspect
|
data/test/test_vlq.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sourcemap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Peek
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -79,12 +79,14 @@ files:
|
|
79
79
|
- examples/foobar.map
|
80
80
|
- lib/source_map.rb
|
81
81
|
- lib/source_map/map.rb
|
82
|
+
- lib/source_map/mapping.rb
|
82
83
|
- lib/source_map/offset.rb
|
83
84
|
- lib/source_map/version.rb
|
84
85
|
- lib/source_map/vlq.rb
|
85
86
|
- lib/sourcemap.rb
|
86
87
|
- sourcemap.gemspec
|
87
88
|
- test/test_map.rb
|
89
|
+
- test/test_mapping.rb
|
88
90
|
- test/test_offset.rb
|
89
91
|
- test/test_vlq.rb
|
90
92
|
homepage: http://github.com/maccman/sourcemap
|
@@ -113,5 +115,6 @@ specification_version: 4
|
|
113
115
|
summary: Ruby source maps
|
114
116
|
test_files:
|
115
117
|
- test/test_map.rb
|
118
|
+
- test/test_mapping.rb
|
116
119
|
- test/test_offset.rb
|
117
120
|
- test/test_vlq.rb
|