OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library usage.usage_test; |
| 6 |
| 7 import 'package:unittest/unittest.dart'; |
| 8 import 'package:usage/usage.dart'; |
| 9 |
| 10 void defineTests() { |
| 11 group('AnalyticsMock', () { |
| 12 test('simple', () { |
| 13 AnalyticsMock mock = new AnalyticsMock(); |
| 14 mock.sendScreenView('main'); |
| 15 mock.sendEvent('files', 'save'); |
| 16 mock.sendSocial('g+', 'plus', 'userid'); |
| 17 mock.sendTiming('compile', 123); |
| 18 mock.startTimer('compile').finish(); |
| 19 mock.sendException('FooException'); |
| 20 mock.setSessionValue('val', 'ue'); |
| 21 return mock.waitForLastPing(); |
| 22 }); |
| 23 }); |
| 24 |
| 25 group('sanitizeStacktrace', () { |
| 26 test('replace file', () { |
| 27 expect(sanitizeStacktrace( |
| 28 '(file:///Users/foo/tmp/error.dart:3:13)', |
| 29 shorten: false), |
| 30 '(error.dart:3:13)'); |
| 31 }); |
| 32 |
| 33 test('replace files', () { |
| 34 expect(sanitizeStacktrace( |
| 35 'foo (file:///Users/foo/tmp/error.dart:3:13)\n' |
| 36 'bar (file:///Users/foo/tmp/error.dart:3:13)', |
| 37 shorten: false), |
| 38 'foo (error.dart:3:13)\nbar (error.dart:3:13)'); |
| 39 }); |
| 40 |
| 41 test('shorten 1', () { |
| 42 expect(sanitizeStacktrace( |
| 43 '(file:///Users/foo/tmp/error.dart:3:13)'), |
| 44 '(error.dart:3:13)'); |
| 45 }); |
| 46 |
| 47 test('shorten 2', () { |
| 48 expect(sanitizeStacktrace( |
| 49 'foo (file:///Users/foo/tmp/error.dart:3:13)\n' |
| 50 'bar (file:///Users/foo/tmp/error.dart:3:13)'), |
| 51 'foo (error.dart:3:13) bar (error.dart:3:13)'); |
| 52 }); |
| 53 |
| 54 test('shorten 3', () { |
| 55 expect(sanitizeStacktrace( |
| 56 'foo (package:foo/foo.dart:3:13)\n' |
| 57 'bar (dart:async/schedule_microtask.dart:41)'), |
| 58 'foo (foo/foo.dart:3:13) bar (async/schedule_microtask.dart:41)'); |
| 59 }); |
| 60 }); |
| 61 } |
OLD | NEW |