github.com/jmigpin/editor@v1.6.0/core/lsproto/registration_test.go (about) 1 package lsproto 2 3 import "testing" 4 5 func TestParseRegistration1(t *testing.T) { 6 s := "go,.go,tcp,goexec" 7 reg, err := NewRegistration(s) 8 if err != nil { 9 t.Fatal(err) 10 } 11 s2 := reg.String() 12 if s2 != "go,.go,tcp,goexec" { 13 t.Fatal(s2) 14 } 15 } 16 17 func TestParseRegistration2(t *testing.T) { 18 s := "c/c++,.c .h .hpp,tcp,\"cexec opt1\"" 19 reg, err := NewRegistration(s) 20 if err != nil { 21 t.Fatal(err) 22 } 23 s2 := reg.String() 24 if s2 != "c/c++,\".c .h .hpp\",tcp,\"cexec opt1\"" { 25 t.Fatal(s2) 26 } 27 } 28 29 func TestParseRegistration3(t *testing.T) { 30 s := "c,.c,tcpclient,127.0.0.1:9000" 31 reg, err := NewRegistration(s) 32 if err != nil { 33 t.Fatal(err) 34 } 35 t.Log(reg) 36 s2 := reg.String() 37 if s2 != "c,.c,tcpclient,127.0.0.1:9000" { 38 t.Fatal(s2) 39 } 40 } 41 42 func TestParseRegistration4(t *testing.T) { 43 s := "a,.aaa,stdio,c1,'opt1 opt2'" 44 reg, err := NewRegistration(s) 45 if err != nil { 46 t.Fatal(err) 47 } 48 s2 := reg.String() 49 if s2 != "a,.aaa,stdio,c1,\"opt1 opt2\"" { 50 t.Fatal(s2) 51 } 52 } 53 54 //----------