diff --git a/lectures/04-testing/httptest/main.go b/lectures/04-testing/httptest/main.go index 4179878..39afd03 100644 --- a/lectures/04-testing/httptest/main.go +++ b/lectures/04-testing/httptest/main.go @@ -10,7 +10,7 @@ import ( func main() { handler := func(w http.ResponseWriter, r *http.Request) { - io.WriteString(w, "Hello World!") + _, _ = io.WriteString(w, "Hello World!") } req := httptest.NewRequest("GET", "http://example.com/foo", nil) diff --git a/lectures/04-testing/mocks/mocks.go b/lectures/04-testing/mocks/mocks.go index bf6d244..a8e3a18 100644 --- a/lectures/04-testing/mocks/mocks.go +++ b/lectures/04-testing/mocks/mocks.go @@ -1,9 +1,18 @@ +package mocks + import ( "fmt" "log" "net/smtp" ) +var sender, password, hostname string +var template = "%d. %d%% of your quota" + +func bytesInUse(username string) int { + return 10000000000 +} + var notifyUser = doNotifyUser func doNotifyUser(username, msg string) { diff --git a/lectures/04-testing/mocks/mocks_test.go b/lectures/04-testing/mocks/mocks_test.go index c3ebd49..ca07dd7 100644 --- a/lectures/04-testing/mocks/mocks_test.go +++ b/lectures/04-testing/mocks/mocks_test.go @@ -1,3 +1,5 @@ +package mocks + import ( "strings" "testing"