File: test-lua.el

package info (click to toggle)
flycheck 36.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,600 kB
  • sloc: lisp: 16,210; python: 718; makefile: 219; cpp: 24; ruby: 23; perl: 21; ada: 17; f90: 16; haskell: 15; javascript: 15; sh: 14; erlang: 14; xml: 14; ansic: 12; php: 9; tcl: 8; fortran: 3; vhdl: 2; awk: 1; sql: 1
file content (53 lines) | stat: -rw-r--r-- 2,285 bytes parent folder | download
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