2016-11-10 21:25:53 -07:00
|
|
|
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
|
2015-04-15 05:35:12 -06:00
|
|
|
// Use of this source code is governed by a MIT license that can
|
|
|
|
// be found in the LICENSE file.
|
|
|
|
|
|
|
|
package termui
|
|
|
|
|
2015-09-18 09:41:44 -06:00
|
|
|
import "testing"
|
2015-04-15 05:35:12 -06:00
|
|
|
|
2015-09-18 09:41:44 -06:00
|
|
|
var ps = []string{
|
|
|
|
"",
|
|
|
|
"/",
|
|
|
|
"/a",
|
|
|
|
"/b",
|
|
|
|
"/a/c",
|
|
|
|
"/a/b",
|
|
|
|
"/a/b/c",
|
|
|
|
"/a/b/c/d",
|
|
|
|
"/a/b/c/d/"}
|
2015-04-15 05:35:12 -06:00
|
|
|
|
2015-09-18 09:41:44 -06:00
|
|
|
func TestMatchScore(t *testing.T) {
|
2015-09-21 01:11:58 -06:00
|
|
|
chk := func(a, b string, s bool) {
|
|
|
|
if c := isPathMatch(a, b); c != s {
|
|
|
|
t.Errorf("\na:%s\nb:%s\nshould:%t\nactual:%t", a, b, s, c)
|
2015-09-18 09:41:44 -06:00
|
|
|
}
|
|
|
|
}
|
2015-04-15 05:35:12 -06:00
|
|
|
|
2015-09-21 01:11:58 -06:00
|
|
|
chk(ps[1], ps[1], true)
|
|
|
|
chk(ps[1], ps[2], true)
|
|
|
|
chk(ps[2], ps[1], false)
|
|
|
|
chk(ps[4], ps[1], false)
|
|
|
|
chk(ps[6], ps[2], false)
|
|
|
|
chk(ps[4], ps[5], false)
|
2015-09-18 09:41:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestCrtEvt(t *testing.T) {
|
2015-04-15 05:35:12 -06:00
|
|
|
|
|
|
|
}
|