Skip to content

Commit

Permalink
nvim: add RuntimeFiles testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
zchee committed Mar 14, 2020
1 parent 846a30c commit c096c30
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nvim/nvim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import (
"errors"
"fmt"
"log"
"path/filepath"
"reflect"
"sort"
"strings"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -667,6 +669,27 @@ func TestAPI(t *testing.T) {
t.Fatal(err)
}
})

t.Run("runtime_file", func(t *testing.T) {
files, err := v.RuntimeFiles("doc/*_diff.txt", true)
if err != nil {
t.Fatal(err)
}
sort.Strings(files)
if len(files) != 2 {
t.Fatalf("expected 2 length but got %d", len(files))
}

var runtimePath string
if err := v.Eval("$VIMRUNTIME", &runtimePath); err != nil {
t.Fatal(err)
}

want := fmt.Sprintf("%s,%s", filepath.Join(runtimePath, "doc", "vi_diff.txt"), filepath.Join(runtimePath, "doc", "vim_diff.txt"))
if got := strings.Join(files, ","); !strings.EqualFold(got, want) {
t.Fatalf("got %s but want %s", got, want)
}
})
}

func TestDial(t *testing.T) {
Expand Down

0 comments on commit c096c30

Please sign in to comment.