]> code.delx.au - gnu-emacs-elpa/blob - test/clang-tests.el
Make a new release
[gnu-emacs-elpa] / test / clang-tests.el
1 ;;; clang-tests.el --- company-mode tests -*- lexical-binding: t -*-
2
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
4
5 ;; Author: Dmitry Gutov
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22 (require 'company-tests)
23 (require 'company-clang)
24
25 (ert-deftest company-clang-simple-annotation ()
26 (let ((str (propertize
27 "foo" 'meta
28 "wchar_t * wmemchr(wchar_t *__p, wchar_t __c, size_t __n)")))
29 (should (equal (company-clang 'annotation str)
30 "(wchar_t *__p, wchar_t __c, size_t __n)"))))
31
32 (ert-deftest company-clang-generic-annotation ()
33 (let ((str (propertize
34 "foo" 'meta
35 "shared_ptr<_Tp> make_shared<typename _Tp>(_Args &&__args...)")))
36 (should (equal (company-clang 'annotation str)
37 "<typename _Tp>(_Args &&__args...)"))))
38
39 (ert-deftest company-clang-func-ptr-annotation ()
40 (let ((str (propertize "foo" 'meta "void (*)(int) foo")))
41 (should (equal (company-clang 'annotation str) "(*)(int)"))))
42
43 (ert-deftest company-clang-null-annotation ()
44 (let ((str "char"))
45 (should (null (company-clang 'annotation str)))))