Skip to content

Instantly share code, notes, and snippets.

@talbright
Created May 30, 2014 19:58
Show Gist options
  • Save talbright/8d9560d510ff99a1612a to your computer and use it in GitHub Desktop.
Save talbright/8d9560d510ff99a1612a to your computer and use it in GitHub Desktop.
package desk
import (
"fmt"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestJsonBuilder(t *testing.T) {
fmt.Println("")
Convey("Builder",t,func() {
Convey("builds StructA",func() {
structa:=StructABuilder.SetString("Name","trent").BuildStructA()
So(*structa.Name,ShouldEqual,"trent")
})
Convey("builds StructB",func() {
structb:=StructBBuilder.SetString("Subject","unavoidable").BuildStructB()
So(*structb.Subject,ShouldEqual,"unavoidable")
})
Convey("builds StructC with dervived methods",func(){
structc:=StructCBuilder.
SetString("Subject","unavoidable").
SetBody("too sexy for my shirt").
BuildStructC()
So(*structc.Subject,ShouldEqual,"unavoidable")
So(*structc.Body,ShouldEqual,"too sexy for my shirt")
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment