]> code.delx.au - gnu-emacs-elpa/blob - packages/js2-mode/tests/externs.el
Fix up copyrights and the checking code
[gnu-emacs-elpa] / packages / js2-mode / tests / externs.el
1 ;;; externs.el --- Tests of "externs" for js2-mode
2
3 ;; Copyright (C) 2013 Free Software Foundation, Inc.
4
5 ;; This program is free software: you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation, either version 3 of the License, or
8 ;; (at your option) any later version.
9
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
14
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Code:
19
20 (require 'ert)
21 (require 'js2-mode)
22
23 (ert-deftest js2-finds-jslint-globals ()
24 (with-temp-buffer
25 (insert "/*global foo, bar:false, baz: true */")
26 (js2-mode)
27 (should (equal (js2-get-jslint-globals)
28 '("foo" "bar" "baz")))))
29
30 (ert-deftest js2-no-jslint-globals-without-keyword ()
31 (with-temp-buffer
32 (insert "/* foo, bar:false, baz: true */")
33 (js2-mode)
34 (should (null (js2-get-jslint-globals)))))
35
36 (ert-deftest js2-finds-jslint-globals-in-other-comments ()
37 (with-temp-buffer
38 (insert "/* foo, bar */\n\n\n/*global quux, tee: true, $*/")
39 (js2-mode)
40 (should (equal (js2-get-jslint-globals)
41 '("quux" "tee" "$")))))