File: test-typescript.el

package info (click to toggle)
flycheck 30-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,172 kB
  • ctags: 1,544
  • sloc: lisp: 11,139; python: 733; makefile: 243; ruby: 23; cpp: 17; ada: 17; f90: 16; xml: 14; ansic: 12; haskell: 12; sh: 10; erlang: 10; php: 9; perl: 7; fortran: 3; sql: 1
file content (59 lines) | stat: -rw-r--r-- 2,472 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
54
55
56
57
58
59
;;; test-typescript.el --- Flycheck Specs: TypeScript      -*- lexical-binding: t; -*-

;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors

;; Author: Saša Jovanić <info@simplify.ba>

;; This file is not part of GNU Emacs.

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;; Specs for TypeScript support.

;;; Code:

(require 'flycheck-buttercup)

(describe "Language TypeScript"
  (describe "The TSLint error parser"
    (let ((json "[{\"endPosition\":{\"character\":25,\"line\":0,\"position\":25},
  \"failure\":\"unused variable: 'invalidAlignment'\",
  \"name\":\"sample.ts\",
  \"ruleName\":\"no-unused-variable\",
  \"startPosition\":{\"character\":9,\"line\":0,\"position\":9}},
 {\"endPosition\":{\"character\":14,\"line\":2,\"position\":76},
  \"failure\":\"missing semicolon\",
  \"name\":\"sample.ts\",
  \"ruleName\":\"semicolon\",
  \"startPosition\":{\"character\":14,\"line\":2,\"position\":76}}]"))
      (it "parses TSLint JSON output"
        (expect (flycheck-parse-tslint json 'checker 'buffer)
                :to-be-equal-flycheck-errors
                (list
                 (flycheck-error-new-at 1 10 'warning
                                        "unused variable: 'invalidAlignment'"
                                        :id "no-unused-variable"
                                        :checker 'checker
                                        :buffer 'buffer
                                        :filename "sample.ts")
                 (flycheck-error-new-at 3 15 'warning
                                        "missing semicolon"
                                        :id "semicolon"
                                        :checker 'checker
                                        :buffer 'buffer
                                        :filename "sample.ts")))))))

;;; test-typescript.el ends here