LCOV - code coverage report
Current view: top level - Users/duwen/Documents/code/dio/dio/test - exception_test.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 11 13 84.6 %
Date: 2021-11-28 14:37:50 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:dio/dio.dart';
       2             : import 'package:test/test.dart';
       3             : 
       4           1 : void main() {
       5           2 :   test('catch DioError', () async {
       6             :     dynamic error;
       7             : 
       8             :     try {
       9           3 :       await Dio().get('https://does.not.exist');
      10           0 :       fail('did not throw');
      11           1 :     } on DioError catch (e) {
      12             :       error = e;
      13             :     }
      14             : 
      15           1 :     expect(error, isNotNull);
      16           2 :     expect(error is Exception, isTrue);
      17             :   });
      18             : 
      19           2 :   test('catch DioError as Exception', () async {
      20             :     dynamic error;
      21             : 
      22             :     try {
      23           3 :       await Dio().get('https://does.not.exist');
      24           0 :       fail('did not throw');
      25           1 :     } on Exception catch (e) {
      26             :       error = e;
      27             :     }
      28             : 
      29           1 :     expect(error, isNotNull);
      30           2 :     expect(error is Exception, isTrue);
      31             :   });
      32             : }

Generated by: LCOV version 1.14