]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/vim-lsp-ale/test/unit/runtime/autoload/ale/other_source.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / vim-lsp-ale / test / unit / runtime / autoload / ale / other_source.vim
diff --git a/.vim/bundle/vim-lsp-ale/test/unit/runtime/autoload/ale/other_source.vim b/.vim/bundle/vim-lsp-ale/test/unit/runtime/autoload/ale/other_source.vim
new file mode 100644 (file)
index 0000000..dda4fae
--- /dev/null
@@ -0,0 +1,62 @@
+function! ale#other_source#StartChecking(bufnr, name) abort
+    let s:start_checking_called = [a:bufnr, a:name]
+endfunction
+
+function! ale#other_source#ShowResults(bufnr, name, results) abort
+    let s:show_results_called = [a:bufnr, a:name, a:results]
+endfunction
+
+function! ale#other_source#last_start_checking() abort
+    return s:start_checking_called
+endfunction
+
+function! ale#other_source#last_show_results() abort
+    return s:show_results_called
+endfunction
+
+function! WaitUntil(func, ...) abort
+    let timeout = get(a:, 1, 1) " 1sec by default
+    let total = 0
+    while !a:func()
+        sleep 100m
+        let total += 0.1
+        if total >= timeout
+            " Note: v:true/v:false are not supported by themis.vim
+            " https://github.com/thinca/vim-themis/pull/56
+            return 0
+        endif
+    endwhile
+    return 1
+endfunction
+
+function! ale#other_source#wait_until_show_results() abort
+    let timeout = 1
+    let total = 0
+    while s:show_results_called is v:null
+        let total += 0.1
+        if total > timeout
+            throw 'ale#other_source#ShowResults() was not called while 1 second'
+        endif
+        sleep 100m
+    endwhile
+endfunction
+
+function! ale#other_source#check_show_no_result() abort
+    let timeout = 1
+    let total = 0
+    while s:show_results_called is v:null
+        let total += 0.1
+        if total > timeout
+            return
+        endif
+        sleep 100m
+    endwhile
+    throw 'ale#other_source#ShowResults() was called within 1 second: ' . string(s:show_results_called)
+endfunction
+
+function! ale#other_source#reset() abort
+    let s:start_checking_called = v:null
+    let s:show_results_called = v:null
+endfunction
+
+call ale#other_source#reset()