diff options
| author | Michal Nazarewicz | 2020-05-04 19:08:10 +0100 |
|---|---|---|
| committer | Michal Nazarewicz | 2020-05-09 11:30:32 +0100 |
| commit | ae3c510696f02f01d03052f070e5ce65b4018a45 (patch) | |
| tree | 7ffda57aed8788d8b0cbfbb16d486c0d0db15b97 /test | |
| parent | fab23328512e47a50caced8d074e86e583cc8a9f (diff) | |
| download | emacs-ae3c510696f02f01d03052f070e5ce65b4018a45.tar.gz emacs-ae3c510696f02f01d03052f070e5ce65b4018a45.zip | |
cc-mode: extend regexp used by ‘c-or-c++-mode’
* lisp/progmodes/cc-mode (c-or-c++-mode--regexp): Expand the regexp to
match some more C++-only constructs and recognise a few more standard
C++ header files. Also make sure identifiers start with non-digit.
(c-or-c++-mode): Add ‘(interactive)’ declaration.
* test/lisp/progmodes/cc-mode-tests.el (c-or-c++-mode): Add test case
for the newly recognised constructs.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/cc-mode-tests.el | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/lisp/progmodes/cc-mode-tests.el b/test/lisp/progmodes/cc-mode-tests.el index ad7a52b40d9..64d52a952b6 100644 --- a/test/lisp/progmodes/cc-mode-tests.el +++ b/test/lisp/progmodes/cc-mode-tests.el | |||
| @@ -40,7 +40,7 @@ | |||
| 40 | (insert content) | 40 | (insert content) |
| 41 | (setq mode nil) | 41 | (setq mode nil) |
| 42 | (c-or-c++-mode) | 42 | (c-or-c++-mode) |
| 43 | (unless(eq expected mode) | 43 | (unless (eq expected mode) |
| 44 | (ert-fail | 44 | (ert-fail |
| 45 | (format "expected %s but got %s when testing '%s'" | 45 | (format "expected %s but got %s when testing '%s'" |
| 46 | expected mode content))))) | 46 | expected mode content))))) |
| @@ -53,11 +53,18 @@ | |||
| 53 | (funcall do-test (concat " * " content) 'c-mode)) | 53 | (funcall do-test (concat " * " content) 'c-mode)) |
| 54 | '("using \t namespace \t std;" | 54 | '("using \t namespace \t std;" |
| 55 | "using \t std::string;" | 55 | "using \t std::string;" |
| 56 | "using Foo = Bar;" | ||
| 56 | "namespace \t {" | 57 | "namespace \t {" |
| 57 | "namespace \t foo \t {" | 58 | "namespace \t foo \t {" |
| 58 | "class \t Blah_42 \t {" | 59 | "namespace \t foo::bar \t {" |
| 60 | "inline namespace \t foo \t {" | ||
| 61 | "inline namespace \t foo::bar \t {" | ||
| 59 | "class \t Blah_42 \t \n" | 62 | "class \t Blah_42 \t \n" |
| 63 | "class \t Blah_42;" | ||
| 64 | "class \t Blah_42 \t final {" | ||
| 65 | "struct \t Blah_42 \t final {" | ||
| 60 | "class \t _42_Blah:public Foo {" | 66 | "class \t _42_Blah:public Foo {" |
| 67 | "struct \t _42_Blah:public Foo {" | ||
| 61 | "template \t < class T >" | 68 | "template \t < class T >" |
| 62 | "template< class T >" | 69 | "template< class T >" |
| 63 | "#include <string>" | 70 | "#include <string>" |
| @@ -67,6 +74,7 @@ | |||
| 67 | (mapc (lambda (content) (funcall do-test content 'c-mode)) | 74 | (mapc (lambda (content) (funcall do-test content 'c-mode)) |
| 68 | '("struct \t Blah_42 \t {" | 75 | '("struct \t Blah_42 \t {" |
| 69 | "struct template {" | 76 | "struct template {" |
| 77 | "struct Blah;" | ||
| 70 | "#include <string.h>"))))) | 78 | "#include <string.h>"))))) |
| 71 | 79 | ||
| 72 | (ert-deftest c-mode-macro-comment () | 80 | (ert-deftest c-mode-macro-comment () |