Hello MQTT

main
Drew Bednar 4 months ago
parent ab61c0be40
commit 6d291906e7

@ -0,0 +1,3 @@
module git.runcible.io/learning/learn_mqtt_go
go 1.23.1

@ -0,0 +1,15 @@
package main
import (
"fmt"
"io"
"os"
)
func printMessage(w io.Writer, msg string) {
fmt.Fprint(w, msg)
}
func main() {
printMessage(os.Stdout, "Hello MQTT\n")
}

@ -0,0 +1,17 @@
package main
import (
"bytes"
"testing"
)
func TestPrintMessage(t *testing.T) {
buffer := bytes.Buffer{}
printMessage(&buffer, "Hello MQTT\n")
got := buffer.String()
want := "Hello MQTT\n"
if got != want {
t.Errorf("Error. Got %s but wanted %s", got, want)
}
}
Loading…
Cancel
Save