Skip to content

Commit b3a1ec6

Browse files
committed
test follow
1 parent e554505 commit b3a1ec6

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

bash/bash_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var l = To1(net.Listen("tcp", ":0"))
2626

2727
func init() {
2828

29-
bash.IDGenerator = func(id string, pwd string) (ID, error) {
29+
bash.IDGenerator = func(c LcodeClient) (ID, error) {
3030
testClientIDNo++
3131
no := testClientIDNo
3232
return TestClientID(fmt.Sprintf("%d", no)), nil

hub/access_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ import (
77
. "github.com/lainio/err2/try"
88
)
99

10+
type testLC struct {
11+
id string
12+
pwd string
13+
}
14+
15+
func (lc testLC) RawID() string { return lc.id }
16+
func (lc testLC) PWD() string { return lc.pwd }
17+
func (lc testLC) Targets() []string { return []string{lc.pwd} }
18+
1019
func TestAllowDir(t *testing.T) {
11-
id := To1(hub.IDGenerator("5-aaa", "/www/vvv/"))
20+
lc := testLC{"5-aaa", "/www/vvv/"}
21+
id := To1(hub.IDGenerator(lc))
1222
host := id.(*Client).ToHost()
1323
a1 := To1(hub.AllowDir(host, "/www/vvv/8888"))
1424
assert.NotNil(a1)

hub/id_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ func TestParseIDRaw(t *testing.T) {
1717
}
1818

1919
func TestAddHost(t *testing.T) {
20-
id := To1(hub.IDGenerator("1-shy-matx", "/"))
20+
id := To1(hub.IDGenerator(testLC{"1-shy-matx", "/"}))
2121
defer id.Close()
2222
t.Log(id.No())
23-
id2 := To1(hub.IDGenerator("1-shy-matx", "/"))
23+
id2 := To1(hub.IDGenerator(testLC{"1-shy-matx", "/"}))
2424
defer id2.Close()
2525
t.Log("pass")
2626
}

0 commit comments

Comments
 (0)