1 ;;; tests/externs.el --- Some tests for js2-mode.
3 ;; Copyright (C) 2009, 2011-2013 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 (ert-deftest js2-finds-jslint-globals ()
27 (insert "/*global foo, bar:false, baz: true */")
29 (should (equal (js2-get-jslint-globals)
30 '("foo" "bar" "baz")))))
32 (ert-deftest js2-no-jslint-globals-without-keyword ()
34 (insert "/* foo, bar:false, baz: true */")
36 (should (null (js2-get-jslint-globals)))))
38 (ert-deftest js2-finds-jslint-globals-in-other-comments ()
40 (insert "/* foo, bar */\n\n\n/*global quux, tee: true, $*/")
42 (should (equal (js2-get-jslint-globals)
43 '("quux" "tee" "$")))))
46 ;; ensure that any symbols bound with the import syntax are added to the extern list
47 ;; ensure that any symbols bound with the export syntax exist in the file scope