From 4c1fb0ec5a288be9cb03d3ad94c1f14353827a38 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 26 Jan 2022 18:00:00 +0000 Subject: [PATCH] Refactor to use a subtest --- hello_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hello_test.go b/hello_test.go index 51a22a0..7f64b7c 100644 --- a/hello_test.go +++ b/hello_test.go @@ -3,10 +3,12 @@ package main import "testing" func TestHello(t *testing.T) { - got := Hello("Oliver") - want := "Hello, Oliver" + t.Run("saying hello to people", func (t *testing.T) { + got := Hello("Oliver") + want := "Hello, Oliver" - if got != want { - t.Errorf("got %q want %q", got, want) - } + if got != want { + t.Errorf("got %q want %q", got, want) + } + }) }