github.com/ethersphere/bee/v2@v2.2.0/pkg/util/abiutil/abiutil_test.go (about)

     1  // Copyright 2022 The Swarm Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package abiutil
     6  
     7  import (
     8  	"strings"
     9  	"testing"
    10  )
    11  
    12  func TestMustParseABI(t *testing.T) {
    13  	t.Parallel()
    14  
    15  	defer func() {
    16  		switch err := recover(); {
    17  		case err == nil:
    18  			t.Error("expected panic")
    19  		case !strings.Contains(err.(error).Error(), "unable to parse ABI:"):
    20  			t.Errorf("unexpected panic: %v", err)
    21  		}
    22  	}()
    23  
    24  	MustParseABI("invalid abi")
    25  }