...

Source file src/github.com/goph/emperror/handler_func_test.go

Documentation: github.com/goph/emperror

     1  package emperror
     2  
     3  import (
     4  	"errors"
     5  	"testing"
     6  )
     7  
     8  func TestHandlerFunc(t *testing.T) {
     9  	var actual error
    10  	log := func(err error) {
    11  		actual = err
    12  	}
    13  
    14  	fn := HandlerFunc(log)
    15  
    16  	expected := errors.New("error")
    17  
    18  	fn.Handle(expected)
    19  
    20  	if got, want := actual, expected; got != want {
    21  		t.Errorf("error does not match the expected one\nactual:   %s\nexpected: %s", got, want)
    22  	}
    23  }
    24  

View as plain text