kitty/tools/utils/longest-common_test.go

22 lines
417 B
Go

// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
package utils
import (
"fmt"
"testing"
)
var _ = fmt.Print
func TestLongestCommon(t *testing.T) {
p := func(expected string, items ...string) {
actual := Prefix(items)
if actual != expected {
t.Fatalf("Failed with %#v\nExpected: %#v\nActual: %#v", items, expected, actual)
}
}
p("abc", "abc", "abcd")
p("", "abc", "xy")
}