Skip to content

Commit dee919e

Browse files
committed
nvim: add TabpageNumber and IsTabpageValid testcases
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 37da3c7 commit dee919e

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

nvim/api_test.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,6 +1477,29 @@ func testTabpage(v *Nvim) func(*testing.T) {
14771477
t.Fatalf("expected %v but got %v", wantWins, gotWins)
14781478
}
14791479
})
1480+
1481+
t.Run("TabpageNumber", func(t *testing.T) {
1482+
gotTabpageNum, err := v.TabpageNumber(Tabpage(0))
1483+
if err != nil {
1484+
t.Fatal(err)
1485+
}
1486+
1487+
wantTabpageNum := 1
1488+
if gotTabpageNum != wantTabpageNum {
1489+
t.Fatalf("expected %v but got %v", wantTabpageNum, gotTabpageNum)
1490+
}
1491+
})
1492+
1493+
t.Run("IsTabpageValid", func(t *testing.T) {
1494+
valid, err := v.IsTabpageValid(Tabpage(0))
1495+
if err != nil {
1496+
t.Fatal(err)
1497+
}
1498+
1499+
if !valid {
1500+
t.Fatalf("expected valid but got %t", valid)
1501+
}
1502+
})
14801503
})
14811504

14821505
t.Run("Batch", func(t *testing.T) {
@@ -1542,6 +1565,35 @@ func testTabpage(v *Nvim) func(*testing.T) {
15421565
t.Fatalf("expected %v but got %v", wantWins, gotWins)
15431566
}
15441567
})
1568+
1569+
t.Run("TabpageNumber", func(t *testing.T) {
1570+
b := v.NewBatch()
1571+
1572+
var gotTabpageNum int
1573+
b.TabpageNumber(Tabpage(0), &gotTabpageNum)
1574+
if err := b.Execute(); err != nil {
1575+
t.Fatal(err)
1576+
}
1577+
1578+
wantTabpageNum := 1
1579+
if gotTabpageNum != wantTabpageNum {
1580+
t.Fatalf("expected %v but got %v", wantTabpageNum, gotTabpageNum)
1581+
}
1582+
})
1583+
1584+
t.Run("IsWindowValid", func(t *testing.T) {
1585+
b := v.NewBatch()
1586+
1587+
var valid bool
1588+
b.IsTabpageValid(Tabpage(0), &valid)
1589+
if err := b.Execute(); err != nil {
1590+
t.Fatal(err)
1591+
}
1592+
1593+
if !valid {
1594+
t.Fatalf("expected valid but got %t", valid)
1595+
}
1596+
})
15451597
})
15461598
}
15471599
}

0 commit comments

Comments
 (0)