@@ -11,18 +11,18 @@ import 'package:source_map_stack_trace/source_map_stack_trace.dart';
1111import 'package:test/test.dart' ;
1212
1313/// A simple [Mapping] for tests that don't need anything special.
14- final _simpleMapping = parseJson ((new SourceMapBuilder ()
14+ final _simpleMapping = parseJson ((SourceMapBuilder ()
1515 ..addSpan (
16- new SourceMapSpan .identifier (
17- new SourceLocation (1 , line: 1 , column: 3 , sourceUrl: "foo.dart" ),
16+ SourceMapSpan .identifier (
17+ SourceLocation (1 , line: 1 , column: 3 , sourceUrl: "foo.dart" ),
1818 "qux" ),
19- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
20- new SourceLocation (18 , line: 15 , column: 0 ), "\n " * 10 )))
19+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
20+ SourceLocation (18 , line: 15 , column: 0 ), "\n " * 10 )))
2121 .build ("foo.dart.js.map" ));
2222
2323void main () {
2424 test ("maps a JS line and column to a Dart line and span" , () {
25- var trace = new Trace .parse ("foo.dart.js 10:11 foo" );
25+ var trace = Trace .parse ("foo.dart.js 10:11 foo" );
2626 var frame = _mapTrace (_simpleMapping, trace).frames.first;
2727 expect (frame.uri, equals (Uri .parse ("foo.dart" )));
2828
@@ -33,7 +33,7 @@ void main() {
3333 });
3434
3535 test ("ignores JS frames without line info" , () {
36- var trace = new Trace .parse ("""
36+ var trace = Trace .parse ("""
3737foo.dart.js 10:11 foo
3838foo.dart.js bar
3939foo.dart.js 10:11 baz
@@ -46,7 +46,7 @@ foo.dart.js 10:11 baz
4646 });
4747
4848 test ("ignores JS frames without corresponding spans" , () {
49- var trace = new Trace .parse ("""
49+ var trace = Trace .parse ("""
5050foo.dart.js 10:11 foo
5151foo.dart.js 1:1 bar
5252foo.dart.js 10:11 baz
@@ -60,37 +60,37 @@ foo.dart.js 10:11 baz
6060 });
6161
6262 test ("include frames from JS files not covered by the source map bundle" , () {
63- var trace = new Trace .parse ("""
63+ var trace = Trace .parse ("""
6464foo.dart.js 10:11 foo
6565jquery.js 10:1 foo
6666bar.dart.js 10:11 foo
6767""" );
68- var builder = new SourceMapBuilder ()
68+ var builder = SourceMapBuilder ()
6969 ..addSpan (
70- new SourceMapSpan .identifier (
71- new SourceLocation (1 ,
70+ SourceMapSpan .identifier (
71+ SourceLocation (1 ,
7272 line: 1 , column: 3 , sourceUrl: "packages/foo/foo.dart" ),
7373 "qux" ),
74- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
75- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
74+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
75+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
7676 var sourceMapJson1 = builder.build ("foo.dart.js.map" );
7777 sourceMapJson1['file' ] = "foo.dart.js" ;
7878
79- builder = new SourceMapBuilder ()
79+ builder = SourceMapBuilder ()
8080 ..addSpan (
81- new SourceMapSpan .identifier (
82- new SourceLocation (1 ,
81+ SourceMapSpan .identifier (
82+ SourceLocation (1 ,
8383 line: 1 , column: 3 , sourceUrl: "packages/bar/bar.dart" ),
8484 "qux" ),
85- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
86- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
85+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
86+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
8787 var sourceMapJson2 = builder.build ("bar.dart.js.map" );
8888 sourceMapJson2['file' ] = "bar.dart.js" ;
8989
9090 var bundle = [sourceMapJson1, sourceMapJson2];
9191 var mapping = parseJsonExtended (bundle);
9292 var frames = _mapTrace (mapping, trace,
93- packageResolver: new SyncPackageResolver .root ("packages/" ))
93+ packageResolver: SyncPackageResolver .root ("packages/" ))
9494 .frames;
9595
9696 expect (frames.length, equals (3 ));
@@ -111,14 +111,14 @@ bar.dart.js 10:11 foo
111111 });
112112
113113 test ("falls back to column 0 for unlisted column" , () {
114- var trace = new Trace .parse ("foo.dart.js 10 foo" );
115- var builder = new SourceMapBuilder ()
114+ var trace = Trace .parse ("foo.dart.js 10 foo" );
115+ var builder = SourceMapBuilder ()
116116 ..addSpan (
117- new SourceMapSpan .identifier (
118- new SourceLocation (1 , line: 1 , column: 3 , sourceUrl: "foo.dart" ),
117+ SourceMapSpan .identifier (
118+ SourceLocation (1 , line: 1 , column: 3 , sourceUrl: "foo.dart" ),
119119 "qux" ),
120- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
121- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
120+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
121+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
122122
123123 var mapping = parseJson (builder.build ("foo.dart.js.map" ));
124124 var frame = _mapTrace (mapping, trace).frames.first;
@@ -128,15 +128,15 @@ bar.dart.js 10:11 foo
128128 });
129129
130130 test ("uses package: URIs for frames within packageRoot" , () {
131- var trace = new Trace .parse ("foo.dart.js 10 foo" );
132- var builder = new SourceMapBuilder ()
131+ var trace = Trace .parse ("foo.dart.js 10 foo" );
132+ var builder = SourceMapBuilder ()
133133 ..addSpan (
134- new SourceMapSpan .identifier (
135- new SourceLocation (1 ,
134+ SourceMapSpan .identifier (
135+ SourceLocation (1 ,
136136 line: 1 , column: 3 , sourceUrl: "packages/foo/foo.dart" ),
137137 "qux" ),
138- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
139- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
138+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
139+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
140140
141141 var mapping = parseJson (builder.build ("foo.dart.js.map" ));
142142 var frame =
@@ -147,19 +147,19 @@ bar.dart.js 10:11 foo
147147 });
148148
149149 test ("uses package: URIs for frames within packageResolver.packageRoot" , () {
150- var trace = new Trace .parse ("foo.dart.js 10 foo" );
151- var builder = new SourceMapBuilder ()
150+ var trace = Trace .parse ("foo.dart.js 10 foo" );
151+ var builder = SourceMapBuilder ()
152152 ..addSpan (
153- new SourceMapSpan .identifier (
154- new SourceLocation (1 ,
153+ SourceMapSpan .identifier (
154+ SourceLocation (1 ,
155155 line: 1 , column: 3 , sourceUrl: "packages/foo/foo.dart" ),
156156 "qux" ),
157- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
158- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
157+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
158+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
159159
160160 var mapping = parseJson (builder.build ("foo.dart.js.map" ));
161161 var mappedTrace = _mapTrace (mapping, trace,
162- packageResolver: new SyncPackageResolver .root ("packages/" ));
162+ packageResolver: SyncPackageResolver .root ("packages/" ));
163163 var frame = mappedTrace.frames.first;
164164 expect (frame.uri, equals (Uri .parse ("package:foo/foo.dart" )));
165165 expect (frame.line, equals (2 ));
@@ -168,36 +168,36 @@ bar.dart.js 10:11 foo
168168
169169 test ("uses package: URIs for frames within a packageResolver.packageMap URL" ,
170170 () {
171- var trace = new Trace .parse ("foo.dart.js 10 foo" );
172- var builder = new SourceMapBuilder ()
171+ var trace = Trace .parse ("foo.dart.js 10 foo" );
172+ var builder = SourceMapBuilder ()
173173 ..addSpan (
174- new SourceMapSpan .identifier (
175- new SourceLocation (1 ,
174+ SourceMapSpan .identifier (
175+ SourceLocation (1 ,
176176 line: 1 , column: 3 , sourceUrl: "packages/foo/foo.dart" ),
177177 "qux" ),
178- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
179- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
178+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
179+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
180180
181181 var mapping = parseJson (builder.build ("foo.dart.js.map" ));
182182 var mappedTrace = _mapTrace (mapping, trace,
183183 packageResolver:
184- new SyncPackageResolver .config ({"foo" : Uri .parse ("packages/foo" )}));
184+ SyncPackageResolver .config ({"foo" : Uri .parse ("packages/foo" )}));
185185 var frame = mappedTrace.frames.first;
186186 expect (frame.uri, equals (Uri .parse ("package:foo/foo.dart" )));
187187 expect (frame.line, equals (2 ));
188188 expect (frame.column, equals (4 ));
189189 });
190190
191191 test ("uses dart: URIs for frames within sdkRoot" , () {
192- var trace = new Trace .parse ("foo.dart.js 10 foo" );
193- var builder = new SourceMapBuilder ()
192+ var trace = Trace .parse ("foo.dart.js 10 foo" );
193+ var builder = SourceMapBuilder ()
194194 ..addSpan (
195- new SourceMapSpan .identifier (
196- new SourceLocation (1 ,
195+ SourceMapSpan .identifier (
196+ SourceLocation (1 ,
197197 line: 1 , column: 3 , sourceUrl: "sdk/lib/async/foo.dart" ),
198198 "qux" ),
199- new SourceSpan (new SourceLocation (8 , line: 5 , column: 0 ),
200- new SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
199+ SourceSpan (SourceLocation (8 , line: 5 , column: 0 ),
200+ SourceLocation (12 , line: 9 , column: 1 ), "\n " * 4 ));
201201
202202 var mapping = parseJson (builder.build ("foo.dart.js.map" ));
203203 var frame = _mapTrace (mapping, trace, sdkRoot: "sdk/" ).frames.first;
@@ -207,9 +207,9 @@ bar.dart.js 10:11 foo
207207 });
208208
209209 test ("converts a stack chain" , () {
210- var trace = new Chain ([
211- new Trace .parse ("foo.dart.js 10:11 foo" ),
212- new Trace .parse ("foo.dart.js 10:11 bar" )
210+ var trace = Chain ([
211+ Trace .parse ("foo.dart.js 10:11 foo" ),
212+ Trace .parse ("foo.dart.js 10:11 bar" )
213213 ]);
214214 var traces = _mapChain (_simpleMapping, trace).traces;
215215
@@ -282,11 +282,11 @@ bar.dart.js 10:11 foo
282282/// Like [mapStackTrace] , but is guaranteed to return a [Trace] so it can be
283283/// inspected.
284284Trace _mapTrace (Mapping sourceMap, StackTrace stackTrace,
285- {bool minified: false ,
285+ {bool minified = false ,
286286 SyncPackageResolver packageResolver,
287287 sdkRoot,
288288 packageRoot}) {
289- return new Trace .from (mapStackTrace (sourceMap, stackTrace,
289+ return Trace .from (mapStackTrace (sourceMap, stackTrace,
290290 minified: minified,
291291 packageResolver: packageResolver,
292292 sdkRoot: sdkRoot,
@@ -296,11 +296,11 @@ Trace _mapTrace(Mapping sourceMap, StackTrace stackTrace,
296296/// Like [mapStackTrace] , but is guaranteed to return a [Chain] so it can be
297297/// inspected.
298298Chain _mapChain (Mapping sourceMap, StackTrace stackTrace,
299- {bool minified: false ,
299+ {bool minified = false ,
300300 SyncPackageResolver packageResolver,
301301 sdkRoot,
302302 packageRoot}) {
303- return new Chain .forTrace (mapStackTrace (sourceMap, stackTrace,
303+ return Chain .forTrace (mapStackTrace (sourceMap, stackTrace,
304304 minified: minified,
305305 packageResolver: packageResolver,
306306 sdkRoot: sdkRoot,
@@ -309,6 +309,6 @@ Chain _mapChain(Mapping sourceMap, StackTrace stackTrace,
309309
310310/// Runs the mapper's prettification logic on [member] and returns the result.
311311String _prettify (String member) {
312- var trace = new Trace ([new Frame (Uri .parse ("foo.dart.js" ), 10 , 11 , member)]);
312+ var trace = Trace ([Frame (Uri .parse ("foo.dart.js" ), 10 , 11 , member)]);
313313 return _mapTrace (_simpleMapping, trace).frames.first.member;
314314}
0 commit comments