File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ var l = To1(net.Listen("tcp", ":0"))
2626
2727func 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
Original file line number Diff line number Diff 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+
1019func 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 )
Original file line number Diff line number Diff line change @@ -17,10 +17,10 @@ func TestParseIDRaw(t *testing.T) {
1717}
1818
1919func 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}
You can’t perform that action at this time.
0 commit comments