Skip to content

Instantly share code, notes, and snippets.

@bluesalt
Created September 24, 2012 14:13
Show Gist options
  • Save bluesalt/3776150 to your computer and use it in GitHub Desktop.
Save bluesalt/3776150 to your computer and use it in GitHub Desktop.
package main
import (
. "launchpad.net/gocheck"
"testing"
)
func Test(t *testing.T) {
TestingT(t)
}
type MySuite struct{}
var _ = Suite(&MySuite{})
type IFoobar interface {
foobar()
}
type Foobar struct {
}
func (f *Foobar) foobar() {
}
func (s *MySuite) TestFoobar(c *C) {
v := Foobar{}
var i interface{} = v
_, ok := i.(IFoobar)
c.Assert(ok, Equals, false)
var p interface{} = &v
_, ok = p.(IFoobar)
c.Assert(ok, Equals, true)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment