]> git.madduck.net Git - etc/vim.git/blobdiff - .vim/bundle/ale/test/test_quitting_variable.vader

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 '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / test_quitting_variable.vader
diff --git a/.vim/bundle/ale/test/test_quitting_variable.vader b/.vim/bundle/ale/test/test_quitting_variable.vader
new file mode 100644 (file)
index 0000000..32eb0c3
--- /dev/null
@@ -0,0 +1,39 @@
+Before:
+  Save g:ale_enabled
+
+  unlet! b:ale_quitting
+  let g:ale_enabled = 0
+
+After:
+  Restore
+
+  unlet! b:ale_quitting
+  unlet! b:time_before
+
+Execute(QuitEvent should set b:ale_quitting some time from the clock):
+  let b:time_before = ale#events#ClockMilliseconds()
+
+  call ale#events#QuitEvent(bufnr(''))
+
+  Assert b:ale_quitting >= b:time_before
+  Assert b:ale_quitting <= ale#events#ClockMilliseconds()
+
+Execute(ReadOrEnterEvent should set b:ale_quitting to 0):
+  let b:ale_quitting = 1
+
+  call ale#events#ReadOrEnterEvent(bufnr(''))
+
+  AssertEqual 0, b:ale_quitting
+
+Execute(The QuitRecently function should work when the variable isn't set):
+  AssertEqual 0, ale#events#QuitRecently(bufnr(''))
+
+Execute(The QuitRecently function should return 1 when ALE quit recently):
+  let b:ale_quitting = ale#events#ClockMilliseconds()
+
+  AssertEqual 1, ale#events#QuitRecently(bufnr(''))
+
+Execute(The QuitRecently function should return 0 when a second has passed):
+  let b:ale_quitting = ale#events#ClockMilliseconds() - 1001
+
+  AssertEqual 0, ale#events#QuitRecently(bufnr(''))