@@ -7,19 +7,21 @@ import (
77 "fmt"
88 "strings"
99 "testing"
10+
11+ "github.com/wavetermdev/waveterm/wavesrv/pkg/utilfn"
1012)
1113
12- func parseToSP (s string ) StrWithPos {
14+ func parseToSP (s string ) utilfn. StrWithPos {
1315 idx := strings .Index (s , "[*]" )
1416 if idx == - 1 {
15- return StrWithPos {Str : s }
17+ return utilfn. StrWithPos {Str : s }
1618 }
17- return StrWithPos {Str : s [0 :idx ] + s [idx + 3 :], Pos : idx }
19+ return utilfn. StrWithPos {Str : s [0 :idx ] + s [idx + 3 :], Pos : idx }
1820}
1921
2022func testParse (cmdStr string , pos int ) {
21- fmt .Printf ("cmd: %s\n " , strWithCursor ( cmdStr , pos ) )
22- p := ParseCompPoint (StrWithPos {Str : cmdStr , Pos : pos })
23+ fmt .Printf ("cmd: %s\n " , utilfn. StrWithPos { Str : cmdStr , Pos : pos } )
24+ p := ParseCompPoint (utilfn. StrWithPos {Str : cmdStr , Pos : pos })
2325 p .dump ()
2426}
2527
@@ -64,9 +66,9 @@ func Test2(t *testing.T) {
6466 testMiniExtend (t , p , "foo's" , true , `$'foo\'s[*]more` )
6567}
6668
67- func testParseRT (t * testing.T , origSP StrWithPos ) {
69+ func testParseRT (t * testing.T , origSP utilfn. StrWithPos ) {
6870 p := ParseCompPoint (origSP )
69- newSP := StrWithPos {Str : p .getOrigStr (), Pos : p .getOrigPos ()}
71+ newSP := utilfn. StrWithPos {Str : p .getOrigStr (), Pos : p .getOrigPos ()}
7072 if origSP != newSP {
7173 t .Fatalf ("not equal: [%s] != [%s]" , origSP , newSP )
7274 }
0 commit comments