From: David Engster Date: Sun, 25 Jan 2015 22:10:13 +0000 (+0100) Subject: semantic/bovine/c: Add support for typedef references X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=19646a74e054a238793a06efd9644935a009be5c;p=emacs.git semantic/bovine/c: Add support for typedef references * semantic/bovine/c.by (typedefname): Also parse optional reference qualifier. * semantic/bovine/c.el (semantic-expand-c-tag-namelist): Add :reference attribute for typedefs. * tests/cedet/semantic/ert/test-c-parser.el: Add tests for typedefs. --- diff --git a/test/manual/cedet/cedet/semantic/ert/test-c-parser.el b/test/manual/cedet/cedet/semantic/ert/test-c-parser.el index 050da7fb5b7..f9e78449e64 100644 --- a/test/manual/cedet/cedet/semantic/ert/test-c-parser.el +++ b/test/manual/cedet/cedet/semantic/ert/test-c-parser.el @@ -196,4 +196,30 @@ (setq actual (car actual)) (test-c-parser-compare-tag actual expect))) +;;;; Typedef + +(ert-deftest test-c-parser-typedef-01 () + (let ((actual + (test-c-parser-bovinate "typedef int foo;")) + (expect '("foo" type (:typedef ("int") :type "typedef")))) + (should (test-c-check-tags-length actual 1)) + (setq actual (car actual)) + (test-c-parser-compare-tag actual expect))) + +(ert-deftest test-c-parser-typedef-02-pointer () + (let ((actual + (test-c-parser-bovinate "typedef int* foo;")) + (expect '("foo" type (:typedef ("int") :pointer 1 :type "typedef")))) + (should (test-c-check-tags-length actual 1)) + (setq actual (car actual)) + (test-c-parser-compare-tag actual expect))) + +(ert-deftest test-c-parser-typedef-03-reference () + (let ((actual + (test-c-parser-bovinate "typedef int& foo;")) + (expect '("foo" type (:typedef ("int") :reference 1 :type "typedef")))) + (should (test-c-check-tags-length actual 1)) + (setq actual (car actual)) + (test-c-parser-compare-tag actual expect))) + (provide 'cedet/semantic/ert/test-c-parser)