Skip to content

Commit c096c30

Browse files
committed
nvim: add RuntimeFiles testcase
1 parent 846a30c commit c096c30

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

nvim/nvim_test.go

+23
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import (
55
"errors"
66
"fmt"
77
"log"
8+
"path/filepath"
89
"reflect"
10+
"sort"
911
"strings"
1012
"sync/atomic"
1113
"testing"
@@ -667,6 +669,27 @@ func TestAPI(t *testing.T) {
667669
t.Fatal(err)
668670
}
669671
})
672+
673+
t.Run("runtime_file", func(t *testing.T) {
674+
files, err := v.RuntimeFiles("doc/*_diff.txt", true)
675+
if err != nil {
676+
t.Fatal(err)
677+
}
678+
sort.Strings(files)
679+
if len(files) != 2 {
680+
t.Fatalf("expected 2 length but got %d", len(files))
681+
}
682+
683+
var runtimePath string
684+
if err := v.Eval("$VIMRUNTIME", &runtimePath); err != nil {
685+
t.Fatal(err)
686+
}
687+
688+
want := fmt.Sprintf("%s,%s", filepath.Join(runtimePath, "doc", "vi_diff.txt"), filepath.Join(runtimePath, "doc", "vim_diff.txt"))
689+
if got := strings.Join(files, ","); !strings.EqualFold(got, want) {
690+
t.Fatalf("got %s but want %s", got, want)
691+
}
692+
})
670693
}
671694

672695
func TestDial(t *testing.T) {

0 commit comments

Comments
 (0)