LCOV - code coverage report
Current view: top level - string_scanner-1.0.2/lib/src - utils.dart (source / functions) Hit Total Coverage
Test: coverage.lcov Lines: 0 9 0.0 %
Date: 2017-10-10 20:17:03 Functions: 0 0 -

          Line data    Source code
       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             : /// Validates the arguments passed to [StringScanner.error].
       6             : void validateErrorArgs(String string, Match match, int position, int length) {
       7             :   if (match != null && (position != null || length != null)) {
       8           0 :     throw new ArgumentError("Can't pass both match and position/length.");
       9             :   }
      10             : 
      11             :   if (position != null) {
      12           0 :     if (position < 0) {
      13           0 :       throw new RangeError("position must be greater than or equal to 0.");
      14           0 :     } else if (position > string.length) {
      15           0 :       throw new RangeError("position must be less than or equal to the "
      16             :           "string length.");
      17             :     }
      18             :   }
      19             : 
      20           0 :   if (length != null && length < 0) {
      21           0 :     throw new RangeError("length must be greater than or equal to 0.");
      22             :   }
      23             : 
      24           0 :   if (position != null && length != null && position + length > string.length) {
      25           0 :     throw new RangeError("position plus length must not go beyond the end of "
      26             :         "the string.");
      27             :   }
      28             : }

Generated by: LCOV version 1.13