Skip to content

Commit

Permalink
test: Fix tests to pass all
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz committed Jan 2, 2024
1 parent dbd626c commit ba2a89e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
39 changes: 29 additions & 10 deletions test/component_sign.vim
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ function! s:list_in_buffer() abort
return list
endfunction

function! s:dissoc(d, k) abort
let d = copy(a:d)
unlet d[a:k]
return d
endfunction

function! s:suite.list_in_buffer_test() abort
call s:setup()

Expand Down Expand Up @@ -210,18 +216,31 @@ function! s:suite.refresh_test() abort
call s:setup()
exec printf(':b %d', bufnr(s:foo_file))

call s:assert.equals(s:list_in_buffer(), [
\ {'lnum': 3, 'id': 1, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'id': 1, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'id': 2, 'name': 'iced_dummy2', 'group': 'default'},
\ ])
let before_list_in_buffer = s:list_in_buffer()
let before_ids = map(copy(before_list_in_buffer), {_, v -> v['id']})

call s:assert.equals(
\ map(copy(before_list_in_buffer), {_, v -> s:dissoc(v, 'id')}),
\ [
\ {'lnum': 3, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'name': 'iced_dummy2', 'group': 'default'},
\ ])

call s:sign.refresh({'file': s:foo_file})
call s:assert.equals(s:list_in_buffer(), [
\ {'lnum': 3, 'id': 3, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'id': 1, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'id': 4, 'name': 'iced_dummy2', 'group': 'default'},
\ ])

let after_list_in_buffer = s:list_in_buffer()
let after_ids = map(copy(after_list_in_buffer), {_, v -> v['id']})

call s:assert.equals(
\ map(copy(after_list_in_buffer), {_, v -> s:dissoc(v, 'id')}),
\ [
\ {'lnum': 3, 'name': 'iced_dummy1', 'group': 'default'},
\ {'lnum': 5, 'name': 'iced_dummy1', 'group': 'group1'},
\ {'lnum': 7, 'name': 'iced_dummy2', 'group': 'default'},
\ ])

call s:assert.not_equals(before_ids, after_ids)

call s:teardown()
endfunction
3 changes: 3 additions & 0 deletions test/nrepl_eval.vim
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ function! s:suite.code_test() abort
let g:iced#eval#keep_inline_result = v:false
let g:iced#eval#popup_highlight = 'Comment'
let g:iced#eval#inside_comment = v:false
let g:iced#eval#popup_spinner_texts = ['']
let g:iced#eval#popup_align = 'after'
let g:iced#eval#popup_spinner_interval = 100
let p = iced#nrepl#eval#code('(comment (+ 1 2 3))')
call iced#promise#wait(p)

Expand Down

0 comments on commit ba2a89e

Please sign in to comment.