LCOV - code coverage report
Current view: top level - pebble/internal/testutils - errors.go (source / functions) Hit Total Coverage
Test: 2024-07-02 08:16Z 4981bd0e - meta test only.lcov Lines: 0 8 0.0 %
Date: 2024-07-02 08:16:53 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2024 The LevelDB-Go and Pebble Authors. All rights reserved. Use
       2             : // of this source code is governed by a BSD-style license that can be found in
       3             : // the LICENSE file.
       4             : 
       5             : package testutils
       6             : 
       7             : // CheckErr can be used to simplify test code that expects no errors.
       8             : // Instead of:
       9             : //
      10             : //      v, err := SomeFunc()
      11             : //      if err != nil { .. }
      12             : //
      13             : // we can use:
      14             : //
      15             : //      v := testutils.CheckErr(someFunc())
      16           0 : func CheckErr[V any](v V, err error) V {
      17           0 :         if err != nil {
      18           0 :                 panic(err)
      19             :         }
      20           0 :         return v
      21             : }
      22             : 
      23             : // CheckErr2 can be used to simplify test code that expects no errors.
      24             : // Instead of:
      25             : //
      26             : //      v, w, err := SomeFunc()
      27             : //      if err != nil { .. }
      28             : //
      29             : // we can use:
      30             : //
      31             : //      v, w := testutils.CheckErr2(someFunc())
      32           0 : func CheckErr2[V any, W any](v V, w W, err error) (V, W) {
      33           0 :         if err != nil {
      34           0 :                 panic(err)
      35             :         }
      36           0 :         return v, w
      37             : }

Generated by: LCOV version 1.14