go-by-test/dictionary/dictionary_test.go

21 lines
378 B
Go
Raw Normal View History

2024-09-11 11:48:59 +00:00
package dictionary
import "testing"
2024-09-11 12:07:00 +00:00
func assertStrings(t testing.TB, got, want string) {
t.Helper()
if got != want {
t.Errorf("got %q want %q given %q", got, want, "test")
}
}
2024-09-11 11:48:59 +00:00
func TestSearch(t *testing.T) {
2024-09-11 13:22:42 +00:00
dictionary := Dictionary{"test": "this is just a test"}
2024-09-11 11:48:59 +00:00
2024-09-11 13:22:42 +00:00
got := dictionary.Search("test")
2024-09-11 11:48:59 +00:00
want := "this is just a test"
2024-09-11 12:07:00 +00:00
assertStrings(t, got, want)
2024-09-11 11:48:59 +00:00
}