Skip to content

Commit 1c272b9

Browse files
committed
Added a basic test
1 parent 3123fd1 commit 1c272b9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

consumer_test.go

+17
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ func (test *sourceMapTest) assert(t *testing.T, smap *sourcemap.Consumer) {
6666
}
6767
}
6868

69+
func TestSourceWithEmptySourceMap(t *testing.T) {
70+
var jsmap = `{
71+
"version": 3,
72+
"mappings": ";;"
73+
}`
74+
75+
smap, err := sourcemap.Parse("noname", []byte(jsmap))
76+
if err != nil {
77+
t.Fatal(err)
78+
}
79+
80+
_, _, _, _, matched := smap.Source(1, 1)
81+
if matched {
82+
t.Error("it is unexpected to match an empty SourceMap")
83+
}
84+
}
85+
6986
func TestSourceMap(t *testing.T) {
7087
testSourceMap(t, sourceMapJSON)
7188
}

0 commit comments

Comments
 (0)