如何测试Go的“测试”包功能?

I'm writing a library of testing utility functions and I would like them to be themselves tested.

An example of one such function is:

func IsShwifty(t *testing.T, foo string) bool {
    result, err := bar.MyFunction(string)
    if err != nil {
      t.Error("Failed to get shwifty: " + foo, err)
    }
    return result == "shwifty"
}

I would like to write a TestIsShwifty that feeds in something to make MyFunction return an error and then make t.Error. Then, I want to have the TestIsShwifty pass with something like:

func TestIsShwifty(t *testing.T) {
  if doesError(t, IsShwifty(t)) == false {
    t.Error("Oh know! We didn't error!")
  }
}

Is this possible in Go?

I figured it out!

I just needed to create a separate instance of testing.T.

func TestIsShwifty(t *testing.T) {
  newT := testing.T{}
  IsShwifty(newT)
  if newT.Failed() == false {
    t.Error("Test should have failed")
  }
}