OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override |
| 5 |
| 6 import 'dart:developer' as developer; |
| 7 import 'package:observatory/service_io.dart'; |
| 8 import 'package:unittest/unittest.dart'; |
| 9 import 'package:logging/logging.dart'; |
| 10 |
| 11 import 'test_helper.dart'; |
| 12 |
| 13 void init() { |
| 14 Logger.root.level = Level.ALL; |
| 15 Logger.root.onRecord.listen(developer.logOnRecord); |
| 16 } |
| 17 |
| 18 void run() { |
| 19 developer.debugger(); |
| 20 Logger.root.fine('Hey Buddy!'); |
| 21 developer.debugger(); |
| 22 Logger.root.info('YES'); |
| 23 } |
| 24 |
| 25 var tests = [ |
| 26 hasStoppedAtBreakpoint, |
| 27 resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { |
| 28 expect(event.kind, equals(ServiceEvent.kLogging)); |
| 29 expect(event.logRecord['sequenceNumber'], equals(0)); |
| 30 expect(event.logRecord['message'].valueAsString, equals('Hey Buddy!')); |
| 31 expect(event.logRecord['level'], equals(Level.FINE)); |
| 32 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); |
| 33 }), |
| 34 resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { |
| 35 expect(event.kind, equals(ServiceEvent.kLogging)); |
| 36 expect(event.logRecord['sequenceNumber'], equals(1)); |
| 37 expect(event.logRecord['level'], equals(Level.INFO)); |
| 38 expect(event.logRecord['message'].valueAsString, equals('YES')); |
| 39 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); |
| 40 }), |
| 41 ]; |
| 42 |
| 43 main(args) => runIsolateTests(args, |
| 44 tests, |
| 45 testeeBefore: init, |
| 46 testeeConcurrent: run); |
OLD | NEW |