mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 14:34:52 +02:00
Utility code to find longest common prefix/suffix and to quote strings for various shells
This commit is contained in:
21
tools/utils/longest-common_test.go
Normal file
21
tools/utils/longest-common_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// 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")
|
||||
}
|
||||
Reference in New Issue
Block a user