1 ;;; clang-tests.el --- company-mode tests -*- lexical-binding: t -*-
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
5 ;; Author: Dmitry Gutov
7 ;; This file is part of GNU Emacs.
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.
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.
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/>.
22 (require 'company-tests)
23 (require 'company-clang)
25 (ert-deftest company-clang-simple-annotation ()
26 (let ((str (propertize
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)"))))
32 (ert-deftest company-clang-generic-annotation ()
33 (let ((str (propertize
35 "shared_ptr<_Tp> make_shared<typename _Tp>(_Args &&__args...)")))
36 (should (equal (company-clang 'annotation str)
37 "<typename _Tp>(_Args &&__args...)"))))
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)"))))
43 (ert-deftest company-clang-null-annotation ()
45 (should (null (company-clang 'annotation str)))))