Skip to content

Commit de64096

Browse files
committed
nvim: handle os.Getwd error and remove unnecessary slash
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent ce4cc3c commit de64096

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nvim/api_test.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,11 @@ func testBuffer(v *Nvim) func(*testing.T) {
433433
return func(t *testing.T) {
434434
t.Run("Nvim", func(t *testing.T) {
435435
t.Run("BufferName", func(t *testing.T) {
436-
cwd, _ := os.Getwd() // buffer name is full path
437-
wantBufName := filepath.Join(cwd, "/test_buffer")
436+
cwd, err := os.Getwd() // buffer name is full path
437+
if err != nil {
438+
t.Fatal(err)
439+
}
440+
wantBufName := filepath.Join(cwd, "test_buffer")
438441
if err := v.SetBufferName(Buffer(0), wantBufName); err != nil {
439442
t.Fatal(err)
440443
}
@@ -689,8 +692,11 @@ func testBuffer(v *Nvim) func(*testing.T) {
689692
t.Run("BufferName", func(t *testing.T) {
690693
b := v.NewBatch()
691694

692-
cwd, _ := os.Getwd() // buffer name is full path
693-
wantBufName := filepath.Join(cwd, "/test_buffer")
695+
cwd, err := os.Getwd() // buffer name is full path
696+
if err != nil {
697+
t.Fatal(err)
698+
}
699+
wantBufName := filepath.Join(cwd, "test_buffer")
694700
b.SetBufferName(Buffer(0), wantBufName)
695701
if err := b.Execute(); err != nil {
696702
t.Fatal(err)

0 commit comments

Comments
 (0)