From 989968013e47c1fdcfd38dc50cd1f34487d84411 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 21 Apr 2015 13:42:53 -0700 Subject: [PATCH] Added tests from original issue. --- ...alModuleWithCommentPrecedingStatement01.js | 17 +++ ...duleWithCommentPrecedingStatement01.js.map | 2 + ...hCommentPrecedingStatement01.sourcemap.txt | 127 ++++++++++++++++++ ...uleWithCommentPrecedingStatement01.symbols | 12 ++ ...oduleWithCommentPrecedingStatement01.types | 13 ++ ...FunctionWithCommentPrecedingStatement01.js | 12 ++ ...tionWithCommentPrecedingStatement01.js.map | 2 + ...hCommentPrecedingStatement01.sourcemap.txt | 58 ++++++++ ...ionWithCommentPrecedingStatement01.symbols | 8 ++ ...ctionWithCommentPrecedingStatement01.types | 9 ++ ...alModuleWithCommentPrecedingStatement01.ts | 7 + ...FunctionWithCommentPrecedingStatement01.ts | 5 + 12 files changed, 272 insertions(+) create mode 100644 tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js create mode 100644 tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map create mode 100644 tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols create mode 100644 tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types create mode 100644 tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js create mode 100644 tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map create mode 100644 tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt create mode 100644 tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols create mode 100644 tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types create mode 100644 tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts create mode 100644 tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js new file mode 100644 index 00000000000..4e894fb99ad --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js @@ -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 \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map new file mode 100644 index 00000000000..217105d88d2 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.js.map @@ -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"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt new file mode 100644 index 00000000000..669481b46a2 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.sourcemap.txt @@ -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 \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols new file mode 100644 index 00000000000..285a6a0ad92 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.symbols @@ -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)) + } +} diff --git a/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types new file mode 100644 index 00000000000..db4f2c320b4 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.types @@ -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 + } +} diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js new file mode 100644 index 00000000000..885ece077d7 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js @@ -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 \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map new file mode 100644 index 00000000000..7a84caf3879 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.js.map @@ -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"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt new file mode 100644 index 00000000000..cbeed192d31 --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.sourcemap.txt @@ -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 \ No newline at end of file diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols new file mode 100644 index 00000000000..b9f50a929af --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.symbols @@ -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)) +} diff --git a/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types new file mode 100644 index 00000000000..5e3d01a6b5b --- /dev/null +++ b/tests/baselines/reference/sourceMapForFunctionWithCommentPrecedingStatement01.types @@ -0,0 +1,9 @@ +=== tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts === +function P() { +>P : () => void + + // Test this + var a = 1; +>a : number +>1 : number +} diff --git a/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts b/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts new file mode 100644 index 00000000000..d12e894b0a9 --- /dev/null +++ b/tests/cases/compiler/sourceMapForFunctionInInternalModuleWithCommentPrecedingStatement01.ts @@ -0,0 +1,7 @@ +//@sourceMap: true +module Q { + function P() { + // Test this + var a = 1; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts b/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts new file mode 100644 index 00000000000..e883b202ca1 --- /dev/null +++ b/tests/cases/compiler/sourceMapForFunctionWithCommentPrecedingStatement01.ts @@ -0,0 +1,5 @@ +//@sourceMap: true +function P() { + // Test this + var a = 1; +} \ No newline at end of file