]> code.delx.au - gnu-emacs-elpa/blob - packages/company/test/clang-tests.el
Update packages/yasnippet by subtree-merging from its github-based upstream
[gnu-emacs-elpa] / packages / company / 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-objc-templatify ()
26 (with-temp-buffer
27 (let ((text "createBookWithTitle:andAuthor:"))
28 (insert text)
29 (company-clang-objc-templatify text)
30 (should (equal "createBookWithTitle:arg0 andAuthor:arg1" (buffer-string)))
31 (should (looking-at "arg0"))
32 (should (null (overlay-get (company-template-field-at) 'display))))))
33
34 (ert-deftest company-clang-simple-annotation ()
35 (let ((str (propertize
36 "foo" 'meta
37 "wchar_t * wmemchr(wchar_t *__p, wchar_t __c, size_t __n)")))
38 (should (equal (company-clang 'annotation str)
39 "(wchar_t *__p, wchar_t __c, size_t __n)"))))
40
41 (ert-deftest company-clang-generic-annotation ()
42 (let ((str (propertize
43 "foo" 'meta
44 "shared_ptr<_Tp> make_shared<typename _Tp>(_Args &&__args...)")))
45 (should (equal (company-clang 'annotation str)
46 "<typename _Tp>(_Args &&__args...)"))))