From 97f2f952a60ebdf3a344a8d8ecf6a690c63a272b Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 24 Jan 2016 10:36:20 +0000 Subject: [PATCH] Fix tests to not expect mapping to span lines Following commit 699dff1a707e4ce8845f267668215bbf79d8eacd in source-map a generated mapping ends at EOL so the tests shouldn't rely on a lookup matched a mapping for a previous line. --- test.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test.js b/test.js index 52f2121..aa64d6f 100644 --- a/test.js +++ b/test.js @@ -46,6 +46,16 @@ function createSingleLineSourceMap() { return sourceMap; } +function createSecondLineSourceMap() { + var sourceMap = createEmptySourceMap(); + sourceMap.addMapping({ + generated: { line: 2, column: 0 }, + original: { line: 1, column: 0 }, + source: '.original.js' + }); + return sourceMap; +} + function createMultiLineSourceMap() { var sourceMap = createEmptySourceMap(); for (var i = 1; i <= 100; i++) { @@ -270,7 +280,7 @@ it('finds the last sourceMappingURL', function() { }); it('default options', function(done) { - compareStdout(done, createSingleLineSourceMap(), [ + compareStdout(done, createSecondLineSourceMap(), [ '', 'function foo() { throw new Error("this is the error"); }', 'require("./source-map-support").install();', @@ -286,7 +296,7 @@ it('default options', function(done) { }); it('handleUncaughtExceptions is true', function(done) { - compareStdout(done, createSingleLineSourceMap(), [ + compareStdout(done, createSecondLineSourceMap(), [ '', 'function foo() { throw new Error("this is the error"); }', 'require("./source-map-support").install({ handleUncaughtExceptions: true });', @@ -301,7 +311,7 @@ it('handleUncaughtExceptions is true', function(done) { }); it('handleUncaughtExceptions is false', function(done) { - compareStdout(done, createSingleLineSourceMap(), [ + compareStdout(done, createSecondLineSourceMap(), [ '', 'function foo() { throw new Error("this is the error"); }', 'require("./source-map-support").install({ handleUncaughtExceptions: false });', @@ -350,7 +360,7 @@ it('default options with source map with gap', function(done) { }); it('specifically requested error source', function(done) { - compareStdout(done, createSingleLineSourceMap(), [ + compareStdout(done, createSecondLineSourceMap(), [ '', 'function foo() { throw new Error("this is the error"); }', 'var sms = require("./source-map-support");',