| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Test that options '--source-map' and '--out' correctly adds | 5 // Test that options '--source-map' and '--out' correctly adds |
| 6 // `sourceMappingURL` and "file" attributes to source file and source map file. | 6 // `sourceMappingURL` and "file" attributes to source file and source map file. |
| 7 | 7 |
| 8 library test.source_map; | 8 library test.source_map; |
| 9 | 9 |
| 10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 var compiler = compilerFor(SOURCE, | 42 var compiler = compilerFor(SOURCE, |
| 43 showDiagnostics: true, | 43 showDiagnostics: true, |
| 44 outputProvider: collector, | 44 outputProvider: collector, |
| 45 options: options); | 45 options: options); |
| 46 asyncTest(() => compiler.runCompiler(Uri.parse('memory:/main.dart')).then( | 46 asyncTest(() => compiler.runCompiler(Uri.parse('memory:/main.dart')).then( |
| 47 (_) { | 47 (_) { |
| 48 String jsOutput = collector.getOutput('', 'js'); | 48 String jsOutput = collector.getOutput('', 'js'); |
| 49 Expect.isNotNull(jsOutput); | 49 Expect.isNotNull(jsOutput); |
| 50 if (mapping != null) { | 50 if (mapping != null) { |
| 51 find(jsOutput, '//# sourceMappingURL=$mapping', true); | 51 find(jsOutput, '//# sourceMappingURL=$mapping', true); |
| 52 find(jsOutput, '//@ sourceMappingURL=$mapping', true); | |
| 53 } else { | 52 } else { |
| 54 find(jsOutput, '//# sourceMappingURL=', false); | 53 find(jsOutput, '//# sourceMappingURL=', false); |
| 55 find(jsOutput, '//@ sourceMappingURL=', false); | |
| 56 } | 54 } |
| 57 String jsSourceMapOutput = collector.getOutput('', 'js.map'); | 55 String jsSourceMapOutput = collector.getOutput('', 'js.map'); |
| 58 Expect.isNotNull(jsSourceMapOutput); | 56 Expect.isNotNull(jsSourceMapOutput); |
| 59 if (file != null) { | 57 if (file != null) { |
| 60 find(jsSourceMapOutput, '"file": "$file"', true); | 58 find(jsSourceMapOutput, '"file": "$file"', true); |
| 61 } else { | 59 } else { |
| 62 find(jsSourceMapOutput, '"file": ', false); | 60 find(jsSourceMapOutput, '"file": ', false); |
| 63 } | 61 } |
| 64 })); | 62 })); |
| 65 } | 63 } |
| 66 | 64 |
| 67 void main() { | 65 void main() { |
| 68 test(); | 66 test(); |
| 69 test(sourceMap: 'file:/out.js.map'); | 67 test(sourceMap: 'file:/out.js.map'); |
| 70 test(out: 'file:/out.js'); | 68 test(out: 'file:/out.js'); |
| 71 test(out: 'file:/out.js', sourceMap: 'file:/out.js.map', | 69 test(out: 'file:/out.js', sourceMap: 'file:/out.js.map', |
| 72 file: 'out.js', mapping: 'out.js.map'); | 70 file: 'out.js', mapping: 'out.js.map'); |
| 73 test(out: 'file:/dir/out.js', sourceMap: 'file:/dir/out.js.map', | 71 test(out: 'file:/dir/out.js', sourceMap: 'file:/dir/out.js.map', |
| 74 file: 'out.js', mapping: 'out.js.map'); | 72 file: 'out.js', mapping: 'out.js.map'); |
| 75 } | 73 } |
| OLD | NEW |