1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
;;; test-lua.el --- Flycheck Specs: Lua -*- lexical-binding: t; -*-
;;; Code:
(require 'flycheck-buttercup)
(require 'test-helpers)
(describe "Language Lua"
(flycheck-buttercup-def-checker-test lua-luacheck lua syntax-error
(flycheck-buttercup-should-syntax-check
"language/lua/syntax-error.lua" 'lua-mode
'(5 7 error "unfinished string" :id "E011" :checker lua-luacheck)))
(flycheck-buttercup-def-checker-test lua-luacheck lua warnings
(flycheck-buttercup-should-syntax-check
"language/lua/warnings.lua" 'lua-mode
'(1 1 warning "setting non-standard global variable 'global_var'"
:id "W111" :checker lua-luacheck)
'(3 16 warning "unused function 'test'"
:id "W211" :checker lua-luacheck)
'(3 21 warning "unused argument 'arg'"
:id "W212" :checker lua-luacheck)
'(4 11 warning "variable 'var2' is never set"
:id "W221" :checker lua-luacheck)))
(flycheck-buttercup-def-checker-test lua-luacheck lua custom-luacheckrc
(let ((flycheck-luacheckrc "custom.luacheckrc"))
(flycheck-buttercup-should-syntax-check
"language/lua/warnings.lua" 'lua-mode
'(1 1 warning "setting non-standard global variable 'global_var'"
:id "W111" :checker lua-luacheck)
'(3 16 warning "unused function 'test'"
:id "W211" :checker lua-luacheck)
'(4 11 warning "variable 'var2' is never set"
:id "W221" :checker lua-luacheck))))
(flycheck-buttercup-def-checker-test lua-luacheck lua custom-standards
(let ((flycheck-luacheck-standards '("ngx_lua")))
(flycheck-buttercup-should-syntax-check
"language/lua/ngx_lua.warnings.lua" 'lua-mode
'(3 16 warning "unused function 'test'"
:id "W211" :checker lua-luacheck)
'(3 21 warning "unused argument 'arg'"
:id "W212" :checker lua-luacheck)
'(4 11 warning "variable 'var2' is never set"
:id "W221" :checker lua-luacheck))))
(flycheck-buttercup-def-checker-test lua lua nil
(let ((flycheck-disabled-checkers '(lua-luacheck)))
(flycheck-buttercup-should-syntax-check
"language/lua/syntax-error.lua" 'lua-mode
'(5 nil error "unfinished string near '\"oh no'"
:checker lua)))))
;;; test-lua.el ends here
|