github.com/ipld/go-ipld-prime@v0.21.0/node/tests/testutil.go (about)

     1  package tests
     2  
     3  import (
     4  	"github.com/ipld/go-ipld-prime/datamodel"
     5  )
     6  
     7  // This file is full of helper functions.  Most are moderately embarassing.
     8  //
     9  // We should probably turn half of this into Wish Checkers;
    10  //  they'd probably be much less fragile and give better error messages that way.
    11  //  On the other hand, the functions for condensing two-arg returns wouldn't go away anyway.
    12  
    13  // various benchmarks assign their final result here,
    14  // in order to defuse the possibility of their work being elided.
    15  var sink interface{} //lint:ignore U1000 used by benchmarks
    16  
    17  // purely to syntactically flip large inline closures so we can see the argument at the top rather than the bottom of the block.
    18  func withNode(n datamodel.Node, cb func(n datamodel.Node)) {
    19  	cb(n)
    20  }