| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library polymer.test.build.build_log_combiner_test; | 5 library polymer.test.build.build_log_combiner_test; |
| 6 | 6 |
| 7 import 'package:code_transformers/messages/build_logger.dart' show |
| 8 LOG_EXTENSION; |
| 9 import 'package:polymer/src/build/build_log_combiner.dart'; |
| 7 import 'package:polymer/src/build/common.dart'; | 10 import 'package:polymer/src/build/common.dart'; |
| 8 import 'package:polymer/src/build/build_log_combiner.dart'; | |
| 9 import 'package:unittest/compact_vm_config.dart'; | 11 import 'package:unittest/compact_vm_config.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
| 11 | 13 |
| 12 import 'common.dart'; | 14 import 'common.dart'; |
| 13 | 15 |
| 14 final options = new TransformOptions(injectBuildLogsInOutput: true); | 16 final options = new TransformOptions(injectBuildLogsInOutput: true); |
| 15 final phases = [[new BuildLogCombiner(options)]]; | 17 final phases = [[new BuildLogCombiner(options)]]; |
| 16 | 18 |
| 17 void main() { | 19 void main() { |
| 18 useCompactVMConfiguration(); | 20 useCompactVMConfiguration(); |
| 19 | 21 |
| 20 testPhases('combines multiple logs', phases, { | 22 testPhases('combines multiple logs', phases, { |
| 21 'a|web/test.html': '<!DOCTYPE html><html></html>', | 23 'a|web/test.html': '<!DOCTYPE html><html></html>', |
| 22 'a|web/test.html$LOG_EXTENSION.1': '[${_logString('Info', 'foo')}]', | 24 'a|web/test.html$LOG_EXTENSION.1': |
| 23 'a|web/test.html$LOG_EXTENSION.2': '[${_logString('Warning', 'bar')}]', | 25 '{"foo#0":[${_logString('Info', 0, 'foo')}]}', |
| 24 'a|web/test.html$LOG_EXTENSION.3': '[${_logString('Error', 'baz')}]', | 26 'a|web/test.html$LOG_EXTENSION.2': |
| 27 '{"foo#2":[${_logString('Warning', 2, 'bar')}]}', |
| 28 'a|web/test.html$LOG_EXTENSION.3': |
| 29 '{' |
| 30 '"foo#2":[${_logString('Error', 2, 'baz1')}],' |
| 31 '"foo#44":[${_logString('Error', 44, 'baz2')}]' |
| 32 '}', |
| 25 }, { | 33 }, { |
| 26 'a|web/test.html': '<!DOCTYPE html><html></html>', | 34 'a|web/test.html': '<!DOCTYPE html><html></html>', |
| 27 'a|web/test.html$LOG_EXTENSION': | 35 'a|web/test.html$LOG_EXTENSION': '{' |
| 28 '[${_logString('Info', 'foo')},' | 36 '"foo#0":[${_logString('Info', 0, 'foo')}],' |
| 29 '${_logString('Warning', 'bar')},' | 37 '"foo#2":[${_logString('Warning', 2, 'bar')},' |
| 30 '${_logString('Error', 'baz')}]', | 38 '${_logString('Error', 2, 'baz1')}],' |
| 39 '"foo#44":[${_logString('Error', 44, 'baz2')}]' |
| 40 '}', |
| 31 }); | 41 }); |
| 32 } | 42 } |
| 33 | 43 |
| 34 String _logString(String level, String message) => | 44 String _logString(String level, int id, String message) => |
| 35 '{"level":"$level","message":"$message"}'; | 45 '{"level":"$level","message":{"id":"foo#$id","snippet":"$message"}}'; |
| OLD | NEW |