summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_glslang_command_callback.vader42
-rw-r--r--test/handler/test_glslang_handler.vader21
2 files changed, 63 insertions, 0 deletions
diff --git a/test/command_callback/test_glslang_command_callback.vader b/test/command_callback/test_glslang_command_callback.vader
new file mode 100644
index 00000000..9d406834
--- /dev/null
+++ b/test/command_callback/test_glslang_command_callback.vader
@@ -0,0 +1,42 @@
+Before:
+ Save g:ale_glsl_glslang_executable
+ Save g:ale_glsl_glslang_options
+
+ unlet! g:ale_glsl_glslang_executable
+ unlet! g:ale_glsl_glslang_options
+
+ runtime ale_linters/glsl/glslang.vim
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+
+After:
+ Restore
+ unlet! g:ale_cuda_nvcc_executable
+ unlet! g:ale_cuda_nvcc_options
+ call ale#linter#Reset()
+
+Execute(Executable should default to glslangValidator):
+ AssertEqual
+ \ 'glslangValidator',
+ \ ale_linters#glsl#glslang#GetExecutable(bufnr(''))
+
+Execute(Executable should be configurable):
+ let g:ale_glsl_glslang_executable = 'foobar'
+ AssertEqual
+ \ 'foobar',
+ \ ale_linters#glsl#glslang#GetExecutable(bufnr(''))
+
+Execute(Command should use executable):
+ AssertEqual
+ \ 'glslangValidator -C %t',
+ \ ale_linters#glsl#glslang#GetCommand(bufnr(''))
+
+ let g:ale_glsl_glslang_executable = 'foobar'
+ AssertEqual
+ \ 'foobar -C %t',
+ \ ale_linters#glsl#glslang#GetCommand(bufnr(''))
+
+Execute(Options should work):
+ let g:ale_glsl_glslang_options = '--test'
+ AssertEqual
+ \ 'glslangValidator --test -C %t',
+ \ ale_linters#glsl#glslang#GetCommand(bufnr(''))
diff --git a/test/handler/test_glslang_handler.vader b/test/handler/test_glslang_handler.vader
new file mode 100644
index 00000000..d51c9852
--- /dev/null
+++ b/test/handler/test_glslang_handler.vader
@@ -0,0 +1,21 @@
+Execute(The glsl glslang handler should parse lines correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 0,
+ \ 'type': 'E',
+ \ 'text': '''gl_ModelViewProjectionMatrix'' : undeclared identifier',
+ \ },
+ \ {
+ \ 'lnum': 121,
+ \ 'col': 0,
+ \ 'type': 'W',
+ \ 'text': '''switch'' : last case/default label not followed by statements',
+ \ },
+ \ ],
+ \ ale_linters#glsl#glslang#Handle(bufnr(''), [
+ \ 'ERROR: 0:4: ''gl_ModelViewProjectionMatrix'' : undeclared identifier',
+ \ 'WARNING: 0:121: ''switch'' : last case/default label not followed by statements',
+ \ 'ERROR: 2 compilation errors. No code generated.',
+ \ ])