Skip to content

Commit 1c04416

Browse files
committed
nvim: split testAllOptionsInfo and testOptionsInfo
1 parent e467ad0 commit 1c04416

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

nvim/nvim_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ func TestAPI(t *testing.T) {
101101
t.Run("Context", testContext(t, v))
102102
t.Run("Extmarks", testExtmarks(t, v))
103103
t.Run("RuntimeFiles", testRuntimeFiles(t, v))
104+
t.Run("AllOptionsInfo", testAllOptionsInfo(t, v))
104105
t.Run("OptionsInfo", testOptionsInfo(t, v))
105106
}
106107

@@ -886,7 +887,7 @@ func testRuntimeFiles(t *testing.T, v *Nvim) func(*testing.T) {
886887
}
887888
}
888889

889-
func testOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
890+
func testAllOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
890891
return func(t *testing.T) {
891892
want := &OptionInfo{
892893
Name: "",
@@ -902,6 +903,7 @@ func testOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
902903
CommaList: false,
903904
FlagList: false,
904905
}
906+
905907
got, err := v.AllOptionsInfo()
906908
if err != nil {
907909
t.Fatal(err)
@@ -910,6 +912,20 @@ func testOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
910912
t.Fatalf("got %v but want %v", got, want)
911913
}
912914

915+
b := v.NewBatch()
916+
var got2 OptionInfo
917+
b.AllOptionsInfo(&got2)
918+
if err := b.Execute(); err != nil {
919+
t.Fatal(err)
920+
}
921+
if !reflect.DeepEqual(want, &got2) {
922+
t.Fatalf("got %v but want %v", got2, want)
923+
}
924+
}
925+
}
926+
927+
func testOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
928+
return func(t *testing.T) {
913929
tests := map[string]struct {
914930
name string
915931
want *OptionInfo
@@ -966,6 +982,7 @@ func testOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
966982
},
967983
},
968984
}
985+
969986
for name, tt := range tests {
970987
tt := tt
971988
t.Run("Nvim/"+name, func(t *testing.T) {
@@ -980,6 +997,7 @@ func testOptionsInfo(t *testing.T, v *Nvim) func(*testing.T) {
980997
}
981998
})
982999
}
1000+
9831001
for name, tt := range tests {
9841002
tt := tt
9851003
t.Run("Atomic/"+name, func(t *testing.T) {

0 commit comments

Comments
 (0)