MCPcopy Index your code
hub / github.com/bitfield/script / TestFreqProducesCorrectFrequencyTableForInput

Function TestFreqProducesCorrectFrequencyTableForInput

script_test.go:611–642  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

609}
610
611func TestFreqProducesCorrectFrequencyTableForInput(t *testing.T) {
612 t.Parallel()
613 input := strings.Join([]string{
614 "apple",
615 "orange",
616 "banana",
617 "banana",
618 "apple",
619 "orange",
620 "kumquat",
621 "apple",
622 "orange",
623 "apple",
624 "banana",
625 "banana",
626 "apple",
627 "apple",
628 "orange",
629 "apple",
630 "apple",
631 "apple",
632 "apple",
633 }, "\n")
634 want := "10 apple\n 4 banana\n 4 orange\n 1 kumquat\n"
635 got, err := script.Echo(input).Freq().String()
636 if err != nil {
637 t.Fatal(err)
638 }
639 if want != got {
640 t.Error(cmp.Diff(want, got))
641 }
642}
643
644func TestGetMakesHTTPGetRequestToGivenURL(t *testing.T) {
645 t.Parallel()

Callers

nothing calls this directly

Calls 5

EchoFunction · 0.92
JoinMethod · 0.80
StringMethod · 0.80
FreqMethod · 0.80
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…