summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2018-11-21 16:44:59 +0000
committerGitHub <noreply@github.com>2018-11-21 16:44:59 +0000
commitff0bd14efe8ba55594afe5175f562254d5268689 (patch)
treef9eb2744ff5a4705ee9fcf52c9aaffcb11a4c3e6 /test
parenta05a16b1092e0af13942e40f62c5d89fbfc9fd0c (diff)
parent66212966dd39dd721af6a2aa683ed5a93c293c77 (diff)
downloadale-ff0bd14efe8ba55594afe5175f562254d5268689.zip
Merge pull request #2068 from m-pilia/ispc
Add linter for ispc
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_ispc_ispc_command_callbacks.vader20
-rw-r--r--test/handler/test_ispc_ispc_handler.vader90
2 files changed, 110 insertions, 0 deletions
diff --git a/test/command_callback/test_ispc_ispc_command_callbacks.vader b/test/command_callback/test_ispc_ispc_command_callbacks.vader
new file mode 100644
index 00000000..f1aeb2f8
--- /dev/null
+++ b/test/command_callback/test_ispc_ispc_command_callbacks.vader
@@ -0,0 +1,20 @@
+Before:
+ call ale#assert#SetUpLinterTest('ispc', 'ispc')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The executable should be configurable):
+ AssertLinter 'ispc',
+ \ ale#Escape('ispc') . ' --nowrap %s'
+
+ let b:ale_ispc_ispc_executable = 'foo'
+
+ AssertLinter 'foo',
+ \ ale#Escape('foo') . ' --nowrap %s'
+
+Execute(The options should be configurable):
+ let g:ale_ispc_ispc_options = '--foo'
+
+ AssertLinter 'ispc',
+ \ ale#Escape('ispc') . ' --nowrap --foo' . ' %s'
diff --git a/test/handler/test_ispc_ispc_handler.vader b/test/handler/test_ispc_ispc_handler.vader
new file mode 100644
index 00000000..619773fe
--- /dev/null
+++ b/test/handler/test_ispc_ispc_handler.vader
@@ -0,0 +1,90 @@
+Before:
+ runtime ale_linters/ispc/ispc.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The ispc handler should parse input correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 33,
+ \ 'col': 14,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''int'', expecting '','' or '';''.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 36,
+ \ 'col': 5,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''for''.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 51,
+ \ 'col': 9,
+ \ 'type': 'E',
+ \ 'text': '''foobar.h'' file not found',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 79,
+ \ 'col': 52,
+ \ 'type': 'W',
+ \ 'text': 'Modulus operator with varying types is very inefficient.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 85,
+ \ 'col': 13,
+ \ 'type': 'W',
+ \ 'text': 'Undefined behavior: all program instances are writing to the same location!',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 93,
+ \ 'col': 19,
+ \ 'type': 'W',
+ \ 'text': 'Gather required to load value.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 93,
+ \ 'col': 9,
+ \ 'type': 'W',
+ \ 'text': 'Scatter required to store value.',
+ \ },
+ \ ],
+ \ ale_linters#ispc#ispc#Handle(0, [
+ \ 'Warning: No output file or header file name specified. Program will be compiled and warnings/errors will be issued, but no output will be generated. ',
+ \ 'Warning: No --target specified on command-line. Using default system target "avx2-i32x8".',
+ \ 'mandelbrot.ispc:33:14: Error: syntax error, unexpected ''int'', expecting '','' or '';''.',
+ \ 'static iline int mandel(float c_re, float c_im, int count) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:36:5: Error: syntax error, unexpected ''for''.',
+ \ ' for (i = 0; i < count; ++i) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:51:9: fatal error: ''foobar.h'' file not found',
+ \ '#include<foobar.h>',
+ \ ' ^~~~~~~~~~',
+ \ 'mandelbrot.ispc:79:52: Performance Warning: Modulus operator with varying types is very inefficient.',
+ \ ' double x = x0 + i * (dx + epsilon*(k%2)*delta);',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:85:13: Warning: Undefined behavior: all program instances are writing to the same location!',
+ \ ' output[index] = (NNN) / sample_size;',
+ \ ' ^^^^^^^^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:93:19: Performance Warning: Gather required to load value.',
+ \ ' A[i*8] *= A[i*8];',
+ \ ' ^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:93:9: Performance Warning: Scatter required to store value.',
+ \ ' A[i*8] *= A[i*8];',
+ \ ' ^^^^^^',
+ \ '',
+ \ ])