diff options
author | Phillip Lord <phillip.lord@russet.org.uk> | 2015-11-23 22:02:42 +0000 |
---|---|---|
committer | Phillip Lord <phillip.lord@russet.org.uk> | 2015-11-24 17:04:22 +0000 |
commit | 22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e (patch) | |
tree | 779ff7e07667194416e01c6a6e8bd7b970244c70 /test/manual/cedet/tests | |
parent | c378d6c33f751d1a0b97958f3cacfe0b07c72f58 (diff) | |
download | emacs-22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e.tar.gz emacs-22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e.tar.bz2 emacs-22bbf7ca22f11cc33d887d0162cf2ec6661c3a3e.zip |
Rename all test files to reflect source layout.
* CONTRIBUTE,Makefile.in,configure.ac: Update to reflect
test directory moves.
* test/file-organisation.org: New file.
* test/automated/Makefile.in
test/automated/data/decompress/foo.gz
test/automated/data/epg/pubkey.asc
test/automated/data/epg/seckey.asc
test/automated/data/files-bug18141.el.gz
test/automated/data/flymake/test.c
test/automated/data/flymake/test.pl
test/automated/data/package/archive-contents
test/automated/data/package/key.pub
test/automated/data/package/key.sec
test/automated/data/package/multi-file-0.2.3.tar
test/automated/data/package/multi-file-readme.txt
test/automated/data/package/newer-versions/archive-contents
test/automated/data/package/newer-versions/new-pkg-1.0.el
test/automated/data/package/newer-versions/simple-single-1.4.el
test/automated/data/package/package-test-server.py
test/automated/data/package/signed/archive-contents
test/automated/data/package/signed/archive-contents.sig
test/automated/data/package/signed/signed-bad-1.0.el
test/automated/data/package/signed/signed-bad-1.0.el.sig
test/automated/data/package/signed/signed-good-1.0.el
test/automated/data/package/signed/signed-good-1.0.el.sig
test/automated/data/package/simple-depend-1.0.el
test/automated/data/package/simple-single-1.3.el
test/automated/data/package/simple-single-readme.txt
test/automated/data/package/simple-two-depend-1.1.el
test/automated/abbrev-tests.el
test/automated/auto-revert-tests.el
test/automated/calc-tests.el
test/automated/icalendar-tests.el
test/automated/character-fold-tests.el
test/automated/comint-testsuite.el
test/automated/descr-text-test.el
test/automated/electric-tests.el
test/automated/cl-generic-tests.el
test/automated/cl-lib-tests.el
test/automated/eieio-test-methodinvoke.el
test/automated/eieio-test-persist.el
test/automated/eieio-tests.el
test/automated/ert-tests.el
test/automated/ert-x-tests.el
test/automated/generator-tests.el
test/automated/let-alist.el
test/automated/map-tests.el
test/automated/advice-tests.el
test/automated/package-test.el
test/automated/pcase-tests.el
test/automated/regexp-tests.el
test/automated/seq-tests.el
test/automated/subr-x-tests.el
test/automated/tabulated-list-test.el
test/automated/thunk-tests.el
test/automated/timer-tests.el
test/automated/epg-tests.el
test/automated/eshell.el
test/automated/faces-tests.el
test/automated/file-notify-tests.el
test/automated/auth-source-tests.el
test/automated/gnus-tests.el
test/automated/message-mode-tests.el
test/automated/help-fns.el
test/automated/imenu-test.el
test/automated/info-xref.el
test/automated/mule-util.el
test/automated/isearch-tests.el
test/automated/json-tests.el
test/automated/bytecomp-tests.el
test/automated/coding-tests.el
test/automated/core-elisp-tests.el
test/automated/decoder-tests.el
test/automated/files.el
test/automated/font-parse-tests.el
test/automated/lexbind-tests.el
test/automated/occur-tests.el
test/automated/process-tests.el
test/automated/syntax-tests.el
test/automated/textprop-tests.el
test/automated/undo-tests.el
test/automated/man-tests.el
test/automated/completion-tests.el
test/automated/dbus-tests.el
test/automated/newsticker-tests.el
test/automated/sasl-scram-rfc-tests.el
test/automated/tramp-tests.el
test/automated/obarray-tests.el
test/automated/compile-tests.el
test/automated/elisp-mode-tests.el
test/automated/f90.el
test/automated/flymake-tests.el
test/automated/python-tests.el
test/automated/ruby-mode-tests.el
test/automated/subword-tests.el
test/automated/replace-tests.el
test/automated/simple-test.el
test/automated/sort-tests.el
test/automated/subr-tests.el
test/automated/reftex-tests.el
test/automated/sgml-mode-tests.el
test/automated/tildify-tests.el
test/automated/thingatpt.el
test/automated/url-future-tests.el
test/automated/url-util-tests.el
test/automated/add-log-tests.el
test/automated/vc-bzr.el
test/automated/vc-tests.el
test/automated/xml-parse-tests.el
test/BidiCharacterTest.txt
test/biditest.el
test/cedet/cedet-utests.el
test/cedet/ede-tests.el
test/cedet/semantic-ia-utest.el
test/cedet/semantic-tests.el
test/cedet/semantic-utest-c.el
test/cedet/semantic-utest.el
test/cedet/srecode-tests.el
test/cedet/tests/test.c
test/cedet/tests/test.el
test/cedet/tests/test.make
test/cedet/tests/testdoublens.cpp
test/cedet/tests/testdoublens.hpp
test/cedet/tests/testfriends.cpp
test/cedet/tests/testjavacomp.java
test/cedet/tests/testnsp.cpp
test/cedet/tests/testpolymorph.cpp
test/cedet/tests/testspp.c
test/cedet/tests/testsppcomplete.c
test/cedet/tests/testsppreplace.c
test/cedet/tests/testsppreplaced.c
test/cedet/tests/testsubclass.cpp
test/cedet/tests/testsubclass.hh
test/cedet/tests/testtypedefs.cpp
test/cedet/tests/testvarnames.c
test/etags/CTAGS.good
test/etags/ETAGS.good_1
test/etags/ETAGS.good_2
test/etags/ETAGS.good_3
test/etags/ETAGS.good_4
test/etags/ETAGS.good_5
test/etags/ETAGS.good_6
test/etags/a-src/empty.zz
test/etags/a-src/empty.zz.gz
test/etags/ada-src/2ataspri.adb
test/etags/ada-src/2ataspri.ads
test/etags/ada-src/etags-test-for.ada
test/etags/ada-src/waroquiers.ada
test/etags/c-src/a/b/b.c
test/etags/c-src/abbrev.c
test/etags/c-src/c.c
test/etags/c-src/dostorture.c
test/etags/c-src/emacs/src/gmalloc.c
test/etags/c-src/emacs/src/keyboard.c
test/etags/c-src/emacs/src/lisp.h
test/etags/c-src/emacs/src/regex.h
test/etags/c-src/etags.c
test/etags/c-src/exit.c
test/etags/c-src/exit.strange_suffix
test/etags/c-src/fail.c
test/etags/c-src/getopt.h
test/etags/c-src/h.h
test/etags/c-src/machsyscalls.c
test/etags/c-src/machsyscalls.h
test/etags/c-src/sysdep.h
test/etags/c-src/tab.c
test/etags/c-src/torture.c
test/etags/cp-src/MDiagArray2.h
test/etags/cp-src/Range.h
test/etags/cp-src/burton.cpp
test/etags/cp-src/c.C
test/etags/cp-src/clheir.cpp.gz
test/etags/cp-src/clheir.hpp
test/etags/cp-src/conway.cpp
test/etags/cp-src/conway.hpp
test/etags/cp-src/fail.C
test/etags/cp-src/functions.cpp
test/etags/cp-src/screen.cpp
test/etags/cp-src/screen.hpp
test/etags/cp-src/x.cc
test/etags/el-src/TAGTEST.EL
test/etags/el-src/emacs/lisp/progmodes/etags.el
test/etags/erl-src/gs_dialog.erl
test/etags/f-src/entry.for
test/etags/f-src/entry.strange.gz
test/etags/f-src/entry.strange_suffix
test/etags/forth-src/test-forth.fth
test/etags/html-src/algrthms.html
test/etags/html-src/index.shtml
test/etags/html-src/software.html
test/etags/html-src/softwarelibero.html
test/etags/lua-src/allegro.lua
test/etags/objc-src/PackInsp.h
test/etags/objc-src/PackInsp.m
test/etags/objc-src/Subprocess.h
test/etags/objc-src/Subprocess.m
test/etags/objcpp-src/SimpleCalc.H
test/etags/objcpp-src/SimpleCalc.M
test/etags/pas-src/common.pas
test/etags/perl-src/htlmify-cystic
test/etags/perl-src/kai-test.pl
test/etags/perl-src/yagrip.pl
test/etags/php-src/lce_functions.php
test/etags/php-src/ptest.php
test/etags/php-src/sendmail.php
test/etags/prol-src/natded.prolog
test/etags/prol-src/ordsets.prolog
test/etags/ps-src/rfc1245.ps
test/etags/pyt-src/server.py
test/etags/tex-src/gzip.texi
test/etags/tex-src/nonewline.tex
test/etags/tex-src/testenv.tex
test/etags/tex-src/texinfo.tex
test/etags/y-src/atest.y
test/etags/y-src/cccp.c
test/etags/y-src/cccp.y
test/etags/y-src/parse.c
test/etags/y-src/parse.y
test/indent/css-mode.css
test/indent/js-indent-init-dynamic.js
test/indent/js-indent-init-t.js
test/indent/js-jsx.js
test/indent/js.js
test/indent/latex-mode.tex
test/indent/modula2.mod
test/indent/nxml.xml
test/indent/octave.m
test/indent/pascal.pas
test/indent/perl.perl
test/indent/prolog.prolog
test/indent/ps-mode.ps
test/indent/ruby.rb
test/indent/scheme.scm
test/indent/scss-mode.scss
test/indent/sgml-mode-attribute.html
test/indent/shell.rc
test/indent/shell.sh
test/redisplay-testsuite.el
test/rmailmm.el
test/automated/buffer-tests.el
test/automated/cmds-tests.el
test/automated/data-tests.el
test/automated/finalizer-tests.el
test/automated/fns-tests.el
test/automated/inotify-test.el
test/automated/keymap-tests.el
test/automated/print-tests.el
test/automated/libxml-tests.el
test/automated/zlib-tests.el: Files Moved.
Diffstat (limited to 'test/manual/cedet/tests')
-rw-r--r-- | test/manual/cedet/tests/test.c | 242 | ||||
-rw-r--r-- | test/manual/cedet/tests/test.el | 158 | ||||
-rw-r--r-- | test/manual/cedet/tests/test.make | 79 | ||||
-rw-r--r-- | test/manual/cedet/tests/testdoublens.cpp | 166 | ||||
-rw-r--r-- | test/manual/cedet/tests/testdoublens.hpp | 70 | ||||
-rw-r--r-- | test/manual/cedet/tests/testfriends.cpp | 38 | ||||
-rw-r--r-- | test/manual/cedet/tests/testjavacomp.java | 67 | ||||
-rw-r--r-- | test/manual/cedet/tests/testnsp.cpp | 29 | ||||
-rw-r--r-- | test/manual/cedet/tests/testpolymorph.cpp | 130 | ||||
-rw-r--r-- | test/manual/cedet/tests/testspp.c | 102 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsppcomplete.c | 30 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsppreplace.c | 154 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsppreplaced.c | 117 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsubclass.cpp | 249 | ||||
-rw-r--r-- | test/manual/cedet/tests/testsubclass.hh | 191 | ||||
-rw-r--r-- | test/manual/cedet/tests/testtypedefs.cpp | 81 | ||||
-rw-r--r-- | test/manual/cedet/tests/testvarnames.c | 90 |
17 files changed, 1993 insertions, 0 deletions
diff --git a/test/manual/cedet/tests/test.c b/test/manual/cedet/tests/test.c new file mode 100644 index 00000000000..8f7208783ff --- /dev/null +++ b/test/manual/cedet/tests/test.c @@ -0,0 +1,242 @@ +/* test.c --- Semantic unit test for C. + + Copyright (C) 2001-2015 Free Software Foundation, Inc. + + Author: Eric M. Ludlam <eric@siege-engine.com> + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* Attempt to include as many aspects of the C language as possible. + */ + +/* types of include files */ +#include "includeme1.h" +#include <includeme2.h> +#include <subdir/includeme3.h> +#include <includeme.notanhfile> +#include <stdlib.h> +#include <cmath> + +#if 0 +int dont_show_function() +{ +} +#endif + +/* Global types */ +struct mystruct1 { + int slot11; + char slot12; + float slot13; +}; + +struct mystruct2 { + int slot21; + char slot22; + float slot23; +} var_of_type_mystruct2; + +struct { + int slot31; + char slot32; + float slot33; +} var_of_anonymous_struct; + +typedef struct mystruct1 typedef_of_mystruct1; +typedef struct mystruct1 *typedef_of_pointer_mystruct1; +typedef struct { int slot_a; } typedef_of_anonymous_struct; +typedef struct A { +} B; + +typedef struct mystruct1 td1, td2; + +union myunion1 { + int slot41; + char slot42; + float slot43; +}; + +union myunion2 { + int slot51; + char slot52; + float slot53; +} var_of_type_myunion2; + +struct { + int slot61; + char slot72; + float slot83; +} var_of_anonymous_union; + +typedef union myunion1 typedef_of_myunion1; +typedef union myunion1 *typedef_of_pointer_myunion1; +typedef union { int slot_a; } typedef_of_anonymous_union; + +enum myenum1 { enum11 = 1, enum12 }; +enum myenum2 { enum21, enum22 = 2 } var_of_type_myenum2; +enum { enum31, enum32 } var_of_anonymous_enum; + +typedef enum myenum1 typedef_of_myenum1; +typedef enum myenum1 *typedef_of_pointer_myenum1; +typedef enum { enum_a = 3, enum_b } typedef_of_anonymous_enum; + +typedef int typedef_of_int; + +/* Here are some simpler variable types */ +int var1; +int varbit1:1; +char var2; +float var3; +mystruct1 var3; +struct mystruct1 var4; +union myunion1 var5; +enum myenum1 var6; + +char *varp1; +char **varp2; +char varv1[1]; +char varv2[1][2]; + +char *varpa1 = "moose"; +struct mystruct2 vara2 = { 1, 'a', 0.0 }; +enum myenum1 vara3 = enum11; +int vara4 = (int)0.0; +int vara5 = funcall(); + +int mvar1, mvar2, mvar3; +char *mvarp1, *mvarp2, *mvarp3; +char *mvarpa1 = 'a', *mvarpa2 = 'b', *mvarpa3 = 'c'; +char mvaras1[10], mvaras2[12][13], *mvaras3 = 'd'; + +static register const unsigned int tmvar1; + +#define MACRO1 1 +#define MACRO2(foo) (1+foo) + +/* Here are some function prototypes */ + +/* This is legal, but I decided not to support inferred integer + * types on functions and variables. + */ +fun0(); +int funp1(); +char funp2(int arg11); +float funp3(char arg21, char arg22); +struct mystrct1 funp4(struct mystruct2 arg31, union myunion2 arg32); +enum myenum1 funp5(char *arg41, union myunion1 *arg42); + +char funpp1 __P(char argp1, struct mystruct2 argp2, char *arg4p); + +int fun1(); + +/* Here is a function pointer */ +int (*funcptr)(int a, int b); + +/* Function Definitions */ + +/* This is legal, but I decided not to support inferred integer + * types on functions and variables. + */ +fun0() +{ + int sv = 0; +} + +int fun1 () +{ + int sv = 1; +} + +int fun1p1 (void) +{ + int sv = 1; +} + +char fun2(int arg_11) +{ + char sv = 2; +} + +float fun3(char arg_21, char arg_22) +{ + char sv = 3; +} + +struct mystrct1 fun4(struct mystruct2 arg31, union myunion2 arg32) +{ + sv = 4; +} + +enum myenum1 fun5(char *arg41, union myunion1 *arg42) +{ + sv = 5; +} + +/* Functions with K&R syntax. */ +struct mystrct1 funk1(arg_31, arg_32) + struct mystruct2 arg_31; + union myunion2 arg32; +{ + sv = 4; +} + +enum myenum1 *funk2(arg_41, arg_42) + char *arg_41; + union myunion1 *arg_42; +{ + sv = 5; + + if(foo) { + } +} + +int funk3(arg_51, arg_53) + int arg_51; + char arg_53; +{ + char q = 'a'; + int sv = 6; + td1 ms1; + enum myenum1 testconst; + + /* Function argument analysis */ + funk3(ms1.slot11, arg_53 ); + sv = 7; + + /* Slot deref on assignee */ + ms1.slot11 = s; + + /* Enum/const completion */ + testconst = e; + + /* Bad var/slot and param */ + blah.notafunction(moose); + + /* Print something. */ + printf("Moose", ); + + tan(); +} + +int funk4_fixme(arg_61, arg_62) + int arg_61, arg_62; +{ + +} + +/* End of C tests */ + diff --git a/test/manual/cedet/tests/test.el b/test/manual/cedet/tests/test.el new file mode 100644 index 00000000000..28b97750df2 --- /dev/null +++ b/test/manual/cedet/tests/test.el @@ -0,0 +1,158 @@ +;;; test.el --- Unit test file for Semantic Emacs Lisp support. + +;; Copyright (C) 2005-2015 Free Software Foundation, Inc. + +;; Author: Eric M. Ludlam <eric@siege-engine.com> + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;;; Require +;; +(require 'semantic) +(require 'eieio "../eieio") + +;; tags encapsulated in eval-when-compile and eval-and-compile +;; should be expanded out into the outer environment. +(eval-when-compile + (require 'semantic-imenu) + ) + +(eval-and-compile + (defconst const-1 nil) + (defun function-1 (arg) + nil) + ) + +;;; Functions +;; +(defun a-defun (arg1 arg2 &optional arg3) + "doc a" + nil) + +(defun a-defun-interactive (arg1 arg2 &optional arg3) + "doc a that is a command" + (interactive "R") + nil) + +(defun* a-defun* (arg1 arg2 &optional arg3) + "doc a*" + nil) + +(defsubst a-defsubst (arg1 arg2 &optional arg3) + "doc a-subst" + nil) + +(defmacro a-defmacro (arg1 arg2 &optional arg3) + "doc a-macro" + nil) + +(define-overload a-overload (arg) + "doc a-overload" + nil) + +;;; Methods +;; +(defmethod a-method ((obj some-class) &optional arg2) + "Doc String for a method." + (call-next-method)) + +(defgeneric a-generic (arg1 arg2) + "General description of a-generic.") + +;;; Advice +;; +(defadvice existing-function-to-advise (around test activate) + "Do something special to this fcn." + (ad-do-it)) + +;;; Variables +;; +(defvar a-defvar (cons 1 2) + "Variable a") + +(defvar a-defvar-star (cons 1 2) + "*User visible var a") + +(defconst a-defconst 'a "var doc const") + +(defcustom a-defcustom nil + "*doc custom" + :group 'a-defgroup + :type 'boolean) + +(defface a-defface 'bold + "A face that is bold.") + +(defimage ezimage-page-minus + ((:type xpm :file "page-minus.xpm" :ascent center)) + "Image used for open files with stuff in them.") + +;;; Autoloads +;; +(autoload (quote a-autoload) "somefile" + "Non-interactive autoload." nil nil) + +(autoload (quote a-autoload-interactive) "somefile" +"Interactive autoload." t nil) + + +(defgroup a-defgroup nil + "Group for `emacs-lisp' regression-test") + +;;; Classes +;; +(defclass a-class (a-parent) + ((slot-1) + (slot-2 :initarg :slot-2) + (slot-3 :documentation "Doc about slot3") + (slot-4 :type 'boolean) + ) + "Doc String for class.") + +(defclass a-class-abstract () + nil + "Doc string for abstract class." + :abstract t) + +;;; Structures +;; +(defstruct (test-struct-1 :test 'equal) + (slot-1 :equal 'eq) + slot-2) + +(defstruct test-struct-2 + slot-1 + slot-2) + +;;; Semantic specific macros +;; +(define-lex a-lexer + "Doc String" + this + that) + +(define-mode-local-override a-overridden-function + emacs-lisp-mode (tag) + "A function that is overloaded." + nil) + +(defvar-mode-local emacs-lisp-mode a-mode-local-def + "some value") + + +;;; Provide +;; +(provide 'test) diff --git a/test/manual/cedet/tests/test.make b/test/manual/cedet/tests/test.make new file mode 100644 index 00000000000..ac8c599ee35 --- /dev/null +++ b/test/manual/cedet/tests/test.make @@ -0,0 +1,79 @@ +# test.make --- Semantic unit test for Make -*- makefile -*- + +# Copyright (C) 2001-2002, 2010-2015 Free Software Foundation, Inc. + +# Author: Eric M. Ludlam <eric@siege-engine.com> + +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +top= +ede_FILES=Project.ede Makefile + +example_MISC=semantic-skel.el skeleton.bnf +init_LISP=semantic-load.el +DISTDIR=$(top)semantic-$(VERSION) + +# really goofy & variables tabs +A= B +A =B +A=B C +A=B\ + C + +A= http://${B} \ + ftp://${B} +B= test + +all: example semantic Languages tools senator semantic.info + +test ${B}: foo bar + @echo ${A} + +example: + @ + +init: $(init_LISP) + @echo "(add-to-list 'load-path nil)" > $@-compile-script + @if test ! -z "${LOADPATH}" ; then\ + for loadpath in ${LOADPATH}; do \ + echo "(add-to-list 'load-path \"$$loadpath\")" >> $@-compile-script; \ + done;\ + fi + @echo "(setq debug-on-error t)" >> $@-compile-script + $(EMACS) -batch -l $@-compile-script -f batch-byte-compile $^ + +include tesset.mk tusset.mk +include oneset.mk + +ifdef SOME_SYMBOL + VAR1 = foo +else + VAR1 = bar +endif + +ifndef SOME_OTHER_SYMBOL + VAR1 = baz +endif + +ifeq ($(VAR1), foo) + VAR2 = gleep +else + ifneq ($(VAR1), foo) + VAR2 = glop + endif +endif + +# End of Makefile diff --git a/test/manual/cedet/tests/testdoublens.cpp b/test/manual/cedet/tests/testdoublens.cpp new file mode 100644 index 00000000000..b503c211790 --- /dev/null +++ b/test/manual/cedet/tests/testdoublens.cpp @@ -0,0 +1,166 @@ +// testdoublens.cpp --- semantic-ia-utest completion engine unit tests + +// Copyright (C) 2008-2015 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam <eric@siege-engine.com> + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +#include "testdoublens.hpp" + +namespace Name1 { + namespace Name2 { + + Foo::Foo() + { + p// -1- + // #1# ( "pMumble" "publishStuff" ) + ; + } + + int Foo::get() // ^1^ + { + p// -2- + // #2# ( "pMumble" "publishStuff" ) + ; + return 0; + } + + void Foo::publishStuff(int /* a */, int /* b */) // ^2^ + { + } + + void Foo::sendStuff(int /* a */, int /* b */) // ^3^ + { + } + + } // namespace Name2 +} // namespace Name1 + +// Test multiple levels of metatype expansion +int test_fcn () { + stage3_Foo MyFoo; + + MyFoo.// -3- + // #3# ( "Mumble" "get" ) + ; + + Name1::Name2::F//-4- + // #4# ( "Foo" ) + ; + + // @TODO - get this working... + Name1::stage2_Foo::M//-5- + /// #5# ( "Mumble" ) + ; +} + +stage3_Foo foo_fcn() { + // Can we go "up" to foo with senator-go-to-up-reference? +} + + +// Second test from Ravikiran Rajagopal + +namespace A { + class foo { + public: + void aa(); + void bb(); + }; +} +namespace A { + class bar { + public: + void xx(); + public: + foo myFoo; + }; + + void bar::xx() + { + myFoo.// -6- <--- cursor is here after the dot + // #6# ( "aa" "bb" ) + ; + } +} + +// Double namespace example from Hannu Koivisto +// +// This is tricky because the parent class "Foo" is found within the +// scope of B, so the scope calculation needs to put that together +// before searching for parents in scope. +namespace a { + namespace b { + + class Bar : public Foo + { + int baz(); + }; + + int Bar::baz() + { + return dum// -7- + // #7# ( "dumdum" ) + ; + } + + } // namespace b +} // namespace a + +// Three namespace example from Hannu Koivisto +// +// This one is special in that the name e::Foo, where "e" is in +// the scope, and not referenced from the global namespace. This +// wasn't previously handled, so the fullscope needed to be added +// to the list of things searched when in split-name decent search mode +// for scopes. + +namespace d { + namespace e { + + class Foo + { + public: + int write(); + }; + + } // namespace d +} // namespace e + + +namespace d { + namespace f { + + class Bar + { + public: + int baz(); + + private: + e::Foo &foo; + }; + + int Bar::baz() + { + return foo.w// -8- + // #8# ( "write" ) + ; + } + + } // namespace f +} // namespace d + diff --git a/test/manual/cedet/tests/testdoublens.hpp b/test/manual/cedet/tests/testdoublens.hpp new file mode 100644 index 00000000000..609ea74615e --- /dev/null +++ b/test/manual/cedet/tests/testdoublens.hpp @@ -0,0 +1,70 @@ +// testdoublens.hpp --- Header file used in one of the Semantic tests + +// Copyright (C) 2008-2015 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam <eric@siege-engine.com> + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +namespace Name1 { + namespace Name2 { + + class Foo + { + typedef unsigned int Mumble; + public: + Foo(); + ~Foo(); + int get(); + + private: + void publishStuff(int a, int b); + + void sendStuff(int a, int b); + + Mumble* pMumble; + }; + + typedef Foo stage1_Foo; + + } // namespace Name2 + + typedef Name2::stage1_Foo stage2_Foo; + + typedef Name2::Foo decl_stage1_Foo; + +} // namespace Name1 + +typedef Name1::stage2_Foo stage3_Foo; + + +// Double namespace from Hannu Koivisto +namespace a { + namespace b { + + class Foo + { + struct Dum { + int diDum; + }; + + protected: + mutable a::b::Foo::Dum dumdum; + }; + + } // namespace b +} // namespace a + diff --git a/test/manual/cedet/tests/testfriends.cpp b/test/manual/cedet/tests/testfriends.cpp new file mode 100644 index 00000000000..20425f93afa --- /dev/null +++ b/test/manual/cedet/tests/testfriends.cpp @@ -0,0 +1,38 @@ +// Test parsing of friends and how they are used in completion. +/* + >> Thanks Damien Profeta for the nice example. + > + > I paste a small example. + > It would be great if friend can be well parsed and even greater if + > class B can access to all the members of A. +*/ + +class Af // %2% ( ( "testfriends.cpp" ) ( "Af" "B::testB" ) ) +{ +public: + int pubVar; +private: + int privateVar; + + friend class B; + +}; + +class B +{ +public: + int testB(); + int testAB(); + +}; + + +int B::testB() { + Af classA; + classA.//-1- + ; //#1# ( "privateVar" "pubVar" ) +} + +int B::testAB() { // %1% ( ( "testfriends.cpp" ) ( "B" "B::testAB" ) ) +} + diff --git a/test/manual/cedet/tests/testjavacomp.java b/test/manual/cedet/tests/testjavacomp.java new file mode 100644 index 00000000000..d17f3049b62 --- /dev/null +++ b/test/manual/cedet/tests/testjavacomp.java @@ -0,0 +1,67 @@ +// testjavacomp.java --- Semantic unit test for Java + +// Copyright (C) 2009-2015 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam <eric@siege-engine.com> + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +package tests.testjavacomp; + +class secondClass { + private void scFuncOne() { } + public void scFuncOne() { } +} + + +public class testjavacomp { + + private int funcOne() { } + private int funcTwo() { } + private char funcThree() { } + + class nestedClass { + private void ncFuncOne() { } + public void ncFuncOne() { } + } + + public void publicFunc() { + + int i; + + i = fu// -1- + // #1# ( "funcOne" "funcTwo" ) + ; + + fu// -2- + // #2# ( "funcOne" "funcThree" "funcTwo" ) + ; + + secondClass SC; + + SC.//-3- + // #3# ( "scFuncOne" ) + ; + + nestedClass NC; + + // @todo - need to fix this? I don't know if this is legal java. + NC.// - 4- + // #4# ( "ncFuncOne" ) + ; + } + +} // testjavacomp diff --git a/test/manual/cedet/tests/testnsp.cpp b/test/manual/cedet/tests/testnsp.cpp new file mode 100644 index 00000000000..012dc660600 --- /dev/null +++ b/test/manual/cedet/tests/testnsp.cpp @@ -0,0 +1,29 @@ +// Test NSP (Name space parent) +// +// Test dereferencing parents based on local parent scope. +// +// Derived from data David Engster provided. + +namespace nsp { + + class rootclass { + public: + int fromroot() {}; + }; + +} + +namespace nsp { + class childclass : public rootclass { + public: + int fromchild() {}; + }; +} + +void myfcn_not_in_ns (void) { + nsp::childclass test; + + test.// -1- + ; // #1# ( "fromchild" "fromroot" ) +} + diff --git a/test/manual/cedet/tests/testpolymorph.cpp b/test/manual/cedet/tests/testpolymorph.cpp new file mode 100644 index 00000000000..9195bb670c2 --- /dev/null +++ b/test/manual/cedet/tests/testpolymorph.cpp @@ -0,0 +1,130 @@ +/** testpolymorph.cpp --- A sequence of polymorphism examples. + * + * Copyright (C) 2009-2015 Free Software Foundation, Inc. + * + * Author: Eric M. Ludlam <eric@siege-engine.com> + * + * This file is part of GNU Emacs. + * + * GNU Emacs is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GNU Emacs is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <cmath> + +// Test 1 - Functions w/ prototypes +namespace proto { + + int pt_func1(int arg1); + int pt_func1(int arg1) { + return 0; + } + +} + +// Test 2 - Functions w/ different arg lists. +namespace fcn_poly { + + int pm_func(void) { + return 0; + } + int pm_func(int a) { + return a; + } + int pm_func(char a) { + return int(a); + } + int pm_func(double a) { + return int(floor(a)); + } + +} + +// Test 3 - Methods w/ different arg lists. +class meth_poly { +public: + int pm_meth(void) { + return 0; + } + int pm_meth(int a) { + return a; + } + int pm_meth(char a) { + return int(a); + } + int pm_meth(double a) { + return int(floor(a)); + } + +}; + +// Test 4 - Templates w/ partial specifiers. +namespace template_partial_spec { + template <typename T> class test + { + public: + void doSomething(T t) { }; + }; + + template <typename T> class test<T *> + { + public: + void doSomething(T* t) { }; + }; +} + +// Test 5 - Templates w/ full specialization which may or may not share +// common functions. +namespace template_full_spec { + template <typename T> class test + { + public: + void doSomething(T t) { }; + void doSomethingElse(T t) { }; + }; + + template <> class test<int> + { + public: + void doSomethingElse(int t) { }; + void doSomethingCompletelyDifferent(int t) { }; + }; +} + +// Test 6 - Dto., but for templates with multiple parameters. +namespace template_multiple_spec { + template <typename T1, typename T2> class test + { + public: + void doSomething(T1 t) { }; + void doSomethingElse(T2 t) { }; + }; + + template <typename T2> class test<int, T2> + { + public: + void doSomething(int t) { }; + void doSomethingElse(T2 t) { }; + }; + + template <> class test<float, int> + { + public: + void doSomething(float t) { }; + void doSomethingElse(int t) { }; + void doNothing(void) { }; + }; +} + + +// End of polymorphism test file. diff --git a/test/manual/cedet/tests/testspp.c b/test/manual/cedet/tests/testspp.c new file mode 100644 index 00000000000..168898a4a3e --- /dev/null +++ b/test/manual/cedet/tests/testspp.c @@ -0,0 +1,102 @@ +/* testspp.cpp --- Semantic unit test for the C preprocessor + + Copyright (C) 2007-2015 Free Software Foundation, Inc. + + Author: Eric M. Ludlam <eric@siege-engine.com> + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +*/ + +int some_fcn (){} + + +#ifndef MOOSE +int pre_show_moose(){} +#endif + +#ifdef MOOSE +int pre_dont_show_moose(){} +#endif + +#if !defined(MOOSE) +int pre_show_moose_if(){} +#endif + +#if defined(MOOSE) +int pre_dont_show_moose_if(){} +#endif + +#define MOOSE + +#if 0 +int dont_show_function_if_0(){} +#endif + +#if 1 +int show_function_if_1(){} +#endif + +#ifdef MOOSE +int moose_function(){} +#endif + +#ifndef MOOSE +int dont_show_moose(){} +#endif + +#if defined(MOOSE) +int moose_function_if(){} +#endif + +#if !defined(MOOSE) +int dont_show_moose_if() {} +#endif + +#undef MOOSE + +#ifdef MOOSE +int no_handy_moose(){} +#endif + +#ifndef MOOSE +int show_moose_else() {} +#else +int no_show_moose_else(){} +#endif + + +#ifdef MOOSE +int no_show_moose_else_2() {} +#else +int show_moose_else_2() {} +#endif + +#if defined(MOOSE) +int no_show_moose_elif() {} +#elif !defined(MOOSE) +int show_moose_elif() {} +#else +int no_show_moose_elif_else() {} +#endif + +#if defined(MOOSE) +int no_show_moose_if_elif_2() {} +#elif defined(COW) +int no_show_moose_elif_2() {} +#else +int show_moose_elif_else() {} +#endif + diff --git a/test/manual/cedet/tests/testsppcomplete.c b/test/manual/cedet/tests/testsppcomplete.c new file mode 100644 index 00000000000..d7899942285 --- /dev/null +++ b/test/manual/cedet/tests/testsppcomplete.c @@ -0,0 +1,30 @@ +/* Example provided by Hannes Janetzek */ + +struct Test { int test; }; + +#define BLA(_type) \ + _type *bla = (_type*) malloc(sizeof(_type)); + +#define BLUB(_type) \ + (_type*)malloc(sizeof(_type)); + +#define FOO(_type) \ + _type *foo = BLUB(_type); + +#define BAR(_type) \ + _type *bar = (*_type)BLUB(_type); + +int main(int argc, char *argv[]) { + BLA(Test); + bla->// -1- + ; // #1# ( "test" ) + + FOO(Test); + foo->// -2- + ; // #2# ( "test" ) + + BAR(Test); + bar->// -3- + ; // #3# ( "test" ) +} + diff --git a/test/manual/cedet/tests/testsppreplace.c b/test/manual/cedet/tests/testsppreplace.c new file mode 100644 index 00000000000..e831ea152e5 --- /dev/null +++ b/test/manual/cedet/tests/testsppreplace.c @@ -0,0 +1,154 @@ +/* testsppreplace.c --- unit test for CPP/SPP Replacement + Copyright (C) 2007-2015 Free Software Foundation, Inc. + + Author: Eric M. Ludlam <eric@siege-engine.com> + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* TEST: The EMU keyword doesn't screw up the function defn. */ +#define EMU +#define EMU2 /*comment*/ +char EMU parse_around_emu EMU2 (EMU) +{ +} + +/* TEST: A simple word can be replaced in a definition. */ +#define SUBFLOAT /* Some Float */ float +SUBFLOAT returnanfloat() +{ +} + +/* TEST: Punctuation an be replaced in a definition. */ +#define COLON : +int foo COLON COLON bar () +{ +} + +/* TEST: Multiple lexical characters in a definition */ +#define SUPER mysuper:: +int SUPER baz () +{ +} + +/* TEST: Macro replacement. */ +#define INT_FCN(name) int name (int in) + +INT_FCN(increment) { + return in+1; +} + +/* TEST: Macro replacement with complex args */ +#define P_(proto) () + +int myFcn1 P_((a,b)); + +#define P__(proto) proto + +int myFcn2 P__((int a, int b)); +int myFcn3 (int a, int b); + +/* TEST: Multiple args to a macro. */ +#define MULTI_ARGS(name, field1, field2, field3) struct name { int field1; int field2; int field3; } + +MULTI_ARGS(ma_struct, moose, penguin, emu); + +/* TEST: Macro w/ args, but no body. */ +#define NO_BODY(name) + +NO_BODY(Moose); + +/* TEST: Not a macro with args, but close. */ +#define NOT_WITH_ARGS (moose) + +int not_with_args_fcn NOT_WITH_ARGS +{ +} + +/* TEST: macro w/ continuation. */ +#define WITH_CONT \ + continuation_symbol + +int WITH_CONT () { }; + +/* TEST: macros in a macro - tail processing */ +#define tail_with_args_and_long_name(a) (int a) +#define int_arg tail_with_args_and_long_name + +int tail int_arg(q) {} + +/* TEST: macros used improperly. */ +#define tail_fail tail_with_args_and_long_name(q) + +int tail_fcn tail_fail(q); + +/* TEST: feature of CPP from LSD <lsdsgster@...> */ +#define __gthrw_(name) __gthrw_ ## name + +int __gthrw_(foo) (int arg1) { } + +/* TEST: macros using macros */ +#define macro_foo foo +#define mf_declare int macro_foo + +mf_declare; + +/* TEST: macros with args using macros */ +#define Amacro(A) (int A) +#define mf_Amacro(B) int B Amacro(B) + +mf_Amacro(noodle); + +/* TEST: Double macro using the argument stack. */ +#define MACRO0(name) int that_ ## name(int i); +#define MACRO1(name) int this_ ## name(int i); +#define MACRO2(name) MACRO0(name) MACRO1(name) + +MACRO2(foo) + +/* TEST: The G++ namespace macro hack. Not really part of SPP. */ +_GLIBCXX_BEGIN_NAMESPACE(baz) + + int bazfnc(int b) { } + +_GLIBCXX_END_NAMESPACE; + +_GLIBCXX_BEGIN_NESTED_NAMESPACE(foo,bar) + + int foo_bar_func(int a) { } + +_GLIBCXX_END_NESTED_NAMESPACE; + + +/* TEST: The VC++ macro hack. */ +_STD_BEGIN + + int inside_std_namespace(int a) { } + +_STD_END + +/* TEST: Recursion prevention. CPP doesn't allow even 1 level of recursion. */ +#define STARTMACRO MACROA +#define MACROA MACROB +#define MACROB MACROA + +int STARTMACRO () { + +} + + +/* END */ + diff --git a/test/manual/cedet/tests/testsppreplaced.c b/test/manual/cedet/tests/testsppreplaced.c new file mode 100644 index 00000000000..bb6a5522cf1 --- /dev/null +++ b/test/manual/cedet/tests/testsppreplaced.c @@ -0,0 +1,117 @@ +/* testsppreplaced.c --- unit test for CPP/SPP Replacement + Copyright (C) 2007-2015 Free Software Foundation, Inc. + + Author: Eric M. Ludlam <eric@siege-engine.com> + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +*/ + +/* What the SPP replace file would looklike with MACROS replaced: */ + +/* TEST: The EMU keyword doesn't screw up the function defn. */ +char parse_around_emu () +{ +} + +/* TEST: A simple word can be replaced in a definition. */ +float returnanfloat() +{ +} + +/* TEST: Punctuation an be replaced in a definition. */ +int foo::bar () +{ +} + +/* TEST: Multiple lexical characters in a definition */ +int mysuper::baz () +{ +} + +/* TEST: Macro replacement. */ +int increment (int in) { + return in+1; +} + +/* TEST: Macro replacement with complex args */ +int myFcn1 (); + +int myFcn2 (int a, int b); +int myFcn3 (int a, int b); + +/* TEST: Multiple args to a macro. */ +struct ma_struct { int moose; int penguin; int emu; }; + +/* TEST: Macro w/ args, but no body. */ + +/* TEST: Not a macro with args, but close. */ +int not_with_args_fcn (moose) +{ +} + +/* TEST: macro w/ continuation. */ +int continuation_symbol () { }; + +/* TEST: macros in a macro - tail processing */ + +int tail (int q) {} + +/* TEST: macros used improperly */ + +int tail_fcn(int q); + +/* TEST: feature of CPP from LSD <lsdsgster@...> */ + +int __gthrw_foo (int arg1) { } + +/* TEST: macros using macros */ +int foo; + +/* TEST: macros with args using macros */ +int noodle(int noodle); + +/* TEST: Double macro using the argument stack. */ +int that_foo(int i); +int this_foo(int i); + +/* TEST: The G++ namespace macro hack. Not really part of SPP. */ +namespace baz { + + int bazfnc(int b) { } + +} + +namespace foo { namespace bar { + + int foo_bar_func(int a) { } + + } +} + +/* TEST: The VC++ macro hack. */ +namespace std { + + int inside_std_namespace(int a) { } + +} + +/* TEST: Recursion prevention. CPP doesn't allow even 1 level of recursion. */ +int MACROA () { + +} + + +/* End */ diff --git a/test/manual/cedet/tests/testsubclass.cpp b/test/manual/cedet/tests/testsubclass.cpp new file mode 100644 index 00000000000..6dee867b794 --- /dev/null +++ b/test/manual/cedet/tests/testsubclass.cpp @@ -0,0 +1,249 @@ +// testsubclass.cpp --- unit test for analyzer and complex C++ inheritance + +// Copyright (C) 2007-2015 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam <eric@siege-engine.com> + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +//#include <iostream> +#include "testsubclass.hh" + +void animal::moose::setFeet(int numfeet) //^1^ +{ + if (numfeet > 4) { + std::cerr << "Why would a moose have more than 4 feet?" << std::endl; + return; + } + + fFeet = numfeet; +} + +int animal::moose::getFeet() //^2^ +{ + return fFeet; +} + +void animal::moose::doNothing() //^3^ +{ + animal::moose foo(); + + fFeet = N// -15- + ; // #15# ( "NAME1" "NAME2" "NAME3" ) +} + + +void deer::moose::setAntlers(bool have_antlers) //^4^ +{ + fAntlers = have_antlers; +} + +bool deer::moose::getAntlers() //^5^ +// %1% ( ( "testsubclass.cpp" "testsubclass.hh" ) ( "deer::moose::doSomething" "deer::moose::getAntlers" "moose" ) ) +{ + return fAntlers; +} + +bool i_dont_have_symrefs() +// %2% ( ("testsubclass.cpp" ) ("i_dont_have_symrefs")) +{ +} + +void deer::moose::doSomething() //^6^ +{ + // All these functions should be identified by semantic analyzer. + getAntlers(); + setAntlers(true); + + getFeet(); + setFeet(true); + + doNothing(); + + fSomeField = true; + + fIsValid = true; +} + +void deer::alces::setLatin(bool l) { + fLatin = l; +} + +bool deer::alces::getLatin() { + return fLatin; +} + +void deer::alces::doLatinStuff(moose moosein) { + // All these functions should be identified by semantic analyzer. + getFeet(); + setFeet(true); + + getLatin(); + setLatin(true); + + doNothing(); + + deer::moose foo(); + + +} + +moose deer::alces::createMoose() +{ + moose MooseVariableName; + bool tmp; + int itmp; + bool fool; + int fast; + + MooseVariableName = createMoose(); + + doLatinStuff(MooseVariableName); + + tmp = this.f// -1- + // #1# ( "fAlcesBool" "fIsValid" "fLatin" ) + ; + + itmp = this.f// -2- + // #2# ( "fAlcesInt" "fGreek" "fIsProtectedInt" ) + ; + + tmp = f// -3- + // #3# ( "fAlcesBool" "fIsValid" "fLatin" "fool" ) + ; + + itmp = f// -4- + // #4# ( "fAlcesInt" "fGreek" "fIsProtectedInt" "fast" ) + ; + + MooseVariableName = m// -5- + // #5# ( "moose" ) + + return MooseVariableName; +} + +/** Test Scope Changes + * + * This function is rigged to make sure the scope changes to account + * for different locations in local variable parsing. + */ +int someFunction(int mPickle) +{ + moose mMoose = deer::alces::createMoose(); + + if (mPickle == 1) { + + int mOption1 = 2; + + m// -5- + // #5# ( "mMoose" "mOption1" "mPickle" ) + ; + + } else { + + int mOption2 = 2; + + m// -6- + // #6# ( "mMoose" "mOption2" "mPickle" ) + ; + } + +} + +// Thanks Ming-Wei Chang for this next example. + +namespace pub_priv { + + class A{ + private: + void private_a(){} + public: + void public_a(); + }; + + void A::public_a() { + A other_a; + + other_a.p// -7- + // #7# ( "private_a" "public_a" ) + ; + } + + int some_regular_function(){ + A a; + a.p// -8- + // #8# ( "public_a" ) + ; + return 0; + } + +} + + +/** Test Scope w/in a function (non-method) with classes using + * different levels of inheritance. + */ +int otherFunction() +{ + sneaky::antelope Antelope(1); + sneaky::jackalope Jackalope(1); + sneaky::bugalope Bugalope(1); + + Antelope.// -9- + // #9# ( "fAntyPublic" "fQuadPublic" "testAccess") + ; + + Jackalope.// -10- + // #10# ( "fBunnyPublic" "testAccess") + ; + + Jackalope// @1@ 6 + ; + Jackalope; + Jackalope; + Jackalope; + + Bugalope.// -11- + // #11# ( "fBugPublic" "testAccess") + ; + Bugalope// @2@ 3 + ; +} + +/** Test methods within each class for types of access to the baseclass. + */ + +bool sneaky::antelope::testAccess() //^7^ +{ + this.// -12- + // #12# ( "fAntyPrivate" "fAntyProtected" "fAntyPublic" "fQuadProtected" "fQuadPublic" "testAccess" ) + ; +} + +bool sneaky::jackalope::testAccess() //^8^ +{ + this.// -13- + // #13# ( "fBunnyPrivate" "fBunnyProtected" "fBunnyPublic" "fQuadProtected" "fQuadPublic" "testAccess" ) + ; +} + +bool sneaky::bugalope::testAccess() //^9^ +{ + this.// -14- + // #14# ( "fBugPrivate" "fBugProtected" "fBugPublic" "fQuadPublic" "testAccess" ) + ; +} + diff --git a/test/manual/cedet/tests/testsubclass.hh b/test/manual/cedet/tests/testsubclass.hh new file mode 100644 index 00000000000..13e907da887 --- /dev/null +++ b/test/manual/cedet/tests/testsubclass.hh @@ -0,0 +1,191 @@ +// testsubclass.hh --- unit test for analyzer and complex C++ inheritance + +// Copyright (C) 2007-2015 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam <eric@siege-engine.com> + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +//#include <cmath> +// #include <stdio.h> + +#ifndef TESTSUBCLASS_HH +#define TESTSUBCLASS_HH + +namespace animal { + + class moose { + public: + moose() : fFeet(0), + fIsValid(false) + { } + + virtual void setFeet(int); + int getFeet(); + + void doNothing(); + + enum moose_enum { + NAME1, NAME2, NAME3 }; + + + protected: + + bool fIsValid; + int fIsProtectedInt; + + private: + int fFeet; // Usually 2 or 4. + bool fIsPrivateBool; + + }; // moose + + int two_prototypes(); + int two_prototypes(); + + class quadruped { + public: + quadruped(int a) : fQuadPrivate(a) + { } + + int fQuadPublic; + + protected: + int fQuadProtected; + + private: + int fQuadPrivate; + + }; + +} + + +namespace deer { + + class moose : public animal::moose { + public: + moose() : fAntlers(false) + { } + + void setAntlers(bool); + bool getAntlers(); + + void doSomething(); + + protected: + + bool fSomeField; + + private: + bool fAntlers; + + }; + +} // deer + +// A second namespace of the same name will test the +// namespace merging needed to resolve deer::alces +namespace deer { + + class alces : public animal::moose { + public: + alces(int lat) : fLatin(lat) + { } + + void setLatin(bool); + bool getLatin(); + + void doLatinStuff(moose moosein); // for completion testing + + moose createMoose(); // for completion testing. + + protected: + bool fAlcesBool; + int fAlcesInt; + + private: + bool fLatin; + int fGreek; + }; + +}; + +// A third namespace with classes that does protected and private inheritance. +namespace sneaky { + + class antelope : public animal::quadruped { + + public: + antelope(int a) : animal::quadruped(), + fAntyProtected(a) + {} + + int fAntyPublic; + + bool testAccess(); + + protected: + int fAntyProtected; + + private : + int fAntyPrivate; + + }; + + class jackalope : protected animal::quadruped { + + public: + jackalope(int a) : animal::quadruped(), + fBunny(a) + {} + + int fBunnyPublic; + + bool testAccess(); + + protected: + bool fBunnyProtected; + + private : + bool fBunnyPrivate; + + }; + + // Nothing specified means private. + class bugalope : /* private*/ animal::quadruped { + + public: + bugalope(int a) : animal::quadruped(), + fBug(a) + {} + + int fBugPublic; + + bool testAccess(); + protected: + bool fBugProtected; + + private : + bool fBugPrivate; + + }; + + +}; + +#endif + diff --git a/test/manual/cedet/tests/testtypedefs.cpp b/test/manual/cedet/tests/testtypedefs.cpp new file mode 100644 index 00000000000..fa94af3596f --- /dev/null +++ b/test/manual/cedet/tests/testtypedefs.cpp @@ -0,0 +1,81 @@ +// testtypedefs.cpp --- Sample with some fake bits out of std::string + +// Copyright (C) 2008-2015 Free Software Foundation, Inc. + +// Author: Eric M. Ludlam <eric@siege-engine.com> + +// This file is part of GNU Emacs. + +// GNU Emacs is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// GNU Emacs is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +// Thanks Ming-Wei Chang for these examples. + +namespace std { + template <T>class basic_string { + public: + void resize(int); + }; +} + +typedef std::basic_string<char> mstring; + +using namespace std; +typedef basic_string<char> bstring; + +int main(){ + mstring a; + a.// -1- + ; + // #1# ( "resize" ) + bstring b; + // It doesn't work here. + b.// -2- + ; + // #2# ( "resize" ) + return 0; +} + +// ------------------ + +class Bar +{ +public: + void someFunc() {} +}; + +typedef Bar new_Bar; + +template <class mytype> +class TBar +{ +public: + void otherFunc() {} +}; + +typedef TBar<char> new_TBar; + +int main() +{ + new_Bar nb; + new_TBar ntb; + + nb.// -3- + ; + // #3# ("someFunc") + ntb.// -4- + ; + // #4# ("otherFunc") + return 0; +} + diff --git a/test/manual/cedet/tests/testvarnames.c b/test/manual/cedet/tests/testvarnames.c new file mode 100644 index 00000000000..f08b773bd4b --- /dev/null +++ b/test/manual/cedet/tests/testvarnames.c @@ -0,0 +1,90 @@ +/* testvarnames.cpp + Test variable and function names, lists of variables on one line, etc. + + Copyright (C) 2008-2015 Free Software Foundation, Inc. + + Author: Eric M. Ludlam <eric@siege-engine.com> + + This file is part of GNU Emacs. + + GNU Emacs is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + GNU Emacs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. +*/ + +struct independent { + int indep_1; + int indep_2; +}; + +struct independent var_indep_struct; + +struct { + int unnamed_1; + int unnamed_2; +} var_unnamed_struct; + +struct { + int unnamed_3; + int unnamed_4; +} var_un_2, var_un_3; + +struct inlinestruct { + int named_1; + int named_2; +} var_named_struct; + +struct inline2struct { + int named_3; + int named_4; +} var_n_2, var_n_3; + +/* Structures with names that then declare variables + * should also be completable. + * + * Getting this to work is the bugfix in semantic-c.el CVS v 1.122 + */ +struct inlinestruct in_var1; +struct inline2struct in_var2; + +int test_1(int var_arg1) { + + var_// -1- + ; // #1# ("var_arg1" "var_indep_struct" "var_n_2" "var_n_3" "var_named_struct" "var_un_2" "var_un_3" "var_unnamed_struct") + + var_indep_struct.// -2- + ; // #2# ( "indep_1" "indep_2" ) + + var_unnamed_struct.// -3- + ; // #3# ( "unnamed_1" "unnamed_2" ) + + var_named_struct.// -4- + ; // #4# ( "named_1" "named_2" ) + + var_un_2.// -5- + ; // #5# ( "unnamed_3" "unnamed_4" ) + var_un_3.// -6- + ; // #6# ( "unnamed_3" "unnamed_4" ) + + var_n_2.// -7- + ; // #7# ( "named_3" "named_4" ) + var_n_3.// -8- + ; // #8# ( "named_3" "named_4" ) + + in_// -9- + ; // #9# ( "in_var1" "in_var2" ) + + in_var1.// -10- + ; // #10# ( "named_1" "named_2") + in_var2.// -11- + ; // #11# ( "named_3" "named_4") +} |