summaryrefslogtreecommitdiff
path: root/test/test_sandbox_execution.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-02-14 21:02:49 +0000
committerw0rp <devw0rp@gmail.com>2017-02-14 21:02:49 +0000
commitc460602cbbf80c1b1b3f006ae3dd28528a80c17c (patch)
tree24b369ae545aecf856915ebae65bc6e913050c8f /test/test_sandbox_execution.vader
parent78135103fbc6d1d4107f3eef448828c1498f9bcf (diff)
downloadale-c460602cbbf80c1b1b3f006ae3dd28528a80c17c.zip
#338 Try and stop ALE from throwing ALEs when run from a sandbox
Diffstat (limited to 'test/test_sandbox_execution.vader')
-rw-r--r--test/test_sandbox_execution.vader51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/test_sandbox_execution.vader b/test/test_sandbox_execution.vader
new file mode 100644
index 00000000..a4cd84d6
--- /dev/null
+++ b/test/test_sandbox_execution.vader
@@ -0,0 +1,51 @@
+Before:
+ function! TestCallback(buffer, output)
+ return [
+ \ {
+ \ 'lnum': 1,
+ \ 'bufnr': 1,
+ \ 'vcol': 0,
+ \ 'linter_name': 'testlinter',
+ \ 'nr': -1,
+ \ 'type': 'E',
+ \ 'col': 1,
+ \ 'text': 'Test Error',
+ \ },
+ \]
+ endfunction
+
+ call ale#linter#Define('foobar', {
+ \ 'name': 'testlinter',
+ \ 'callback': 'TestCallback',
+ \ 'executable': 'echo',
+ \ 'command': 'echo',
+ \})
+
+ let g:ale_buffer_info = {}
+
+After:
+ delfunction TestCallback
+ call ale#linter#Reset()
+ let g:ale_buffer_info = {}
+
+Given foobar (Some imaginary filetype):
+ foo
+ bar
+ baz
+
+Execute(ALE shouldn't blow up when run from a sandbox):
+ AssertEqual 'foobar', &filetype
+
+ sandbox call ale#Queue(0)
+ sandbox call ale#Queue(1)
+ sandbox call ale#Lint()
+
+Execute(ALE shouldn't blow up if file cleanup happens in a sandbox):
+ let g:ale_buffer_info[3] = {
+ \ 'temporary_file_list': ['/tmp/foo'],
+ \ 'temporary_directory_list': ['/tmp/bar'],
+ \}
+ sandbox call ale#engine#RemoveManagedFiles(3)
+
+ AssertEqual ['/tmp/foo'], g:ale_buffer_info[3].temporary_file_list
+ AssertEqual ['/tmp/bar'], g:ale_buffer_info[3].temporary_directory_list