// TestSearchSingleMatch asserts that the expected output is returned
// when a single match is returned
TestSearchSingleMatch asserts that the expected output is returned
when a single match is returned
// TestSearchSingleMatch asserts that the expected output is returned // when a single match is returned
func TestSearchSingleMatch(t *testing.T) {
	sheet := Sheet{
		Text: "The quick brown fox\njumped over\n\nthe lazy dog.",
	}
	reg, err := regexp.Compile("(?i)fox")
	if err != nil {
		t.Errorf("failed to compile regex: %v", err)
	}
	matches := sheet.Search(reg)
	want := "The quick brown fox\njumped over"
	if matches != want {
		t.Errorf(
			"failed to return expected matches: want:\n%s, got:\n%s",
			want,
			matches,
		)
	}
}
func TestSearchSingleMatch ( t * testing . T ) { sheet := Sheet { Text : " \n \n \n " , } reg , err := regexp . Compile ( " " ) if err != nil { t . Errorf ( " " , err ) } matches := sheet . Search ( reg ) want := " \n " if matches != want { t . Errorf ( " \n \n " , want , matches , ) } }
TestSearchSingleMatch asserts that the expected output is returned
when a single match is returned
TestSearchSingleMatch asserts that the expected output is returned when a single match is returned
// mock a cheatsheet // compile the search regex // search the sheet // specify the expected results // assert that the correct matches were returned