Skip to content

Instantly share code, notes, and snippets.

@mprokopov
Created May 4, 2020 08:05
Show Gist options
  • Select an option

  • Save mprokopov/6a23d0a03c5d4fdbda62bcc33ad16116 to your computer and use it in GitHub Desktop.

Select an option

Save mprokopov/6a23d0a03c5d4fdbda62bcc33ad16116 to your computer and use it in GitHub Desktop.
// main.go
func SimpleFactory (host string) Simple {
return Simple{"Hello", "World", host}
}
// main_test.go
import "testing"
func TestSimpleFactory(t *testing.T) {
f := SimpleFactory("http://localhost")
if f.Url != "http://localhost" {
t.Errorf("feature incorrect, got %s, want: %s ", f.Url, "http://localhost")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment