Added tests from original issue.

This commit is contained in:
Daniel Rosenwasser 2015-04-21 13:42:53 -07:00
parent f1392ad527
commit 989968013e
12 changed files with 272 additions and 0 deletions

View file

@ -0,0 +1,17 @@
//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts]
module Q {
function P() {
// Test this
var a = 1;
}
}
//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js]
var Q;
(function (Q) {
function P() {
// Test this
var a = 1;
}
})(Q || (Q = {}));
//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map

View file

@ -0,0 +1,2 @@
//// [sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map]
{"version":3,"file":"sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts"],"names":["Q","Q.P"],"mappings":"AAAA,IAAO,CAAC,CAKP;AALD,WAAO,CAAC,EAAC,CAAC;IACNA;QAEIC,AADAA,YAAYA;YACRA,CAACA,GAAGA,CAACA,CAACA;IACdA,CAACA;AACLD,CAACA,EALM,CAAC,KAAD,CAAC,QAKP"}

View file

@ -0,0 +1,127 @@
===================================================================
JsFile: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js
mapUrl: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map
sourceRoot:
sources: sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js
sourceFile:sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts
-------------------------------------------------------------------
>>>var Q;
1 >
2 >^^^^
3 > ^
4 > ^
5 > ^^^^^^^^^^->
1 >
2 >module
3 > Q
4 > {
> function P() {
> // Test this
> var a = 1;
> }
> }
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(1, 5) Source(1, 8) + SourceIndex(0)
3 >Emitted(1, 6) Source(1, 9) + SourceIndex(0)
4 >Emitted(1, 7) Source(6, 2) + SourceIndex(0)
---
>>>(function (Q) {
1->
2 >^^^^^^^^^^^
3 > ^
4 > ^^
5 > ^
6 > ^^^^->
1->
2 >module
3 > Q
4 >
5 > {
1->Emitted(2, 1) Source(1, 1) + SourceIndex(0)
2 >Emitted(2, 12) Source(1, 8) + SourceIndex(0)
3 >Emitted(2, 13) Source(1, 9) + SourceIndex(0)
4 >Emitted(2, 15) Source(1, 10) + SourceIndex(0)
5 >Emitted(2, 16) Source(1, 11) + SourceIndex(0)
---
>>> function P() {
1->^^^^
2 > ^^^^^^^^^^^^^^^^^->
1->
>
1->Emitted(3, 5) Source(2, 5) + SourceIndex(0) name (Q)
---
>>> // Test this
1->^^^^^^^^
2 >
3 > ^^^^^^^^^^^^
1->function P() {
> // Test this
>
2 >
3 > // Test this
1->Emitted(4, 9) Source(4, 9) + SourceIndex(0) name (Q.P)
2 >Emitted(4, 9) Source(3, 9) + SourceIndex(0) name (Q.P)
3 >Emitted(4, 21) Source(3, 21) + SourceIndex(0) name (Q.P)
---
>>> var a = 1;
1 >^^^^^^^^^^^^
2 > ^
3 > ^^^
4 > ^
5 > ^
1 >
> var
2 > a
3 > =
4 > 1
5 > ;
1 >Emitted(5, 13) Source(4, 13) + SourceIndex(0) name (Q.P)
2 >Emitted(5, 14) Source(4, 14) + SourceIndex(0) name (Q.P)
3 >Emitted(5, 17) Source(4, 17) + SourceIndex(0) name (Q.P)
4 >Emitted(5, 18) Source(4, 18) + SourceIndex(0) name (Q.P)
5 >Emitted(5, 19) Source(4, 19) + SourceIndex(0) name (Q.P)
---
>>> }
1 >^^^^
2 > ^
3 > ^^^^^^^^^^^^^^->
1 >
>
2 > }
1 >Emitted(6, 5) Source(5, 5) + SourceIndex(0) name (Q.P)
2 >Emitted(6, 6) Source(5, 6) + SourceIndex(0) name (Q.P)
---
>>>})(Q || (Q = {}));
1->
2 >^
3 > ^^
4 > ^
5 > ^^^^^
6 > ^
7 > ^^^^^^^^
8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1->
>
2 >}
3 >
4 > Q
5 >
6 > Q
7 > {
> function P() {
> // Test this
> var a = 1;
> }
> }
1->Emitted(7, 1) Source(6, 1) + SourceIndex(0) name (Q)
2 >Emitted(7, 2) Source(6, 2) + SourceIndex(0) name (Q)
3 >Emitted(7, 4) Source(1, 8) + SourceIndex(0)
4 >Emitted(7, 5) Source(1, 9) + SourceIndex(0)
5 >Emitted(7, 10) Source(1, 8) + SourceIndex(0)
6 >Emitted(7, 11) Source(1, 9) + SourceIndex(0)
7 >Emitted(7, 19) Source(6, 2) + SourceIndex(0)
---
>>>//# sourceMappingURL=sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map

View file

@ -0,0 +1,12 @@
=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts ===
module Q {
>Q : Symbol(Q, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 0))
function P() {
>P : Symbol(P, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 0, 10))
// Test this
var a = 1;
>a : Symbol(a, Decl(sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts, 3, 11))
}
}

View file

@ -0,0 +1,13 @@
=== tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts ===
module Q {
>Q : typeof Q
function P() {
>P : () => void
// Test this
var a = 1;
>a : number
>1 : number
}
}

View file

@ -0,0 +1,12 @@
//// [sourceMapForFunctionWithCommentPrecedingStatement01.ts]
function P() {
// Test this
var a = 1;
}
//// [sourceMapForFunctionWithCommentPrecedingStatement01.js]
function P() {
// Test this
var a = 1;
}
//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map

View file

@ -0,0 +1,2 @@
//// [sourceMapForFunctionWithCommentPrecedingStatement01.js.map]
{"version":3,"file":"sourceMapForFunctionWithCommentPrecedingStatement01.js","sourceRoot":"","sources":["sourceMapForFunctionWithCommentPrecedingStatement01.ts"],"names":["P"],"mappings":"AAAA;IAEIA,AADAA,YAAYA;QACRA,CAACA,GAAGA,CAACA,CAACA;AACdA,CAACA"}

View file

@ -0,0 +1,58 @@
===================================================================
JsFile: sourceMapForFunctionWithCommentPrecedingStatement01.js
mapUrl: sourceMapForFunctionWithCommentPrecedingStatement01.js.map
sourceRoot:
sources: sourceMapForFunctionWithCommentPrecedingStatement01.ts
===================================================================
-------------------------------------------------------------------
emittedFile:tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.js
sourceFile:sourceMapForFunctionWithCommentPrecedingStatement01.ts
-------------------------------------------------------------------
>>>function P() {
1 >
2 >^^^^^^^^^^^^^^^^^->
1 >
1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0)
---
>>> // Test this
1->^^^^
2 >
3 > ^^^^^^^^^^^^
1->function P() {
> // Test this
>
2 >
3 > // Test this
1->Emitted(2, 5) Source(3, 5) + SourceIndex(0) name (P)
2 >Emitted(2, 5) Source(2, 5) + SourceIndex(0) name (P)
3 >Emitted(2, 17) Source(2, 17) + SourceIndex(0) name (P)
---
>>> var a = 1;
1 >^^^^^^^^
2 > ^
3 > ^^^
4 > ^
5 > ^
1 >
> var
2 > a
3 > =
4 > 1
5 > ;
1 >Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (P)
2 >Emitted(3, 10) Source(3, 10) + SourceIndex(0) name (P)
3 >Emitted(3, 13) Source(3, 13) + SourceIndex(0) name (P)
4 >Emitted(3, 14) Source(3, 14) + SourceIndex(0) name (P)
5 >Emitted(3, 15) Source(3, 15) + SourceIndex(0) name (P)
---
>>>}
1 >
2 >^
3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^->
1 >
>
2 >}
1 >Emitted(4, 1) Source(4, 1) + SourceIndex(0) name (P)
2 >Emitted(4, 2) Source(4, 2) + SourceIndex(0) name (P)
---
>>>//# sourceMappingURL=sourceMapForFunctionWithCommentPrecedingStatement01.js.map

View file

@ -0,0 +1,8 @@
=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts ===
function P() {
>P : Symbol(P, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 0, 0))
// Test this
var a = 1;
>a : Symbol(a, Decl(sourceMapForFunctionWithCommentPrecedingStatement01.ts, 2, 7))
}

View file

@ -0,0 +1,9 @@
=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts ===
function P() {
>P : () => void
// Test this
var a = 1;
>a : number
>1 : number
}

View file

@ -0,0 +1,7 @@
//@sourceMap: true
module Q {
function P() {
// Test this
var a = 1;
}
}

View file

@ -0,0 +1,5 @@
//@sourceMap: true
function P() {
// Test this
var a = 1;
}