Skip to content

Commit

Permalink
Fix output when using builtin assert functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thinca committed Oct 30, 2024
1 parent 13cf89a commit 949768e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion autoload/themis/supporter/builtin_assert.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function s:receiver.end_test(report) abort
endif
for error in v:errors
let [throwpoint, exception] = matchlist(error, '\v([^:]+):\s*(.*)')[1 : 2]
call a:report.add_exception(exception, throwpoint)
call a:report.add_exception('themis:report:' . exception, throwpoint)
endfor
let v:errors = []
endfunction
Expand Down
10 changes: 10 additions & 0 deletions test/supporter/builtin_assert.vimspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@ Describe supporter-builtin_assert
End

It handles assert_true()
let listener = {}
function listener.fail(report) abort
let self.report = a:report
endfunction
call runner.add_event(listener)

function suite.test_assert_true() abort
call assert_true(0)
endfunction
call runner.run(bundle)

Assert Equals(stats.fail(), 1)
let exception = get(listener.report.exceptions, 0, {})
Assert NotEquals(get(exception, 'type', 'error'), 'error')
Assert Match(get(exception, 'message'), '^Expected')
End
End

0 comments on commit 949768e

Please sign in to comment.