breto

A status bar written in Go.
Log | Files | Refs | README | LICENSE

commit cb8f9063931c6fbbf961c6bc87b937fc5cd9c364
parent 6561f4e0d5807cdfed0dcc4871abbbd041d3f650
Author: Jaron Swab <jrswab@gmail.com>
Date:   Sat,  1 Jun 2019 11:33:54 -0400

Added
Also updated the test to check for an empty string

Diffstat:
Mwttr/wttr.go | 1+
Mwttr/wttr_test.go | 4++--
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/wttr/wttr.go b/wttr/wttr.go @@ -29,6 +29,7 @@ func Local(cWttr chan string, eWttr chan error) { // convert responce to string for go channel weather := fmt.Sprintf("%s | ", strings.TrimSpace(string(bodyData))) + resp.Body.Close() cWttr <- weather } } diff --git a/wttr/wttr_test.go b/wttr/wttr_test.go @@ -1,7 +1,6 @@ package wttr import ( - "fmt" "testing" ) @@ -23,6 +22,7 @@ func TestLocal(t *testing.T) { if wttrError != nil { t.Error("Expected Weather Data got:", wttrError.Error()) + } else if weather == " | " { + t.Error("Weather channel sent an empty string.") } - fmt.Println(weather) }