diff options
| author | Chong Yidong | 2010-03-29 17:26:49 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-03-29 17:26:49 -0400 |
| commit | a4100ebe291e4d2aca4dd8178e7632ba87f7a65e (patch) | |
| tree | 974cde909168950c49e79efea01558e68e434789 /test | |
| parent | fe59d70512322e7001ffd772f5e74c7302b7e1d5 (diff) | |
| download | emacs-a4100ebe291e4d2aca4dd8178e7632ba87f7a65e.tar.gz emacs-a4100ebe291e4d2aca4dd8178e7632ba87f7a65e.zip | |
Update Semantic test copyrights, delete some test files (Bug#4656).
* cedet/tests/test.cpp:
* cedet/tests/test.py:
* cedet/tests/teststruct.cpp:
* cedet/tests/testtemplates.cpp:
* cedet/tests/testusing.cpp:
* cedet/tests/scopetest.cpp:
* cedet/tests/scopetest.java: Files deleted.
* cedet/tests/test.make:
* cedet/tests/test.c:
* cedet/tests/testjavacomp.java:
* cedet/tests/testspp.c:
* cedet/tests/testsppreplace.c:
* cedet/tests/testsppreplaced.c:
* cedet/tests/testsubclass.cpp:
* cedet/tests/testsubclass.hh:
* cedet/tests/testtypedefs.cpp:
* cedet/tests/testvarnames.c:
* cedet/tests/test.el:
* cedet/tests/testdoublens.cpp:
* cedet/tests/testdoublens.hpp: Add copyright header.
* cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove
reference to deleted files.
Diffstat (limited to 'test')
25 files changed, 314 insertions, 1925 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 85d9d813c5c..3ed59893802 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,30 @@ | |||
| 1 | 2010-03-29 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * cedet/tests/test.cpp: | ||
| 4 | * cedet/tests/test.py: | ||
| 5 | * cedet/tests/teststruct.cpp: | ||
| 6 | * cedet/tests/testtemplates.cpp: | ||
| 7 | * cedet/tests/testusing.cpp: | ||
| 8 | * cedet/tests/scopetest.cpp: | ||
| 9 | * cedet/tests/scopetest.java: Files deleted. | ||
| 10 | |||
| 11 | * cedet/tests/test.make: | ||
| 12 | * cedet/tests/test.c: | ||
| 13 | * cedet/tests/testjavacomp.java: | ||
| 14 | * cedet/tests/testspp.c: | ||
| 15 | * cedet/tests/testsppreplace.c: | ||
| 16 | * cedet/tests/testsppreplaced.c: | ||
| 17 | * cedet/tests/testsubclass.cpp: | ||
| 18 | * cedet/tests/testsubclass.hh: | ||
| 19 | * cedet/tests/testtypedefs.cpp: | ||
| 20 | * cedet/tests/testvarnames.c: | ||
| 21 | * cedet/tests/test.el: | ||
| 22 | * cedet/tests/testdoublens.cpp: | ||
| 23 | * cedet/tests/testdoublens.hpp: Add copyright header. | ||
| 24 | |||
| 25 | * cedet/semantic-tests.el (semanticdb-test-gnu-global): Remove | ||
| 26 | reference to deleted files. | ||
| 27 | |||
| 1 | 2010-02-19 Ulf Jasper <ulf.jasper@web.de> | 28 | 2010-02-19 Ulf Jasper <ulf.jasper@web.de> |
| 2 | 29 | ||
| 3 | * icalendar-testsuite.el | 30 | * icalendar-testsuite.el |
diff --git a/test/cedet/semantic-ia-utest.el b/test/cedet/semantic-ia-utest.el index 8e2aa43bd27..92dbaba7615 100644 --- a/test/cedet/semantic-ia-utest.el +++ b/test/cedet/semantic-ia-utest.el | |||
| @@ -42,10 +42,7 @@ | |||
| 42 | "tests/testdoublens.cpp" | 42 | "tests/testdoublens.cpp" |
| 43 | "tests/testsubclass.cpp" | 43 | "tests/testsubclass.cpp" |
| 44 | "tests/testtypedefs.cpp" | 44 | "tests/testtypedefs.cpp" |
| 45 | "tests/teststruct.cpp" | ||
| 46 | "tests/testtemplates.cpp" | ||
| 47 | "tests/testfriends.cpp" | 45 | "tests/testfriends.cpp" |
| 48 | "tests/testusing.cpp" | ||
| 49 | "tests/testnsp.cpp" | 46 | "tests/testnsp.cpp" |
| 50 | "tests/testsppcomplete.c" | 47 | "tests/testsppcomplete.c" |
| 51 | "tests/testvarnames.c" | 48 | "tests/testvarnames.c" |
diff --git a/test/cedet/semantic-tests.el b/test/cedet/semantic-tests.el index 6d13be1d5d2..8708ee77388 100644 --- a/test/cedet/semantic-tests.el +++ b/test/cedet/semantic-tests.el | |||
| @@ -107,53 +107,6 @@ If optional arg STANDARDFILE is non-nil, use a standard file w/ global enabled." | |||
| 107 | (data-debug-new-buffer "*SemanticDB Gnu Global Result*") | 107 | (data-debug-new-buffer "*SemanticDB Gnu Global Result*") |
| 108 | (data-debug-insert-thing result "?" "")))) | 108 | (data-debug-insert-thing result "?" "")))) |
| 109 | 109 | ||
| 110 | ;;; From semantic-find | ||
| 111 | |||
| 112 | (require 'semantic/find) | ||
| 113 | |||
| 114 | (defun semantic-find-benchmark () | ||
| 115 | "Run some simple benchmarks to see how we are doing. | ||
| 116 | Optional argument ARG is the number of iterations to run." | ||
| 117 | (interactive) | ||
| 118 | (require 'benchmark) | ||
| 119 | (let ((f-name nil) | ||
| 120 | (b-name nil) | ||
| 121 | (f-comp) | ||
| 122 | (b-comp) | ||
| 123 | (f-regex) | ||
| 124 | ) | ||
| 125 | (garbage-collect) | ||
| 126 | (setq f-name | ||
| 127 | (benchmark-run-compiled | ||
| 128 | 1000 (semantic-find-first-tag-by-name "class3" | ||
| 129 | "test/test.cpp"))) | ||
| 130 | (garbage-collect) | ||
| 131 | (setq b-name | ||
| 132 | (benchmark-run-compiled | ||
| 133 | 1000 (semantic-brute-find-first-tag-by-name "class3" | ||
| 134 | "test/test.cpp"))) | ||
| 135 | (garbage-collect) | ||
| 136 | (setq f-comp | ||
| 137 | (benchmark-run-compiled | ||
| 138 | 1000 (semantic-find-tags-for-completion "method" | ||
| 139 | "test/test.cpp"))) | ||
| 140 | (garbage-collect) | ||
| 141 | (setq b-comp | ||
| 142 | (benchmark-run-compiled | ||
| 143 | 1000 (semantic-brute-find-tag-by-name-regexp "^method" | ||
| 144 | "test/test.cpp"))) | ||
| 145 | (garbage-collect) | ||
| 146 | (setq f-regex | ||
| 147 | (benchmark-run-compiled | ||
| 148 | 1000 (semantic-find-tags-by-name-regexp "^method" | ||
| 149 | "test/test.cpp"))) | ||
| 150 | |||
| 151 | (message "Name [new old] [ %.3f %.3f ] Complete [newc/new old] [ %.3f/%.3f %.3f ]" | ||
| 152 | (car f-name) (car b-name) | ||
| 153 | (car f-comp) (car f-regex) | ||
| 154 | (car b-comp)) | ||
| 155 | )) | ||
| 156 | |||
| 157 | ;;; From semantic-format | 110 | ;;; From semantic-format |
| 158 | 111 | ||
| 159 | (require 'semantic/format) | 112 | (require 'semantic/format) |
diff --git a/test/cedet/tests/scopetest.cpp b/test/cedet/tests/scopetest.cpp deleted file mode 100644 index cb425c8b065..00000000000 --- a/test/cedet/tests/scopetest.cpp +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | /* Test scoping rules for c++ in the analyzer. */ | ||
| 2 | |||
| 3 | namespace { | ||
| 4 | |||
| 5 | class aclass2; // Forward reference. | ||
| 6 | |||
| 7 | class aclass1 { | ||
| 8 | private: | ||
| 9 | int attrp1; | ||
| 10 | int amethodp1(int argp1); | ||
| 11 | aclass2 areference; | ||
| 12 | protected: | ||
| 13 | int attrpr1; | ||
| 14 | public: | ||
| 15 | int attr1; | ||
| 16 | int amethod1(int arg1); | ||
| 17 | }; | ||
| 18 | } | ||
| 19 | |||
| 20 | namespace { | ||
| 21 | class aclass2 : public aclass1 | ||
| 22 | { | ||
| 23 | private: | ||
| 24 | int attrp2; | ||
| 25 | int amethodp2(int argp1); | ||
| 26 | public: | ||
| 27 | aclass2(int aninitvalue); | ||
| 28 | ~aclass2(); | ||
| 29 | int attr2; | ||
| 30 | int amethod2(int arg2); | ||
| 31 | }; | ||
| 32 | } | ||
| 33 | |||
| 34 | aclass2::aclass2(init aninitvalue) | ||
| 35 | { | ||
| 36 | /* This is a comment that talks about aclass1 */ | ||
| 37 | aclass1; | ||
| 38 | } | ||
| 39 | |||
| 40 | int aclass2::amethod2(int arg2) | ||
| 41 | { | ||
| 42 | int alocalvar; | ||
| 43 | float q; | ||
| 44 | |||
| 45 | ac; | ||
| 46 | } | ||
| 47 | |||
| 48 | // arch-tag: 9336063c-6b2e-4677-a390-d2dd091a2474 | ||
diff --git a/test/cedet/tests/scopetest.java b/test/cedet/tests/scopetest.java deleted file mode 100644 index 01825896b47..00000000000 --- a/test/cedet/tests/scopetest.java +++ /dev/null | |||
| @@ -1,25 +0,0 @@ | |||
| 1 | class Foo { | ||
| 2 | |||
| 3 | public void a1() {} | ||
| 4 | |||
| 5 | class Bar { | ||
| 6 | |||
| 7 | public int a2() {} | ||
| 8 | |||
| 9 | public void b() { | ||
| 10 | a // -1- | ||
| 11 | } | ||
| 12 | |||
| 13 | class Baz { | ||
| 14 | |||
| 15 | public int a3() {} | ||
| 16 | |||
| 17 | public Baz(int a4) { | ||
| 18 | a // -2- | ||
| 19 | } | ||
| 20 | |||
| 21 | } | ||
| 22 | |||
| 23 | } | ||
| 24 | |||
| 25 | } \ No newline at end of file | ||
diff --git a/test/cedet/tests/templates.cpp b/test/cedet/tests/templates.cpp deleted file mode 100644 index c65365f7932..00000000000 --- a/test/cedet/tests/templates.cpp +++ /dev/null | |||
| @@ -1,130 +0,0 @@ | |||
| 1 | // C++ examples and requests from Klaus Berndl | ||
| 2 | |||
| 3 | // template in a unnamed namespace | ||
| 4 | namespace | ||
| 5 | { | ||
| 6 | template<typename Target, typename Source> | ||
| 7 | Target lexical_cast(Source arg) | ||
| 8 | { | ||
| 9 | std::stringstream interpreter; | ||
| 10 | Target result; | ||
| 11 | |||
| 12 | if(!(interpreter << arg) || !(interpreter >> result) || | ||
| 13 | !(interpreter >> std::ws).eof()) | ||
| 14 | throw bad_lexical_cast(); | ||
| 15 | |||
| 16 | return result; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | |||
| 21 | template <class T, FOO> class Vector | ||
| 22 | { | ||
| 23 | private: | ||
| 24 | static T* v; | ||
| 25 | int sz; | ||
| 26 | |||
| 27 | public: | ||
| 28 | T& elem(int i) {return v[i];} | ||
| 29 | virtual ~Vector (); | ||
| 30 | |||
| 31 | protected: | ||
| 32 | Vector (); | ||
| 33 | }; | ||
| 34 | |||
| 35 | template <> class Vector <void*> | ||
| 36 | { | ||
| 37 | private: | ||
| 38 | void** v; | ||
| 39 | int sz; | ||
| 40 | |||
| 41 | public: | ||
| 42 | Vector (); | ||
| 43 | virtual int func1(int i); | ||
| 44 | virtual int func2(int i) = 0; | ||
| 45 | static virtual int func3(int i) = 0; | ||
| 46 | void*& elem(int i) {return v[i];} | ||
| 47 | //... | ||
| 48 | }; | ||
| 49 | |||
| 50 | // template contains namespace | ||
| 51 | typedef vector<CzkUtilities::Action*> ActionList; | ||
| 52 | |||
| 53 | // declaration of some template-types | ||
| 54 | map<XXX, Test::YYY>** map_var; | ||
| 55 | |||
| 56 | map_with_size<XXX, Test::YYY, size> map_size_var; | ||
| 57 | typedef map_with_size<XXX, Test::YYY, size> SizedMap; | ||
| 58 | |||
| 59 | map_with_10_size<XXX, Test::YYY, 10>* pMap_size10_var; | ||
| 60 | typedef map_with_10_size<XXX, Test::YYY, 10> Size10Map; | ||
| 61 | |||
| 62 | // a function which such a template-argument | ||
| 63 | void* test_function(map<ClassX, Test::ClassY, 10>* pMap); | ||
| 64 | |||
| 65 | |||
| 66 | template <class T> class Vector <T*> : private Vector <void*> | ||
| 67 | { | ||
| 68 | public: | ||
| 69 | typedef Vector <void*> Base; | ||
| 70 | |||
| 71 | Vector () : Base() {} | ||
| 72 | |||
| 73 | T*& elem(int i) {return static_cast<T*&>(Base::elem(i));} | ||
| 74 | //... | ||
| 75 | }; | ||
| 76 | |||
| 77 | // outside method implementation of a template-class | ||
| 78 | template<class T> T& Vector<T*>::elem(int i) | ||
| 79 | { | ||
| 80 | return C; | ||
| 81 | } | ||
| 82 | |||
| 83 | // same but qualified with a namespace Testnamespace | ||
| 84 | template<class T> T& Testnamespace::Vector<T*>::elem(int i) | ||
| 85 | { | ||
| 86 | return C; | ||
| 87 | } | ||
| 88 | |||
| 89 | // function templates with keyword typename | ||
| 90 | template<typename Target, typename Source> | ||
| 91 | Target lexical_cast(Source arg) | ||
| 92 | { | ||
| 93 | std::stringstream interpreter; | ||
| 94 | Target result; | ||
| 95 | |||
| 96 | if(!(interpreter << arg) || !(interpreter >> result) || | ||
| 97 | !(interpreter >> std::ws).eof()) | ||
| 98 | throw bad_lexical_cast(); | ||
| 99 | |||
| 100 | return result; | ||
| 101 | } | ||
| 102 | |||
| 103 | template<class T> | ||
| 104 | static | ||
| 105 | typename T::_ptr_type | ||
| 106 | getService(const std::string& pServiceName, const int pRetries=20) | ||
| 107 | { | ||
| 108 | return T::_narrow(getServiceObject(pServiceName, pRetries)); | ||
| 109 | } | ||
| 110 | |||
| 111 | // function template declaration | ||
| 112 | template<class T> void sort(vector<T>&); | ||
| 113 | // complex function template definition | ||
| 114 | template<class T, class S, const NamespaceY::ClassX<TestClass, &s> volatile ***&i> | ||
| 115 | map<ClassY, ClassX, 10> | ||
| 116 | sort(const vector<T>& v) | ||
| 117 | { | ||
| 118 | return; | ||
| 119 | } | ||
| 120 | |||
| 121 | // variable declarations of template-types | ||
| 122 | foo<TClass, Testnamespace::XClass, i> *bar1; | ||
| 123 | foo<TClass, Testnamespace::XClass, **&i> *bar2; | ||
| 124 | foo<TClass, Testnamespace::XClass, *Namespace::ClassX::i> bar3; | ||
| 125 | foo<0> bar0; | ||
| 126 | |||
| 127 | class SomeName; | ||
| 128 | class OtherName; | ||
| 129 | |||
| 130 | // arch-tag: 55ff74de-74dc-44ad-8252-50dc5f3492c3 | ||
diff --git a/test/cedet/tests/test.c b/test/cedet/tests/test.c index 0092a5924bc..3ded385fed4 100644 --- a/test/cedet/tests/test.c +++ b/test/cedet/tests/test.c | |||
| @@ -1,6 +1,29 @@ | |||
| 1 | /* Test file for C language. | 1 | /* test.c --- Semantic unit test for C. |
| 2 | * Attempt to include as many aspects of the C language as possible. | 2 | |
| 3 | Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | ||
| 4 | 2010 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 7 | |||
| 8 | This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | it under the terms of the GNU General Public License as published by | ||
| 12 | the Free Software Foundation, either version 3 of the License, or | ||
| 13 | (at your option) any later version. | ||
| 14 | |||
| 15 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | GNU General Public License for more details. | ||
| 19 | |||
| 20 | You should have received a copy of the GNU General Public License | ||
| 21 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | */ | ||
| 23 | |||
| 24 | /* Attempt to include as many aspects of the C language as possible. | ||
| 3 | */ | 25 | */ |
| 26 | |||
| 4 | /* types of include files */ | 27 | /* types of include files */ |
| 5 | #include "includeme1.h" | 28 | #include "includeme1.h" |
| 6 | #include <includeme2.h> | 29 | #include <includeme2.h> |
diff --git a/test/cedet/tests/test.cpp b/test/cedet/tests/test.cpp deleted file mode 100644 index 0c43944a031..00000000000 --- a/test/cedet/tests/test.cpp +++ /dev/null | |||
| @@ -1,592 +0,0 @@ | |||
| 1 | /* Test file for C++ language. | ||
| 2 | * Attempt to include as many aspects of the C++ language as possible. | ||
| 3 | * Do not include things tested in test.c since that shares the | ||
| 4 | * same language. | ||
| 5 | */ | ||
| 6 | |||
| 7 | /* An include test */ | ||
| 8 | #include <stdio.h> | ||
| 9 | |||
| 10 | #include <cmath> | ||
| 11 | |||
| 12 | #include "c++-test.hh" | ||
| 13 | |||
| 14 | #include <c++-test.hh> | ||
| 15 | |||
| 16 | double var1 = 1.2; | ||
| 17 | |||
| 18 | int simple1(int a) { | ||
| 19 | |||
| 20 | } | ||
| 21 | |||
| 22 | struct foo1 { | ||
| 23 | int test; | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct foo2 : public foo1 { | ||
| 27 | const int foo21(int a, int b); | ||
| 28 | const int foo22(int a, int b) { return 1 } | ||
| 29 | }; | ||
| 30 | |||
| 31 | /* Classes */ | ||
| 32 | class class1 { | ||
| 33 | private: | ||
| 34 | int var11; | ||
| 35 | struct foo1 var12; | ||
| 36 | public: | ||
| 37 | int p_var11; | ||
| 38 | struct foo p_var12; | ||
| 39 | }; | ||
| 40 | |||
| 41 | class i_class1 : public class1 { | ||
| 42 | private: | ||
| 43 | int var11; | ||
| 44 | struct foo var12; | ||
| 45 | public: | ||
| 46 | int p_var11; | ||
| 47 | struct foo p_var12; | ||
| 48 | }; | ||
| 49 | |||
| 50 | class class2 { | ||
| 51 | private: | ||
| 52 | int var21; | ||
| 53 | struct foo var22; | ||
| 54 | public: | ||
| 55 | int p_var21; | ||
| 56 | struct foo p_var22; | ||
| 57 | }; | ||
| 58 | |||
| 59 | class i_class2 : public class1, public class2 { | ||
| 60 | private: | ||
| 61 | int var21; | ||
| 62 | struct foo var22; | ||
| 63 | protected: | ||
| 64 | int pt_var21; | ||
| 65 | public: | ||
| 66 | int p_var21; | ||
| 67 | struct foo p_var22; | ||
| 68 | }; | ||
| 69 | |||
| 70 | class class3 { | ||
| 71 | /* A class with strange things in it */ | ||
| 72 | public: | ||
| 73 | class3(); /* A constructor */ | ||
| 74 | enum embedded_foo_enum { | ||
| 75 | a, b, c | ||
| 76 | } embed1; | ||
| 77 | struct embedded_bar_struct { | ||
| 78 | int a; | ||
| 79 | int b; | ||
| 80 | } embed2; | ||
| 81 | class embedded_baz_class { | ||
| 82 | embedded_baz_class(); | ||
| 83 | ~embedded_baz_class(); | ||
| 84 | } embed3; | ||
| 85 | ~class3(); /* destructor */ | ||
| 86 | |||
| 87 | /* Methods */ | ||
| 88 | int method_for_class3(int a, char b); | ||
| 89 | |||
| 90 | int inline_method(int c) { return c; } | ||
| 91 | |||
| 92 | /* Operators */ | ||
| 93 | class3& operator^= (const class3& something); | ||
| 94 | |||
| 95 | /* Funny declmods */ | ||
| 96 | const class3 * const method_const_ptr_ptr(const int * const argconst) const = 0; | ||
| 97 | }; | ||
| 98 | |||
| 99 | class3::class3() | ||
| 100 | { | ||
| 101 | /* Constructor outside the definition. */ | ||
| 102 | } | ||
| 103 | |||
| 104 | int class3::method_for_class3(int a, char b) | ||
| 105 | { | ||
| 106 | } | ||
| 107 | |||
| 108 | int class3::method1_for_class3( int a, int &b) | ||
| 109 | { | ||
| 110 | int cvariablename; | ||
| 111 | class3 fooy[]; | ||
| 112 | class3 moose = new class3; | ||
| 113 | |||
| 114 | // Complktion testing line should find external members. | ||
| 115 | a = fooy[1].me ; | ||
| 116 | b = cv ; | ||
| 117 | |||
| 118 | if (fooy.emb) { | ||
| 119 | simple1(c); | ||
| 120 | } | ||
| 121 | |||
| 122 | cos(10); | ||
| 123 | abs(10); | ||
| 124 | |||
| 125 | return 1; | ||
| 126 | } | ||
| 127 | |||
| 128 | char class3::method2_for_class3( int a, int b) throw ( exception1 ) | ||
| 129 | { | ||
| 130 | return 'a'; | ||
| 131 | } | ||
| 132 | |||
| 133 | void *class3::method3_for_class3( int a, int b) throw ( exception1, exception2 ) | ||
| 134 | { | ||
| 135 | int q = a; | ||
| 136 | return "Moose"; | ||
| 137 | } | ||
| 138 | |||
| 139 | void *class3::method31_for_class3( int a, int b) throw ( ) | ||
| 140 | { | ||
| 141 | int q = a; | ||
| 142 | return "Moose"; | ||
| 143 | } | ||
| 144 | |||
| 145 | void *class3::method4_for_class3( int a, int b) reentrant | ||
| 146 | { | ||
| 147 | class3 ct; | ||
| 148 | |||
| 149 | ct.method5_for_class3(1,a); | ||
| 150 | |||
| 151 | pritf(); | ||
| 152 | } | ||
| 153 | |||
| 154 | /* | ||
| 155 | * A method on class3. | ||
| 156 | */ | ||
| 157 | void *class3::method5_for_class3( int a, int b) const | ||
| 158 | { | ||
| 159 | } | ||
| 160 | |||
| 161 | /* | ||
| 162 | * Namespace parsing tests | ||
| 163 | */ | ||
| 164 | namespace NS { | ||
| 165 | class class_in_namespace { | ||
| 166 | int equiv(const NS::class_in_namespace *) const; | ||
| 167 | }; | ||
| 168 | } | ||
| 169 | |||
| 170 | int NS::class_in_namespace::equiv(const NS::class_in_namespace *cin) const | ||
| 171 | { | ||
| 172 | return 0; | ||
| 173 | } | ||
| 174 | |||
| 175 | // Stuff Klaus found. | ||
| 176 | // Inheritance w/out a specifying for public. | ||
| 177 | class class4 : class1 { | ||
| 178 | // Pure virtual methods. | ||
| 179 | void virtual print () const = 0; | ||
| 180 | |||
| 181 | public: | ||
| 182 | // The whacky constructor type | ||
| 183 | class4() | ||
| 184 | try : class1(args) | ||
| 185 | { | ||
| 186 | // constructor body | ||
| 187 | } | ||
| 188 | catch () | ||
| 189 | { | ||
| 190 | |||
| 191 | } | ||
| 192 | |||
| 193 | |||
| 194 | }; | ||
| 195 | |||
| 196 | class class5 : public virtual class4 { | ||
| 197 | // Virtual inheritance | ||
| 198 | }; | ||
| 199 | |||
| 200 | class class6 : class1 { | ||
| 201 | // Mutable | ||
| 202 | mutable int i; | ||
| 203 | }; | ||
| 204 | |||
| 205 | /* Namespaces */ | ||
| 206 | namespace namespace1 { | ||
| 207 | void ns_method1() { } | ||
| 208 | |||
| 209 | class n_class1 { | ||
| 210 | public: | ||
| 211 | void method11(int a) { } | ||
| 212 | }; | ||
| 213 | |||
| 214 | /* This shouldn't parse due to missing semicolon. */ | ||
| 215 | class _n_class2 : public n_class1 { | ||
| 216 | void n_c2_method1(int a, int b) { } | ||
| 217 | }; | ||
| 218 | |||
| 219 | // Macros in the namespace | ||
| 220 | #define NSMACRO 1 | ||
| 221 | |||
| 222 | // Template in the namespace | ||
| 223 | template<class T> T nsti1(const Foo& foo); | ||
| 224 | template<> int nsti1<int>(const Foo& foo); | ||
| 225 | |||
| 226 | } | ||
| 227 | |||
| 228 | namespace namespace2 { | ||
| 229 | |||
| 230 | using namespace1::n_class1; | ||
| 231 | |||
| 232 | } | ||
| 233 | |||
| 234 | /* Initializers */ | ||
| 235 | void tinitializers1(): inita1(False), | ||
| 236 | inita2(False) | ||
| 237 | { | ||
| 238 | inita1= 1; | ||
| 239 | } | ||
| 240 | |||
| 241 | /* How about Extern C type things. */ | ||
| 242 | int funny_prototype(int ,int b,float c) | ||
| 243 | { | ||
| 244 | |||
| 245 | } | ||
| 246 | |||
| 247 | extern "C" | ||
| 248 | int extern_c_1(int a, int b) | ||
| 249 | { | ||
| 250 | |||
| 251 | funny_prototype(1,2,3.4); | ||
| 252 | |||
| 253 | printf("Moose", ); | ||
| 254 | |||
| 255 | return 1; | ||
| 256 | } | ||
| 257 | |||
| 258 | extern "C" { | ||
| 259 | |||
| 260 | int extern_c_2(int a, int b) | ||
| 261 | { | ||
| 262 | return 1; | ||
| 263 | } | ||
| 264 | |||
| 265 | } | ||
| 266 | |||
| 267 | // Some operator stuff | ||
| 268 | class Action | ||
| 269 | { | ||
| 270 | // Problems!! operator() and operator[] can not be parsed with semantic | ||
| 271 | // 1.4.2 but with latest c.by | ||
| 272 | virtual void operator()(int i, char *p ) = 0; | ||
| 273 | virtual String& operator[]() = 0; | ||
| 274 | virtual void operator!() = 0; | ||
| 275 | virtual void operator->() = 0; | ||
| 276 | virtual T& operator+=(); | ||
| 277 | virtual T& operator*(); | ||
| 278 | virtual T& operator*=(); | ||
| 279 | }; | ||
| 280 | |||
| 281 | // class with namespace qualified parents | ||
| 282 | class Multiinherit : public virtual POA::Parent, | ||
| 283 | public virtual POA::Parent1, | ||
| 284 | Parent | ||
| 285 | { | ||
| 286 | private: | ||
| 287 | int i; | ||
| 288 | |||
| 289 | public: | ||
| 290 | Multiinherit(); | ||
| 291 | ~Multiinherit(); | ||
| 292 | |||
| 293 | // method with a list of qualified exceptions | ||
| 294 | void* throwtest() | ||
| 295 | throw(Exception0, | ||
| 296 | Testnamespace::Exception1, | ||
| 297 | Testnamespace::Excpetion2, | ||
| 298 | Testnamespace::testnamespace1::Exception3); | ||
| 299 | |||
| 300 | }; | ||
| 301 | |||
| 302 | void* | ||
| 303 | Multiinherit::throwtest() | ||
| 304 | throw (Exception0, | ||
| 305 | Testnamespace::Exception1, | ||
| 306 | Testnamespace::Excpetion2, | ||
| 307 | Testnamespace::testnamespace1::Exception3) | ||
| 308 | { | ||
| 309 | return; | ||
| 310 | } | ||
| 311 | |||
| 312 | // Jens Rock <jens.rock@asamnet.de>: Nested classes or structs defined | ||
| 313 | // outside of the containing class/struct. | ||
| 314 | class container | ||
| 315 | { | ||
| 316 | public: | ||
| 317 | struct contained; | ||
| 318 | container(); | ||
| 319 | ~container(); | ||
| 320 | }; | ||
| 321 | |||
| 322 | struct container::contained | ||
| 323 | { | ||
| 324 | public: | ||
| 325 | contained(); | ||
| 326 | ~contained(); | ||
| 327 | }; | ||
| 328 | |||
| 329 | /* | ||
| 330 | * Ok, how about some template stuff. | ||
| 331 | */ | ||
| 332 | template <class CT, class container = vector<CT> > | ||
| 333 | const CT& max (const CT& a, const CT& b) | ||
| 334 | { | ||
| 335 | return a < b ? b : a; | ||
| 336 | } | ||
| 337 | |||
| 338 | // Arne Schmitz found this one | ||
| 339 | std::vector<int> &a, &b, &c; | ||
| 340 | |||
| 341 | class TemplateUsingClass | ||
| 342 | { | ||
| 343 | typedef TestClassMap::iterator iterator; | ||
| 344 | typedef map<long, long> TestClassMap; | ||
| 345 | |||
| 346 | // typedefs with const and volatile | ||
| 347 | typedef const map<long, long> const_TestClassMap; | ||
| 348 | typedef TestClassMap<string>::iterator volatile volatile_iterator; | ||
| 349 | |||
| 350 | map<int, int> mapclassvarthingy; | ||
| 351 | }; | ||
| 352 | |||
| 353 | template<class T> T ti1(const Foo& foo); | ||
| 354 | template<> int ti1<int>(const Foo& foo); | ||
| 355 | |||
| 356 | |||
| 357 | // ----------------------------------- | ||
| 358 | // Now some namespace and related stuff | ||
| 359 | // ----------------------------------- | ||
| 360 | |||
| 361 | using CORBA::LEX::get_token; | ||
| 362 | using Namespace1; | ||
| 363 | |||
| 364 | using namespace POA::std; | ||
| 365 | using namespace Test; | ||
| 366 | |||
| 367 | |||
| 368 | |||
| 369 | namespace Parser | ||
| 370 | { | ||
| 371 | namespace | ||
| 372 | { | ||
| 373 | using Lexer::get_test; | ||
| 374 | string str = ""; | ||
| 375 | } | ||
| 376 | |||
| 377 | namespace XXX | ||
| 378 | { | ||
| 379 | |||
| 380 | class Foobar : public virtual POA::Parent, | ||
| 381 | public virtual POA::Parent1, | ||
| 382 | private POA::list<fact>, | ||
| 383 | private map<string> | ||
| 384 | { | ||
| 385 | ini i; | ||
| 386 | list <shared_ptr<item> >::const_iterator l; | ||
| 387 | public: | ||
| 388 | |||
| 389 | Foobar(); | ||
| 390 | ~Foobar(); | ||
| 391 | }; | ||
| 392 | } | ||
| 393 | |||
| 394 | |||
| 395 | void test_function(int i); | ||
| 396 | |||
| 397 | }; | ||
| 398 | |||
| 399 | // unnamed namespaces - even nested | ||
| 400 | namespace | ||
| 401 | { | ||
| 402 | namespace | ||
| 403 | { | ||
| 404 | using Lexer::get_test; | ||
| 405 | string str = ""; | ||
| 406 | } | ||
| 407 | |||
| 408 | // some builtin types | ||
| 409 | long long ll = 0; | ||
| 410 | long double d = 0.0; | ||
| 411 | unsigned test; | ||
| 412 | unsigned long int **uli = 0; | ||
| 413 | signed si = 0; | ||
| 414 | signed short ss = 0; | ||
| 415 | short int i = 0; | ||
| 416 | long int li = 0; | ||
| 417 | |||
| 418 | // expressions with namespace/class-qualifyiers | ||
| 419 | ORB_var cGlobalOrb = ORB::_nil(); | ||
| 420 | ORB_var1 cGlobalOrb1 = ORB::_test; | ||
| 421 | |||
| 422 | class Testclass | ||
| 423 | { | ||
| 424 | #define TEST 0 | ||
| 425 | ini i; | ||
| 426 | |||
| 427 | public: | ||
| 428 | |||
| 429 | Testclass(); | ||
| 430 | ~Testclass(); | ||
| 431 | }; | ||
| 432 | |||
| 433 | static void test_function(unsigned int i); | ||
| 434 | |||
| 435 | }; | ||
| 436 | |||
| 437 | |||
| 438 | // outside method implementations which should be grouped to type Test | ||
| 439 | XXX& | ||
| 440 | Test::waiting() | ||
| 441 | { | ||
| 442 | return; | ||
| 443 | } | ||
| 444 | |||
| 445 | void | ||
| 446 | Test::print() | ||
| 447 | { | ||
| 448 | return; | ||
| 449 | } | ||
| 450 | |||
| 451 | // outside method implementations with namespaces which should be grouped to | ||
| 452 | // their complete (incl. namespace) types | ||
| 453 | void* | ||
| 454 | Parser::XXX::Foobar::wait(int i, const char const * const * p) | ||
| 455 | { | ||
| 456 | return; | ||
| 457 | } | ||
| 458 | |||
| 459 | void* | ||
| 460 | Namespace1::Test::wait1(int i) | ||
| 461 | { | ||
| 462 | return; | ||
| 463 | } | ||
| 464 | |||
| 465 | int | ||
| 466 | Namespace1::Test::waiting(int i) | ||
| 467 | { | ||
| 468 | return; | ||
| 469 | } | ||
| 470 | |||
| 471 | // a class with some outside implementations which should all be grouped to | ||
| 472 | // this class declaration | ||
| 473 | class ClassWithExternals | ||
| 474 | { | ||
| 475 | private: | ||
| 476 | int i; | ||
| 477 | |||
| 478 | public: | ||
| 479 | ClassWithExternals(); | ||
| 480 | ~ClassWithExternals(); | ||
| 481 | void non_nil(); | ||
| 482 | }; | ||
| 483 | |||
| 484 | |||
| 485 | // Foobar is not displayed; seems that semantic tries to add this to the class | ||
| 486 | // Foobar but can not find/display it, because contained in the namespace above. | ||
| 487 | void | ||
| 488 | Foobar::non_nil() | ||
| 489 | { | ||
| 490 | return; | ||
| 491 | } | ||
| 492 | |||
| 493 | // are correctly grouped to the ClassWithExternals class | ||
| 494 | void | ||
| 495 | ClassWithExternals::non_nil() | ||
| 496 | { | ||
| 497 | String s = "lödfjg dlfgkdlfkgjdl"; | ||
| 498 | return; | ||
| 499 | } | ||
| 500 | |||
| 501 | ClassWithExternals::ClassWithExternals() | ||
| 502 | { | ||
| 503 | return; | ||
| 504 | } | ||
| 505 | |||
| 506 | void | ||
| 507 | ClassWithExternals::~ClassWithExternals() | ||
| 508 | { | ||
| 509 | return; | ||
| 510 | } | ||
| 511 | |||
| 512 | |||
| 513 | // ------------------------------- | ||
| 514 | // Now some macro and define stuff | ||
| 515 | // ------------------------------- | ||
| 516 | |||
| 517 | #define TEST 0 | ||
| 518 | #define TEST1 "String" | ||
| 519 | |||
| 520 | // The first backslash makes this macro unmatched syntax with semantic 1.4.2! | ||
| 521 | // With flexing \+newline as nothing all is working fine! | ||
| 522 | #define MZK_ENTER(METHOD) \ | ||
| 523 | { \ | ||
| 524 | CzkMethodLog lMethodLog(METHOD,"Framework");\ | ||
| 525 | } | ||
| 526 | |||
| 527 | #define ZK_ASSERTM(METHOD,ASSERTION,MESSAGE) \ | ||
| 528 | { if(!(ASSERTION))\ | ||
| 529 | {\ | ||
| 530 | std::ostringstream lMesgStream; \ | ||
| 531 | lMesgStream << "Assertion failed: " \ | ||
| 532 | << MESSAGE; \ | ||
| 533 | CzkLogManager::doLog(CzkLogManager::FATAL,"",METHOD, \ | ||
| 534 | "Assert",lMesgStream); \ | ||
| 535 | assert(ASSERTION);\ | ||
| 536 | }\ | ||
| 537 | } | ||
| 538 | |||
| 539 | // Test if not newline-backslashes are handled correctly | ||
| 540 | string s = "My \"quoted\" string"; | ||
| 541 | |||
| 542 | // parsed fine as macro | ||
| 543 | #define FOO (arg) method(arg, "foo"); | ||
| 544 | |||
| 545 | // With semantic 1.4.2 this parsed as macro BAR *and* function method. | ||
| 546 | // With latest c.bnf at least one-liner macros can be parsed correctly. | ||
| 547 | #define BAR (arg) CzkMessageLog method(arg, "bar"); | ||
| 548 | |||
| 549 | // some const and volatile stuff | ||
| 550 | char * p1 = "Hello"; // 1. variable Pointer, variable Data | ||
| 551 | const char * p2 = "Hello"; // 2. variable pointer, constant data | ||
| 552 | char * const p3 = "Hello"; // 3. constant pointer, variable data | ||
| 553 | const char * const p4 = "Hello"; // 4. constant pointer, constant data | ||
| 554 | |||
| 555 | // Case 2 and 4 can exchange first "const" and "char" | ||
| 556 | char const * p21 = "Hello"; // variable pointer, constant data | ||
| 557 | char const * const p41 = "Hello"; // constant pointer, constant data | ||
| 558 | |||
| 559 | char volatile a = 0; // a volatile char | ||
| 560 | void foo(bar const &arg); // a reference to a const bar | ||
| 561 | int foobar(bar const * const p); // a const pointer to a const bar | ||
| 562 | int foobar(bar const volatile * const p); // a const pointer to a const bar | ||
| 563 | int foobar3(char* p); // a const pointer to a const bar | ||
| 564 | |||
| 565 | // Should not be parsed because this is invalid code | ||
| 566 | int const & const r3 = i; | ||
| 567 | |||
| 568 | boolean i = 0; | ||
| 569 | boolean & r1 = i; | ||
| 570 | boolean const & r2 = i; | ||
| 571 | |||
| 572 | // const * sequences can be very long in C++ ;-) | ||
| 573 | char const * const * const * const * ppp; | ||
| 574 | |||
| 575 | // complex function declarationen with named pointer-arguments | ||
| 576 | const char** foobar1(volatile char const * const **p); | ||
| 577 | const char** foobar11(volatile Test::Namespace::Char<char*> const * const **p); | ||
| 578 | |||
| 579 | // complex function declarationen with unnamed pointer-arguments | ||
| 580 | const char* foobar2(const char***); | ||
| 581 | const char* foobar21(const Test::Namespace::Char<char>***); | ||
| 582 | |||
| 583 | // string literal parsing even with wchar_t | ||
| 584 | char const *p = "string1"; | ||
| 585 | char const *q = "string1" "str\"ing2" "string3"; | ||
| 586 | wchar_t testc = L'a'; | ||
| 587 | |||
| 588 | wchar_t const *wp = L"string with a \" in it"; | ||
| 589 | wchar_t const *wq = L"string \n\t\"test" L"string2"; | ||
| 590 | wchar_t const *wr = L"string L"; | ||
| 591 | |||
| 592 | // arch-tag: 59828880-d72f-4059-922f-89579edf9e58 | ||
diff --git a/test/cedet/tests/test.el b/test/cedet/tests/test.el index 79420036bb6..d406f447dfa 100644 --- a/test/cedet/tests/test.el +++ b/test/cedet/tests/test.el | |||
| @@ -1,6 +1,24 @@ | |||
| 1 | ;; Test file for Emacs Lisp. | 1 | ;;; test.el --- Unit test file for Semantic Emacs Lisp support. |
| 2 | ;; Attempt to include as many aspects of Emacs Lisp as possible. | 2 | |
| 3 | ;; | 3 | ;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 |
| 4 | ;; Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | ;; Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 4 | 22 | ||
| 5 | ;;; Require | 23 | ;;; Require |
| 6 | ;; | 24 | ;; |
| @@ -88,7 +106,7 @@ | |||
| 88 | (autoload (quote a-autoload) "somefile" | 106 | (autoload (quote a-autoload) "somefile" |
| 89 | "Non-interactive autoload." nil nil) | 107 | "Non-interactive autoload." nil nil) |
| 90 | 108 | ||
| 91 | (autoload (quote a-autoload-interactive) "somefile" | 109 | (autoload (quote a-autoload-interactive) "somefile" |
| 92 | "Interactive autoload." t nil) | 110 | "Interactive autoload." t nil) |
| 93 | 111 | ||
| 94 | 112 | ||
| @@ -116,7 +134,7 @@ | |||
| 116 | (slot-1 :equal 'eq) | 134 | (slot-1 :equal 'eq) |
| 117 | slot-2) | 135 | slot-2) |
| 118 | 136 | ||
| 119 | (defstruct test-struct-2 | 137 | (defstruct test-struct-2 |
| 120 | slot-1 | 138 | slot-1 |
| 121 | slot-2) | 139 | slot-2) |
| 122 | 140 | ||
diff --git a/test/cedet/tests/test.make b/test/cedet/tests/test.make index 6f1a4a386ee..82cce6fd344 100644 --- a/test/cedet/tests/test.make +++ b/test/cedet/tests/test.make | |||
| @@ -1,4 +1,23 @@ | |||
| 1 | # Test makefile -*- makefile -*- | 1 | # test.make --- Semantic unit test for Make -*- makefile -*- |
| 2 | |||
| 3 | # Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | # Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 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/>. | ||
| 2 | 21 | ||
| 3 | top= | 22 | top= |
| 4 | ede_FILES=Project.ede Makefile | 23 | ede_FILES=Project.ede Makefile |
diff --git a/test/cedet/tests/test.py b/test/cedet/tests/test.py deleted file mode 100644 index ef1b4e1c94b..00000000000 --- a/test/cedet/tests/test.py +++ /dev/null | |||
| @@ -1,580 +0,0 @@ | |||
| 1 | # Test file for Python language. | ||
| 2 | # | ||
| 3 | |||
| 4 | # Simle class compount statement with blank lines sprinkled. | ||
| 5 | class Foo(Bar): | ||
| 6 | |||
| 7 | x = 1 | ||
| 8 | |||
| 9 | y = 2 | ||
| 10 | |||
| 11 | # Simple def statement with no argument | ||
| 12 | def sss(): | ||
| 13 | i = 1 | ||
| 14 | |||
| 15 | # Simple def statement with arguments | ||
| 16 | def ttt(x,y,z): | ||
| 17 | i = 1 | ||
| 18 | |||
| 19 | import foo | ||
| 20 | |||
| 21 | for x in y: | ||
| 22 | print x | ||
| 23 | |||
| 24 | while y > 0: | ||
| 25 | y = y - 1 | ||
| 26 | |||
| 27 | a=b=c=d=e=f=i=j=k=l=m=n=o=p=q=r=s=t=x=y=1 | ||
| 28 | |||
| 29 | if x: | ||
| 30 | x = 2 | ||
| 31 | y = 3 | ||
| 32 | |||
| 33 | x = 2 | ||
| 34 | y = 3 | ||
| 35 | s and t | ||
| 36 | q | r | ||
| 37 | o ^ p | ||
| 38 | m & n | ||
| 39 | k << l | ||
| 40 | z = 4 | ||
| 41 | i >> j | ||
| 42 | e / f | ||
| 43 | c * d | ||
| 44 | a + b | ||
| 45 | 2 ** 5 | ||
| 46 | x | ||
| 47 | s = "a" "b" "c" | ||
| 48 | 1 | ||
| 49 | |||
| 50 | # implicit continuation lines, see | ||
| 51 | # http://docs.python.org/ref/implicit-joining.html | ||
| 52 | |||
| 53 | a_list = [ 1, 2, 3, | ||
| 54 | 4, 5, | ||
| 55 | 6 ] | ||
| 56 | |||
| 57 | a_tuple = (1, 2, 3, | ||
| 58 | |||
| 59 | 4, 5, 6) | ||
| 60 | |||
| 61 | a_hash = { 'a':1, "b":2, | ||
| 62 | 'c' : 3, | ||
| 63 | "d" : 4 } | ||
| 64 | |||
| 65 | |||
| 66 | def longarglist(a, | ||
| 67 | b, | ||
| 68 | c, | ||
| 69 | d): | ||
| 70 | a=1; | ||
| 71 | b=1; | ||
| 72 | c=1; | ||
| 73 | d=1; | ||
| 74 | |||
| 75 | class longclasslist(xx.yyy, | ||
| 76 | zz.aa): | ||
| 77 | foo=1 | ||
| 78 | |||
| 79 | |||
| 80 | # wisent-python.wy chokes on this! -ryk 6/17/02 | ||
| 81 | |||
| 82 | class HTTPServer(xxx.yyy): | ||
| 83 | allow_reuse_address = 1 # Seems to make sense in testing environment | ||
| 84 | def server_bind(self): | ||
| 85 | SocketServer.TCPServer.server_bind(self) | ||
| 86 | host, port = self.socket.getsockname() | ||
| 87 | self.server_name = socket.getfqdn(host) | ||
| 88 | self.server_port = port | ||
| 89 | |||
| 90 | |||
| 91 | ######################################################################### | ||
| 92 | ### /usr/lib/python2.2/BaseHTTPServer.py | ||
| 93 | ######################################################################### | ||
| 94 | |||
| 95 | """HTTP server base class. | ||
| 96 | |||
| 97 | Note: the class in this module doesn't implement any HTTP request; see | ||
| 98 | SimpleHTTPServer for simple implementations of GET, HEAD and POST | ||
| 99 | (including CGI scripts). | ||
| 100 | |||
| 101 | Contents: | ||
| 102 | |||
| 103 | - BaseHTTPRequestHandler: HTTP request handler base class | ||
| 104 | - test: test function | ||
| 105 | |||
| 106 | XXX To do: | ||
| 107 | |||
| 108 | - send server version | ||
| 109 | - log requests even later (to capture byte count) | ||
| 110 | - log user-agent header and other interesting goodies | ||
| 111 | - send error log to separate file | ||
| 112 | - are request names really case sensitive? | ||
| 113 | |||
| 114 | """ | ||
| 115 | |||
| 116 | |||
| 117 | # See also: | ||
| 118 | # | ||
| 119 | # HTTP Working Group T. Berners-Lee | ||
| 120 | # INTERNET-DRAFT R. T. Fielding | ||
| 121 | # <draft-ietf-http-v10-spec-00.txt> H. Frystyk Nielsen | ||
| 122 | # Expires September 8, 1995 March 8, 1995 | ||
| 123 | # | ||
| 124 | # URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt | ||
| 125 | |||
| 126 | |||
| 127 | # Log files | ||
| 128 | # --------- | ||
| 129 | # | ||
| 130 | # Here's a quote from the NCSA httpd docs about log file format. | ||
| 131 | # | ||
| 132 | # | The logfile format is as follows. Each line consists of: | ||
| 133 | # | | ||
| 134 | # | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb | ||
| 135 | # | | ||
| 136 | # | host: Either the DNS name or the IP number of the remote client | ||
| 137 | # | rfc931: Any information returned by identd for this person, | ||
| 138 | # | - otherwise. | ||
| 139 | # | authuser: If user sent a userid for authentication, the user name, | ||
| 140 | # | - otherwise. | ||
| 141 | # | DD: Day | ||
| 142 | # | Mon: Month (calendar name) | ||
| 143 | # | YYYY: Year | ||
| 144 | # | hh: hour (24-hour format, the machine's timezone) | ||
| 145 | # | mm: minutes | ||
| 146 | # | ss: seconds | ||
| 147 | # | request: The first line of the HTTP request as sent by the client. | ||
| 148 | # | ddd: the status code returned by the server, - if not available. | ||
| 149 | # | bbbb: the total number of bytes sent, | ||
| 150 | # | *not including the HTTP/1.0 header*, - if not available | ||
| 151 | # | | ||
| 152 | # | You can determine the name of the file accessed through request. | ||
| 153 | # | ||
| 154 | # (Actually, the latter is only true if you know the server configuration | ||
| 155 | # at the time the request was made!) | ||
| 156 | |||
| 157 | |||
| 158 | __version__ = "0.2" | ||
| 159 | |||
| 160 | __all__ = ["HTTPServer", "BaseHTTPRequestHandler"] | ||
| 161 | |||
| 162 | import sys | ||
| 163 | import time | ||
| 164 | import socket # For gethostbyaddr() | ||
| 165 | import mimetools | ||
| 166 | import SocketServer | ||
| 167 | |||
| 168 | # Default error message | ||
| 169 | DEFAULT_ERROR_MESSAGE = """\ | ||
| 170 | <head> | ||
| 171 | <title>Error response</title> | ||
| 172 | </head> | ||
| 173 | <body> | ||
| 174 | <h1>Error response</h1> | ||
| 175 | <p>Error code %(code)d. | ||
| 176 | <p>Message: %(message)s. | ||
| 177 | <p>Error code explanation: %(code)s = %(explain)s. | ||
| 178 | </body> | ||
| 179 | """ | ||
| 180 | |||
| 181 | |||
| 182 | class HTTPServer(SocketServer.TCPServer): | ||
| 183 | |||
| 184 | allow_reuse_address = 1 # Seems to make sense in testing environment | ||
| 185 | |||
| 186 | def server_bind(self): | ||
| 187 | """Override server_bind to store the server name.""" | ||
| 188 | SocketServer.TCPServer.server_bind(self) | ||
| 189 | host, port = self.socket.getsockname() | ||
| 190 | self.server_name = socket.getfqdn(host) | ||
| 191 | self.server_port = port | ||
| 192 | |||
| 193 | |||
| 194 | class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): | ||
| 195 | |||
| 196 | """HTTP request handler base class. | ||
| 197 | |||
| 198 | The following explanation of HTTP serves to guide you through the | ||
| 199 | code as well as to expose any misunderstandings I may have about | ||
| 200 | HTTP (so you don't need to read the code to figure out I'm wrong | ||
| 201 | :-). | ||
| 202 | |||
| 203 | HTTP (HyperText Transfer Protocol) is an extensible protocol on | ||
| 204 | top of a reliable stream transport (e.g. TCP/IP). The protocol | ||
| 205 | recognizes three parts to a request: | ||
| 206 | |||
| 207 | 1. One line identifying the request type and path | ||
| 208 | 2. An optional set of RFC-822-style headers | ||
| 209 | 3. An optional data part | ||
| 210 | |||
| 211 | The headers and data are separated by a blank line. | ||
| 212 | |||
| 213 | The first line of the request has the form | ||
| 214 | |||
| 215 | <command> <path> <version> | ||
| 216 | |||
| 217 | where <command> is a (case-sensitive) keyword such as GET or POST, | ||
| 218 | <path> is a string containing path information for the request, | ||
| 219 | and <version> should be the string "HTTP/1.0". <path> is encoded | ||
| 220 | using the URL encoding scheme (using %xx to signify the ASCII | ||
| 221 | character with hex code xx). | ||
| 222 | |||
| 223 | The protocol is vague about whether lines are separated by LF | ||
| 224 | characters or by CRLF pairs -- for compatibility with the widest | ||
| 225 | range of clients, both should be accepted. Similarly, whitespace | ||
| 226 | in the request line should be treated sensibly (allowing multiple | ||
| 227 | spaces between components and allowing trailing whitespace). | ||
| 228 | |||
| 229 | Similarly, for output, lines ought to be separated by CRLF pairs | ||
| 230 | but most clients grok LF characters just fine. | ||
| 231 | |||
| 232 | If the first line of the request has the form | ||
| 233 | |||
| 234 | <command> <path> | ||
| 235 | |||
| 236 | (i.e. <version> is left out) then this is assumed to be an HTTP | ||
| 237 | 0.9 request; this form has no optional headers and data part and | ||
| 238 | the reply consists of just the data. | ||
| 239 | |||
| 240 | The reply form of the HTTP 1.0 protocol again has three parts: | ||
| 241 | |||
| 242 | 1. One line giving the response code | ||
| 243 | 2. An optional set of RFC-822-style headers | ||
| 244 | 3. The data | ||
| 245 | |||
| 246 | Again, the headers and data are separated by a blank line. | ||
| 247 | |||
| 248 | The response code line has the form | ||
| 249 | |||
| 250 | <version> <responsecode> <responsestring> | ||
| 251 | |||
| 252 | where <version> is the protocol version (always "HTTP/1.0"), | ||
| 253 | <responsecode> is a 3-digit response code indicating success or | ||
| 254 | failure of the request, and <responsestring> is an optional | ||
| 255 | human-readable string explaining what the response code means. | ||
| 256 | |||
| 257 | This server parses the request and the headers, and then calls a | ||
| 258 | function specific to the request type (<command>). Specifically, | ||
| 259 | a request SPAM will be handled by a method do_SPAM(). If no | ||
| 260 | such method exists the server sends an error response to the | ||
| 261 | client. If it exists, it is called with no arguments: | ||
| 262 | |||
| 263 | do_SPAM() | ||
| 264 | |||
| 265 | Note that the request name is case sensitive (i.e. SPAM and spam | ||
| 266 | are different requests). | ||
| 267 | |||
| 268 | The various request details are stored in instance variables: | ||
| 269 | |||
| 270 | - client_address is the client IP address in the form (host, | ||
| 271 | port); | ||
| 272 | |||
| 273 | - command, path and version are the broken-down request line; | ||
| 274 | |||
| 275 | - headers is an instance of mimetools.Message (or a derived | ||
| 276 | class) containing the header information; | ||
| 277 | |||
| 278 | - rfile is a file object open for reading positioned at the | ||
| 279 | start of the optional input data part; | ||
| 280 | |||
| 281 | - wfile is a file object open for writing. | ||
| 282 | |||
| 283 | IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! | ||
| 284 | |||
| 285 | The first thing to be written must be the response line. Then | ||
| 286 | follow 0 or more header lines, then a blank line, and then the | ||
| 287 | actual data (if any). The meaning of the header lines depends on | ||
| 288 | the command executed by the server; in most cases, when data is | ||
| 289 | returned, there should be at least one header line of the form | ||
| 290 | |||
| 291 | Content-type: <type>/<subtype> | ||
| 292 | |||
| 293 | where <type> and <subtype> should be registered MIME types, | ||
| 294 | e.g. "text/html" or "text/plain". | ||
| 295 | |||
| 296 | """ | ||
| 297 | |||
| 298 | # The Python system version, truncated to its first component. | ||
| 299 | sys_version = "Python/" + sys.version.split()[0] | ||
| 300 | |||
| 301 | # The server software version. You may want to override this. | ||
| 302 | # The format is multiple whitespace-separated strings, | ||
| 303 | # where each string is of the form name[/version]. | ||
| 304 | server_version = "BaseHTTP/" + __version__ | ||
| 305 | |||
| 306 | def parse_request(self): | ||
| 307 | """Parse a request (internal). | ||
| 308 | |||
| 309 | The request should be stored in self.raw_request; the results | ||
| 310 | are in self.command, self.path, self.request_version and | ||
| 311 | self.headers. | ||
| 312 | |||
| 313 | Return value is 1 for success, 0 for failure; on failure, an | ||
| 314 | error is sent back. | ||
| 315 | |||
| 316 | """ | ||
| 317 | self.request_version = version = "HTTP/0.9" # Default | ||
| 318 | requestline = self.raw_requestline | ||
| 319 | if requestline[-2:] == '\r\n': | ||
| 320 | requestline = requestline[:-2] | ||
| 321 | elif requestline[-1:] == '\n': | ||
| 322 | requestline = requestline[:-1] | ||
| 323 | self.requestline = requestline | ||
| 324 | words = requestline.split() | ||
| 325 | if len(words) == 3: | ||
| 326 | [command, path, version] = words | ||
| 327 | if version[:5] != 'HTTP/': | ||
| 328 | self.send_error(400, "Bad request version (%s)" % `version`) | ||
| 329 | return 0 | ||
| 330 | elif len(words) == 2: | ||
| 331 | [command, path] = words | ||
| 332 | if command != 'GET': | ||
| 333 | self.send_error(400, | ||
| 334 | "Bad HTTP/0.9 request type (%s)" % `command`) | ||
| 335 | return 0 | ||
| 336 | else: | ||
| 337 | self.send_error(400, "Bad request syntax (%s)" % `requestline`) | ||
| 338 | return 0 | ||
| 339 | self.command, self.path, self.request_version = command, path, version | ||
| 340 | self.headers = self.MessageClass(self.rfile, 0) | ||
| 341 | return 1 | ||
| 342 | |||
| 343 | def handle(self): | ||
| 344 | """Handle a single HTTP request. | ||
| 345 | |||
| 346 | You normally don't need to override this method; see the class | ||
| 347 | __doc__ string for information on how to handle specific HTTP | ||
| 348 | commands such as GET and POST. | ||
| 349 | |||
| 350 | """ | ||
| 351 | |||
| 352 | self.raw_requestline = self.rfile.readline() | ||
| 353 | if not self.parse_request(): # An error code has been sent, just exit | ||
| 354 | return | ||
| 355 | mname = 'do_' + self.command | ||
| 356 | if not hasattr(self, mname): | ||
| 357 | self.send_error(501, "Unsupported method (%s)" % `self.command`) | ||
| 358 | return | ||
| 359 | method = getattr(self, mname) | ||
| 360 | method() | ||
| 361 | |||
| 362 | def send_error(self, code, message=None): | ||
| 363 | """Send and log an error reply. | ||
| 364 | |||
| 365 | Arguments are the error code, and a detailed message. | ||
| 366 | The detailed message defaults to the short entry matching the | ||
| 367 | response code. | ||
| 368 | |||
| 369 | This sends an error response (so it must be called before any | ||
| 370 | output has been generated), logs the error, and finally sends | ||
| 371 | a piece of HTML explaining the error to the user. | ||
| 372 | |||
| 373 | """ | ||
| 374 | |||
| 375 | try: | ||
| 376 | short, long = self.responses[code] | ||
| 377 | except KeyError: | ||
| 378 | short, long = '???', '???' | ||
| 379 | if not message: | ||
| 380 | message = short | ||
| 381 | explain = long | ||
| 382 | self.log_error("code %d, message %s", code, message) | ||
| 383 | self.send_response(code, message) | ||
| 384 | self.send_header("Content-Type", "text/html") | ||
| 385 | self.end_headers() | ||
| 386 | self.wfile.write(self.error_message_format % | ||
| 387 | {'code': code, | ||
| 388 | 'message': message, | ||
| 389 | 'explain': explain}) | ||
| 390 | |||
| 391 | error_message_format = DEFAULT_ERROR_MESSAGE | ||
| 392 | |||
| 393 | def send_response(self, code, message=None): | ||
| 394 | """Send the response header and log the response code. | ||
| 395 | |||
| 396 | Also send two standard headers with the server software | ||
| 397 | version and the current date. | ||
| 398 | |||
| 399 | """ | ||
| 400 | self.log_request(code) | ||
| 401 | if message is None: | ||
| 402 | if self.responses.has_key(code): | ||
| 403 | message = self.responses[code][0] | ||
| 404 | else: | ||
| 405 | message = '' | ||
| 406 | if self.request_version != 'HTTP/0.9': | ||
| 407 | self.wfile.write("%s %s %s\r\n" % | ||
| 408 | (self.protocol_version, str(code), message)) | ||
| 409 | self.send_header('Server', self.version_string()) | ||
| 410 | self.send_header('Date', self.date_time_string()) | ||
| 411 | |||
| 412 | def send_header(self, keyword, value): | ||
| 413 | """Send a MIME header.""" | ||
| 414 | if self.request_version != 'HTTP/0.9': | ||
| 415 | self.wfile.write("%s: %s\r\n" % (keyword, value)) | ||
| 416 | |||
| 417 | def end_headers(self): | ||
| 418 | """Send the blank line ending the MIME headers.""" | ||
| 419 | if self.request_version != 'HTTP/0.9': | ||
| 420 | self.wfile.write("\r\n") | ||
| 421 | |||
| 422 | def log_request(self, code='-', size='-'): | ||
| 423 | """Log an accepted request. | ||
| 424 | |||
| 425 | This is called by send_reponse(). | ||
| 426 | |||
| 427 | """ | ||
| 428 | |||
| 429 | self.log_message('"%s" %s %s', | ||
| 430 | self.requestline, str(code), str(size)) | ||
| 431 | |||
| 432 | def log_error(self, *args): | ||
| 433 | """Log an error. | ||
| 434 | |||
| 435 | This is called when a request cannot be fulfilled. By | ||
| 436 | default it passes the message on to log_message(). | ||
| 437 | |||
| 438 | Arguments are the same as for log_message(). | ||
| 439 | |||
| 440 | XXX This should go to the separate error log. | ||
| 441 | |||
| 442 | """ | ||
| 443 | |||
| 444 | apply(self.log_message, args) | ||
| 445 | |||
| 446 | def log_message(self, format, *args): | ||
| 447 | """Log an arbitrary message. | ||
| 448 | |||
| 449 | This is used by all other logging functions. Override | ||
| 450 | it if you have specific logging wishes. | ||
| 451 | |||
| 452 | The first argument, FORMAT, is a format string for the | ||
| 453 | message to be logged. If the format string contains | ||
| 454 | any % escapes requiring parameters, they should be | ||
| 455 | specified as subsequent arguments (it's just like | ||
| 456 | printf!). | ||
| 457 | |||
| 458 | The client host and current date/time are prefixed to | ||
| 459 | every message. | ||
| 460 | |||
| 461 | """ | ||
| 462 | |||
| 463 | sys.stderr.write("%s - - [%s] %s\n" % | ||
| 464 | (self.address_string(), | ||
| 465 | self.log_date_time_string(), | ||
| 466 | format%args)) | ||
| 467 | |||
| 468 | def version_string(self): | ||
| 469 | """Return the server software version string.""" | ||
| 470 | return self.server_version + ' ' + self.sys_version | ||
| 471 | |||
| 472 | def date_time_string(self): | ||
| 473 | """Return the current date and time formatted for a message header.""" | ||
| 474 | now = time.time() | ||
| 475 | year, month, day, hh, mm, ss, wd, y, z = time.gmtime(now) | ||
| 476 | s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( | ||
| 477 | self.weekdayname[wd], | ||
| 478 | day, self.monthname[month], year, | ||
| 479 | hh, mm, ss) | ||
| 480 | return s | ||
| 481 | |||
| 482 | def log_date_time_string(self): | ||
| 483 | """Return the current time formatted for logging.""" | ||
| 484 | now = time.time() | ||
| 485 | year, month, day, hh, mm, ss, x, y, z = time.localtime(now) | ||
| 486 | s = "%02d/%3s/%04d %02d:%02d:%02d" % ( | ||
| 487 | day, self.monthname[month], year, hh, mm, ss) | ||
| 488 | return s | ||
| 489 | |||
| 490 | weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] | ||
| 491 | |||
| 492 | monthname = [None, | ||
| 493 | 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', | ||
| 494 | 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] | ||
| 495 | |||
| 496 | def address_string(self): | ||
| 497 | """Return the client address formatted for logging. | ||
| 498 | |||
| 499 | This version looks up the full hostname using gethostbyaddr(), | ||
| 500 | and tries to find a name that contains at least one dot. | ||
| 501 | |||
| 502 | """ | ||
| 503 | |||
| 504 | host, port = self.client_address | ||
| 505 | return socket.getfqdn(host) | ||
| 506 | |||
| 507 | # Essentially static class variables | ||
| 508 | |||
| 509 | # The version of the HTTP protocol we support. | ||
| 510 | # Don't override unless you know what you're doing (hint: incoming | ||
| 511 | # requests are required to have exactly this version string). | ||
| 512 | protocol_version = "HTTP/1.0" | ||
| 513 | |||
| 514 | # The Message-like class used to parse headers | ||
| 515 | MessageClass = mimetools.Message | ||
| 516 | |||
| 517 | # Table mapping response codes to messages; entries have the | ||
| 518 | # form {code: (shortmessage, longmessage)}. | ||
| 519 | # See http://www.w3.org/hypertext/WWW/Protocols/HTTP/HTRESP.html | ||
| 520 | responses = { | ||
| 521 | 200: ('OK', 'Request fulfilled, document follows'), | ||
| 522 | 201: ('Created', 'Document created, URL follows'), | ||
| 523 | 202: ('Accepted', | ||
| 524 | 'Request accepted, processing continues off-line'), | ||
| 525 | 203: ('Partial information', 'Request fulfilled from cache'), | ||
| 526 | 204: ('No response', 'Request fulfilled, nothing follows'), | ||
| 527 | |||
| 528 | 301: ('Moved', 'Object moved permanently -- see URI list'), | ||
| 529 | 302: ('Found', 'Object moved temporarily -- see URI list'), | ||
| 530 | 303: ('Method', 'Object moved -- see Method and URL list'), | ||
| 531 | 304: ('Not modified', | ||
| 532 | 'Document has not changed singe given time'), | ||
| 533 | |||
| 534 | 400: ('Bad request', | ||
| 535 | 'Bad request syntax or unsupported method'), | ||
| 536 | 401: ('Unauthorized', | ||
| 537 | 'No permission -- see authorization schemes'), | ||
| 538 | 402: ('Payment required', | ||
| 539 | 'No payment -- see charging schemes'), | ||
| 540 | 403: ('Forbidden', | ||
| 541 | 'Request forbidden -- authorization will not help'), | ||
| 542 | 404: ('Not found', 'Nothing matches the given URI'), | ||
| 543 | |||
| 544 | 500: ('Internal error', 'Server got itself in trouble'), | ||
| 545 | 501: ('Not implemented', | ||
| 546 | 'Server does not support this operation'), | ||
| 547 | 502: ('Service temporarily overloaded', | ||
| 548 | 'The server cannot process the request due to a high load'), | ||
| 549 | 503: ('Gateway timeout', | ||
| 550 | 'The gateway server did not receive a timely response'), | ||
| 551 | |||
| 552 | } | ||
| 553 | |||
| 554 | |||
| 555 | def test(HandlerClass = BaseHTTPRequestHandler, | ||
| 556 | ServerClass = HTTPServer): | ||
| 557 | """Test the HTTP request handler class. | ||
| 558 | |||
| 559 | This runs an HTTP server on port 8000 (or the first command line | ||
| 560 | argument). | ||
| 561 | |||
| 562 | """ | ||
| 563 | |||
| 564 | if sys.argv[1:]: | ||
| 565 | port = int(sys.argv[1]) | ||
| 566 | else: | ||
| 567 | port = 8000 | ||
| 568 | server_address = ('', port) | ||
| 569 | |||
| 570 | httpd = ServerClass(server_address, HandlerClass) | ||
| 571 | |||
| 572 | sa = httpd.socket.getsockname() | ||
| 573 | print "Serving HTTP on", sa[0], "port", sa[1], "..." | ||
| 574 | httpd.serve_forever() | ||
| 575 | |||
| 576 | |||
| 577 | if __name__ == '__main__': | ||
| 578 | test() | ||
| 579 | |||
| 580 | # arch-tag: 567449b3-cc90-45b6-bbe3-1e113995bdae | ||
diff --git a/test/cedet/tests/testdoublens.cpp b/test/cedet/tests/testdoublens.cpp index c3a2fc4a5e6..59e820027c3 100644 --- a/test/cedet/tests/testdoublens.cpp +++ b/test/cedet/tests/testdoublens.cpp | |||
| @@ -1,7 +1,24 @@ | |||
| 1 | // | 1 | // testdoublens.cpp --- semantic-ia-utest completion engine unit tests |
| 2 | // CPP file for semantic-ia-utest | 2 | |
| 3 | // completion engine unit tests. | 3 | // Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
| 4 | // | 4 | |
| 5 | // Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 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 | |||
| 5 | #include "testdoublens.hpp" | 22 | #include "testdoublens.hpp" |
| 6 | 23 | ||
| 7 | namespace Name1 { | 24 | namespace Name1 { |
| @@ -29,7 +46,7 @@ namespace Name1 { | |||
| 29 | void Foo::sendStuff(int /* a */, int /* b */) // ^3^ | 46 | void Foo::sendStuff(int /* a */, int /* b */) // ^3^ |
| 30 | { | 47 | { |
| 31 | } | 48 | } |
| 32 | 49 | ||
| 33 | } // namespace Name2 | 50 | } // namespace Name2 |
| 34 | } // namespace Name1 | 51 | } // namespace Name1 |
| 35 | 52 | ||
| @@ -44,7 +61,7 @@ int test_fcn () { | |||
| 44 | Name1::Name2::F//-4- | 61 | Name1::Name2::F//-4- |
| 45 | // #4# ( "Foo" ) | 62 | // #4# ( "Foo" ) |
| 46 | ; | 63 | ; |
| 47 | 64 | ||
| 48 | // @TODO - get this working... | 65 | // @TODO - get this working... |
| 49 | Name1::stage2_Foo::M//-5- | 66 | Name1::stage2_Foo::M//-5- |
| 50 | /// #5# ( "Mumble" ) | 67 | /// #5# ( "Mumble" ) |
| @@ -58,15 +75,15 @@ stage3_Foo foo_fcn() { | |||
| 58 | 75 | ||
| 59 | // Second test from Ravikiran Rajagopal | 76 | // Second test from Ravikiran Rajagopal |
| 60 | 77 | ||
| 61 | namespace A { | 78 | namespace A { |
| 62 | class foo { | 79 | class foo { |
| 63 | public: | 80 | public: |
| 64 | void aa(); | 81 | void aa(); |
| 65 | void bb(); | 82 | void bb(); |
| 66 | }; | 83 | }; |
| 67 | } | 84 | } |
| 68 | namespace A { | 85 | namespace A { |
| 69 | class bar { | 86 | class bar { |
| 70 | public: | 87 | public: |
| 71 | void xx(); | 88 | void xx(); |
| 72 | public: | 89 | public: |
| @@ -96,7 +113,7 @@ namespace a { | |||
| 96 | 113 | ||
| 97 | int Bar::baz() | 114 | int Bar::baz() |
| 98 | { | 115 | { |
| 99 | return dum// -7- | 116 | return dum// -7- |
| 100 | // #7# ( "dumdum" ) | 117 | // #7# ( "dumdum" ) |
| 101 | ; | 118 | ; |
| 102 | } | 119 | } |
diff --git a/test/cedet/tests/testdoublens.hpp b/test/cedet/tests/testdoublens.hpp index 917a75504b3..63b48257bb9 100644 --- a/test/cedet/tests/testdoublens.hpp +++ b/test/cedet/tests/testdoublens.hpp | |||
| @@ -1,6 +1,24 @@ | |||
| 1 | // | 1 | // testdoublens.hpp --- Header file used in one of the Semantic tests |
| 2 | // Header file used in one of the ia-utest tests. | 2 | |
| 3 | // | 3 | // Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. |
| 4 | |||
| 5 | // Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 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 | |||
| 4 | namespace Name1 { | 22 | namespace Name1 { |
| 5 | namespace Name2 { | 23 | namespace Name2 { |
| 6 | 24 | ||
diff --git a/test/cedet/tests/testjavacomp.java b/test/cedet/tests/testjavacomp.java index 3c2c2ef4ebe..369c93d9fdb 100644 --- a/test/cedet/tests/testjavacomp.java +++ b/test/cedet/tests/testjavacomp.java | |||
| @@ -1,24 +1,23 @@ | |||
| 1 | /** testjavacomp.java --- | 1 | // testjavacomp.java --- Semantic unit test for Java |
| 2 | * | 2 | |
| 3 | * Copyright (C) 2009, 2010 Free Software Foundation, Inc. | 3 | // Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
| 4 | * | 4 | |
| 5 | * Author: Eric M. Ludlam <eric@siege-engine.com> | 5 | // Author: Eric M. Ludlam <eric@siege-engine.com> |
| 6 | * | 6 | |
| 7 | * This file is part of GNU Emacs. | 7 | // This file is part of GNU Emacs. |
| 8 | * | 8 | |
| 9 | * GNU Emacs is free software: you can redistribute it and/or modify | 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 | 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 | 11 | // the Free Software Foundation, either version 3 of the License, or |
| 12 | * (at your option) any later version. | 12 | // (at your option) any later version. |
| 13 | * | 13 | |
| 14 | * GNU Emacs is distributed in the hope that it will be useful, | 14 | // GNU Emacs is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. | 17 | // GNU General Public License for more details. |
| 18 | * | 18 | |
| 19 | * You should have received a copy of the GNU General Public License | 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/>. | 20 | // along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
| 21 | */ | ||
| 22 | 21 | ||
| 23 | package tests.testjavacomp; | 22 | package tests.testjavacomp; |
| 24 | 23 | ||
diff --git a/test/cedet/tests/testspp.c b/test/cedet/tests/testspp.c index da0a8e9d965..cd6d0f2a24a 100644 --- a/test/cedet/tests/testspp.c +++ b/test/cedet/tests/testspp.c | |||
| @@ -1,6 +1,24 @@ | |||
| 1 | /* Attempt to test the C preprocessor | 1 | /* testspp.cpp --- Semantic unit test for the C preprocessor |
| 2 | * | 2 | |
| 3 | */ | 3 | Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| 4 | |||
| 5 | Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 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 | */ | ||
| 4 | 22 | ||
| 5 | int some_fcn (){} | 23 | int some_fcn (){} |
| 6 | 24 | ||
diff --git a/test/cedet/tests/testsppreplace.c b/test/cedet/tests/testsppreplace.c index 2785da05465..7d2593eea04 100644 --- a/test/cedet/tests/testsppreplace.c +++ b/test/cedet/tests/testsppreplace.c | |||
| @@ -1,5 +1,23 @@ | |||
| 1 | /* Test CPP/SPP Replacement | 1 | /* testsppreplace.c --- unit test for CPP/SPP Replacement |
| 2 | */ | 2 | Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| 3 | |||
| 4 | Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 5 | |||
| 6 | This file is part of GNU Emacs. | ||
| 7 | |||
| 8 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 9 | it under the terms of the GNU General Public License as published by | ||
| 10 | the Free Software Foundation, either version 3 of the License, or | ||
| 11 | (at your option) any later version. | ||
| 12 | |||
| 13 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | GNU General Public License for more details. | ||
| 17 | |||
| 18 | You should have received a copy of the GNU General Public License | ||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | */ | ||
| 3 | 21 | ||
| 4 | /* TEST: The EMU keyword doesn't screw up the function defn. */ | 22 | /* TEST: The EMU keyword doesn't screw up the function defn. */ |
| 5 | #define EMU | 23 | #define EMU |
diff --git a/test/cedet/tests/testsppreplaced.c b/test/cedet/tests/testsppreplaced.c index 580f7300cb8..f42727e9eb9 100644 --- a/test/cedet/tests/testsppreplaced.c +++ b/test/cedet/tests/testsppreplaced.c | |||
| @@ -1,5 +1,25 @@ | |||
| 1 | /* What the SPP replace file would looklike with MACROS replaced. | 1 | /* testsppreplaced.c --- unit test for CPP/SPP Replacement |
| 2 | */ | 2 | Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| 3 | |||
| 4 | Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 5 | |||
| 6 | This file is part of GNU Emacs. | ||
| 7 | |||
| 8 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 9 | it under the terms of the GNU General Public License as published by | ||
| 10 | the Free Software Foundation, either version 3 of the License, or | ||
| 11 | (at your option) any later version. | ||
| 12 | |||
| 13 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | GNU General Public License for more details. | ||
| 17 | |||
| 18 | You should have received a copy of the GNU General Public License | ||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* What the SPP replace file would looklike with MACROS replaced: */ | ||
| 3 | 23 | ||
| 4 | /* TEST: The EMU keyword doesn't screw up the function defn. */ | 24 | /* TEST: The EMU keyword doesn't screw up the function defn. */ |
| 5 | char parse_around_emu () | 25 | char parse_around_emu () |
diff --git a/test/cedet/tests/teststruct.cpp b/test/cedet/tests/teststruct.cpp deleted file mode 100644 index 8ecdc548871..00000000000 --- a/test/cedet/tests/teststruct.cpp +++ /dev/null | |||
| @@ -1,68 +0,0 @@ | |||
| 1 | // Combinations of templates and structure inheritance. | ||
| 2 | // | ||
| 3 | // Created by Alex Ott. | ||
| 4 | |||
| 5 | template <typename DerivedT> | ||
| 6 | struct grammar { | ||
| 7 | public: | ||
| 8 | typedef grammar<DerivedT> self_t; | ||
| 9 | typedef DerivedT const& embed_t; | ||
| 10 | grammar() {} | ||
| 11 | ~grammar() { } | ||
| 12 | void use_parser() const { } | ||
| 13 | void test1() { } | ||
| 14 | }; | ||
| 15 | |||
| 16 | struct PDFbool_parser : public grammar<PDFbool_parser> { | ||
| 17 | PDFbool_parser() {} | ||
| 18 | template <typename scannerT> struct definition { | ||
| 19 | typedef typename scannerT::iterator_t iterator_t; | ||
| 20 | int top; | ||
| 21 | definition(const PDFbool_parser& /*self*/) { | ||
| 22 | return ; | ||
| 23 | } | ||
| 24 | const int start() const { | ||
| 25 | return top; | ||
| 26 | } | ||
| 27 | }; | ||
| 28 | }; | ||
| 29 | |||
| 30 | int main(void) { | ||
| 31 | PDFbool_parser PDFbool_p = PDFbool_parser(); | ||
| 32 | PDFbool_p.//-1- | ||
| 33 | ; | ||
| 34 | // #1# ("definition" "embed_t" "self_t" "test1" "use_parser") | ||
| 35 | } | ||
| 36 | |||
| 37 | // ---------------------------------------------------------------------- | ||
| 38 | |||
| 39 | template <class Derived> struct Base { | ||
| 40 | public: | ||
| 41 | void interface() | ||
| 42 | { | ||
| 43 | // ... | ||
| 44 | static_cast<Derived*>(this)->implementation(); | ||
| 45 | // ... | ||
| 46 | } | ||
| 47 | |||
| 48 | static void static_func() | ||
| 49 | { | ||
| 50 | // ... | ||
| 51 | Derived::static_sub_func(); | ||
| 52 | // ... | ||
| 53 | } | ||
| 54 | }; | ||
| 55 | |||
| 56 | struct Derived : Base<Derived> { | ||
| 57 | void implementation() { } | ||
| 58 | static void static_sub_func() { } | ||
| 59 | }; | ||
| 60 | |||
| 61 | int foo () { | ||
| 62 | Derived d; | ||
| 63 | d.//-2- | ||
| 64 | ; | ||
| 65 | // #2# ("implementation" "interface" "static_func" "static_sub_func") | ||
| 66 | } | ||
| 67 | |||
| 68 | // arch-tag: d6e39f96-525e-44af-8cd1-d03e1829acd3 | ||
diff --git a/test/cedet/tests/testsubclass.cpp b/test/cedet/tests/testsubclass.cpp index 4e0e0c0dbda..4d379f707a5 100644 --- a/test/cedet/tests/testsubclass.cpp +++ b/test/cedet/tests/testsubclass.cpp | |||
| @@ -1,5 +1,23 @@ | |||
| 1 | /* Special test file for Semantic Analyzer and complex C++ inheritance. | 1 | // testsubclass.cpp --- unit test for analyzer and complex C++ inheritance |
| 2 | */ | 2 | |
| 3 | // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | // Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 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/>. | ||
| 3 | 21 | ||
| 4 | //#include <iostream> | 22 | //#include <iostream> |
| 5 | #include "testsubclass.hh" | 23 | #include "testsubclass.hh" |
| @@ -94,7 +112,7 @@ moose deer::alces::createMoose() | |||
| 94 | MooseVariableName = createMoose(); | 112 | MooseVariableName = createMoose(); |
| 95 | 113 | ||
| 96 | doLatinStuff(MooseVariableName); | 114 | doLatinStuff(MooseVariableName); |
| 97 | 115 | ||
| 98 | tmp = this.f// -1- | 116 | tmp = this.f// -1- |
| 99 | // #1# ( "fAlcesBool" "fIsValid" "fLatin" ) | 117 | // #1# ( "fAlcesBool" "fIsValid" "fLatin" ) |
| 100 | ; | 118 | ; |
| @@ -125,7 +143,7 @@ moose deer::alces::createMoose() | |||
| 125 | int someFunction(int mPickle) | 143 | int someFunction(int mPickle) |
| 126 | { | 144 | { |
| 127 | moose mMoose = deer::alces::createMoose(); | 145 | moose mMoose = deer::alces::createMoose(); |
| 128 | 146 | ||
| 129 | if (mPickle == 1) { | 147 | if (mPickle == 1) { |
| 130 | 148 | ||
| 131 | int mOption1 = 2; | 149 | int mOption1 = 2; |
| @@ -152,7 +170,7 @@ namespace pub_priv { | |||
| 152 | class A{ | 170 | class A{ |
| 153 | private: | 171 | private: |
| 154 | void private_a(){} | 172 | void private_a(){} |
| 155 | public: | 173 | public: |
| 156 | void public_a(); | 174 | void public_a(); |
| 157 | }; | 175 | }; |
| 158 | 176 | ||
diff --git a/test/cedet/tests/testsubclass.hh b/test/cedet/tests/testsubclass.hh index 1c4fdb97bef..15a757c7e7f 100644 --- a/test/cedet/tests/testsubclass.hh +++ b/test/cedet/tests/testsubclass.hh | |||
| @@ -1,8 +1,23 @@ | |||
| 1 | /* Special test file for Semantic Analyzer and complex C++ inheritance. | 1 | // testsubclass.hh --- unit test for analyzer and complex C++ inheritance |
| 2 | * | 2 | |
| 3 | * Header file for testsubclass.cpp with class defns but no | 3 | // Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| 4 | * implementations. | 4 | |
| 5 | */ | 5 | // Author: Eric M. Ludlam <eric@siege-engine.com> |
| 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/>. | ||
| 6 | 21 | ||
| 7 | //#include <cmath> | 22 | //#include <cmath> |
| 8 | // #include <stdio.h> | 23 | // #include <stdio.h> |
diff --git a/test/cedet/tests/testtemplates.cpp b/test/cedet/tests/testtemplates.cpp deleted file mode 100644 index 4e0f0e4abfa..00000000000 --- a/test/cedet/tests/testtemplates.cpp +++ /dev/null | |||
| @@ -1,92 +0,0 @@ | |||
| 1 | // Templates Test file: | ||
| 2 | // Written by 'Raf' | ||
| 3 | |||
| 4 | template <class T, int U, class V> | ||
| 5 | class read_ref { | ||
| 6 | public: | ||
| 7 | const T* read_ref_member_one( T); | ||
| 8 | const V* read_ref_member_two(); | ||
| 9 | }; | ||
| 10 | |||
| 11 | namespace NS { | ||
| 12 | template <class T, int U, class V> | ||
| 13 | class ref { | ||
| 14 | public: | ||
| 15 | read_ref<T,10,V> operator->() { | ||
| 16 | m_// -1- | ||
| 17 | ; | ||
| 18 | // #1# ( "m_datas" ) | ||
| 19 | } | ||
| 20 | |||
| 21 | private: | ||
| 22 | T m_datas[U]; | ||
| 23 | }; | ||
| 24 | |||
| 25 | } | ||
| 26 | |||
| 27 | class FooOne { | ||
| 28 | public: | ||
| 29 | int fooOneMember(); | ||
| 30 | }; | ||
| 31 | |||
| 32 | class FooTwo { | ||
| 33 | public: | ||
| 34 | int fooTwoMember(); | ||
| 35 | }; | ||
| 36 | |||
| 37 | class FooThree { | ||
| 38 | public: | ||
| 39 | int fooThreeMember(); | ||
| 40 | |||
| 41 | FooOne * operator->(); | ||
| 42 | }; | ||
| 43 | |||
| 44 | typedef ref<FooOne, 10,FooTwo> Test; | ||
| 45 | |||
| 46 | using NS; | ||
| 47 | |||
| 48 | void | ||
| 49 | main(void) { | ||
| 50 | ref<FooOne, 10, FooTwo> v; | ||
| 51 | |||
| 52 | v->read_ref_member_one()-> // -2- | ||
| 53 | ; | ||
| 54 | // #2# ( "fooOneMember" ) | ||
| 55 | |||
| 56 | v->read_ref_member_two()-> // -3- | ||
| 57 | ; | ||
| 58 | // #3# ( "fooTwoMember" ) | ||
| 59 | |||
| 60 | v-> // -4- | ||
| 61 | ; | ||
| 62 | // #4# ( "read_ref_member_one" "read_ref_member_two" ) | ||
| 63 | |||
| 64 | Test t; | ||
| 65 | |||
| 66 | t->read_ref_member_two()-> // -5- | ||
| 67 | ; | ||
| 68 | // #5# ( "fooTwoMember" ) | ||
| 69 | |||
| 70 | ref<FooOne, 10, FooThree> v2; | ||
| 71 | |||
| 72 | v2->read_ref_member_two()-> // -6- | ||
| 73 | ; | ||
| 74 | // #6# ( "fooOneMember" ) | ||
| 75 | |||
| 76 | /* Try all these things by also specifying the namespace in the name. */ | ||
| 77 | NS::ref<FooOne, 10, FooTwo> v3; | ||
| 78 | |||
| 79 | v3->read_ref_member_one()-> // -7- | ||
| 80 | ; | ||
| 81 | // #7# ( "fooOneMember" ) | ||
| 82 | |||
| 83 | v3->read_ref_member_two()-> // -8- | ||
| 84 | ; | ||
| 85 | // #8# ( "fooTwoMember" ) | ||
| 86 | |||
| 87 | v3->read_ref_member_two// @1@ 5 | ||
| 88 | ; | ||
| 89 | |||
| 90 | } | ||
| 91 | |||
| 92 | // arch-tag: 03cbb8c3-3d01-42ab-b416-42a08ea7b896 | ||
diff --git a/test/cedet/tests/testtypedefs.cpp b/test/cedet/tests/testtypedefs.cpp index 44848ab335a..3f0be25c494 100644 --- a/test/cedet/tests/testtypedefs.cpp +++ b/test/cedet/tests/testtypedefs.cpp | |||
| @@ -1,16 +1,31 @@ | |||
| 1 | // Sample with some fake bits out of std::string | 1 | // testtypedefs.cpp --- Sample with some fake bits out of std::string |
| 2 | // | 2 | |
| 3 | // Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | // Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 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 | |||
| 3 | // Thanks Ming-Wei Chang for these examples. | 22 | // Thanks Ming-Wei Chang for these examples. |
| 4 | 23 | ||
| 5 | namespace std { | 24 | namespace std { |
| 6 | |||
| 7 | template <T>class basic_string { | 25 | template <T>class basic_string { |
| 8 | |||
| 9 | public: | 26 | public: |
| 10 | void resize(int); | 27 | void resize(int); |
| 11 | |||
| 12 | }; | 28 | }; |
| 13 | |||
| 14 | } | 29 | } |
| 15 | 30 | ||
| 16 | typedef std::basic_string<char> mstring; | 31 | typedef std::basic_string<char> mstring; |
| @@ -18,41 +33,34 @@ typedef std::basic_string<char> mstring; | |||
| 18 | using namespace std; | 33 | using namespace std; |
| 19 | typedef basic_string<char> bstring; | 34 | typedef basic_string<char> bstring; |
| 20 | 35 | ||
| 21 | |||
| 22 | int main(){ | 36 | int main(){ |
| 23 | mstring a; | 37 | mstring a; |
| 24 | |||
| 25 | a.// -1- | 38 | a.// -1- |
| 26 | ; | 39 | ; |
| 27 | // #1# ( "resize" ) | 40 | // #1# ( "resize" ) |
| 28 | |||
| 29 | bstring b; | 41 | bstring b; |
| 30 | // It doesn't work here. | 42 | // It doesn't work here. |
| 31 | b.// -2- | 43 | b.// -2- |
| 32 | ; | 44 | ; |
| 33 | // #2# ( "resize" ) | 45 | // #2# ( "resize" ) |
| 34 | |||
| 35 | return 0; | 46 | return 0; |
| 36 | } | 47 | } |
| 37 | 48 | ||
| 38 | |||
| 39 | // ------------------ | 49 | // ------------------ |
| 40 | 50 | ||
| 41 | class Bar | 51 | class Bar |
| 42 | { | 52 | { |
| 43 | public: | 53 | public: |
| 44 | void someFunc() {} | 54 | void someFunc() {} |
| 45 | |||
| 46 | }; | 55 | }; |
| 47 | 56 | ||
| 48 | typedef Bar new_Bar; | 57 | typedef Bar new_Bar; |
| 49 | 58 | ||
| 50 | template <class mytype> | 59 | template <class mytype> |
| 51 | class TBar | 60 | class TBar |
| 52 | { | 61 | { |
| 53 | public: | 62 | public: |
| 54 | void otherFunc() {} | 63 | void otherFunc() {} |
| 55 | |||
| 56 | }; | 64 | }; |
| 57 | 65 | ||
| 58 | typedef TBar<char> new_TBar; | 66 | typedef TBar<char> new_TBar; |
| @@ -65,11 +73,9 @@ int main() | |||
| 65 | nb.// -3- | 73 | nb.// -3- |
| 66 | ; | 74 | ; |
| 67 | // #3# ("someFunc") | 75 | // #3# ("someFunc") |
| 68 | |||
| 69 | ntb.// -4- | 76 | ntb.// -4- |
| 70 | ; | 77 | ; |
| 71 | // #4# ("otherFunc") | 78 | // #4# ("otherFunc") |
| 72 | |||
| 73 | return 0; | 79 | return 0; |
| 74 | } | 80 | } |
| 75 | 81 | ||
diff --git a/test/cedet/tests/testusing.cpp b/test/cedet/tests/testusing.cpp deleted file mode 100644 index 3bd95a38113..00000000000 --- a/test/cedet/tests/testusing.cpp +++ /dev/null | |||
| @@ -1,134 +0,0 @@ | |||
| 1 | // Test using statements in C++ | ||
| 2 | |||
| 3 | #include <adstdio.h> | ||
| 4 | |||
| 5 | #include <testusing.hh> | ||
| 6 | |||
| 7 | namespace moose { | ||
| 8 | |||
| 9 | class MyClass; | ||
| 10 | class Point; | ||
| 11 | |||
| 12 | typedef MyClass snerk; | ||
| 13 | } | ||
| 14 | |||
| 15 | namespace moose { | ||
| 16 | |||
| 17 | class Point; | ||
| 18 | class MyClass; | ||
| 19 | |||
| 20 | } | ||
| 21 | |||
| 22 | namespace { | ||
| 23 | |||
| 24 | int global_variable = 0; | ||
| 25 | |||
| 26 | }; | ||
| 27 | |||
| 28 | using moose::MyClass; | ||
| 29 | |||
| 30 | void someFcn() { | ||
| 31 | |||
| 32 | MyClass f; | ||
| 33 | |||
| 34 | f.//-1- | ||
| 35 | ; //#1# ( "getVal" "setVal" ) | ||
| 36 | |||
| 37 | } | ||
| 38 | |||
| 39 | // Code from Zhiqiu Kong | ||
| 40 | |||
| 41 | namespace panda { | ||
| 42 | |||
| 43 | using namespace bread_name; | ||
| 44 | |||
| 45 | int func() | ||
| 46 | { | ||
| 47 | bread test; | ||
| 48 | test.//-2- | ||
| 49 | ;// #2# ( "geta" ) | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | } | ||
| 53 | |||
| 54 | // Local using statements and aliased types | ||
| 55 | // Code from David Engster | ||
| 56 | |||
| 57 | void func2() | ||
| 58 | { | ||
| 59 | using namespace somestuff; | ||
| 60 | OneClass f; | ||
| 61 | f.//-3- | ||
| 62 | ; //#3# ( "aFunc" "anInt" ) | ||
| 63 | } | ||
| 64 | |||
| 65 | void func3() | ||
| 66 | { | ||
| 67 | using somestuff::OneClass; | ||
| 68 | OneClass f; | ||
| 69 | f.//-4- | ||
| 70 | ; //#4# ( "aFunc" "anInt" ) | ||
| 71 | } | ||
| 72 | |||
| 73 | // Dereferencing alias types created through 'using' statements | ||
| 74 | |||
| 75 | // Alias with fully qualified name | ||
| 76 | void func4() | ||
| 77 | { | ||
| 78 | otherstuff::OneClass f; | ||
| 79 | f. //-5- | ||
| 80 | ; //#5# ( "aFunc" "anInt" ) | ||
| 81 | } | ||
| 82 | |||
| 83 | // Alias through namespace directive | ||
| 84 | void func5() | ||
| 85 | { | ||
| 86 | using namespace otherstuff; | ||
| 87 | OneClass f; | ||
| 88 | f. //-6- | ||
| 89 | ; //#6# ( "aFunc" "anInt" ) | ||
| 90 | } | ||
| 91 | |||
| 92 | // Check name hiding | ||
| 93 | void func6() | ||
| 94 | { | ||
| 95 | using namespace morestuff; | ||
| 96 | OneClass f; // Alias for somestuff::OneClass | ||
| 97 | f. //-7- | ||
| 98 | ; //#7# ( "aFunc" "anInt" ) | ||
| 99 | aStruct g; // This however is morestuff::aStruct ! | ||
| 100 | g. //-8- | ||
| 101 | ; //#8# ( "anotherBar" "anotherFoo" ) | ||
| 102 | } | ||
| 103 | |||
| 104 | // Alias of an alias | ||
| 105 | // Currently doesn't work interactively for some reason. | ||
| 106 | void func6() | ||
| 107 | { | ||
| 108 | using namespace evenmorestuff; | ||
| 109 | OneClass f; | ||
| 110 | f. //-7- | ||
| 111 | ; //#7# ( "aFunc" "anInt" ) | ||
| 112 | } | ||
| 113 | |||
| 114 | // Alias for struct in nested namespace, fully qualified | ||
| 115 | void func7() | ||
| 116 | { | ||
| 117 | outer::StructNested f; | ||
| 118 | f.//-8- | ||
| 119 | ; //#8# ( "one" "two" ) | ||
| 120 | } | ||
| 121 | |||
| 122 | // Alias for nested namespace | ||
| 123 | void func8() | ||
| 124 | { | ||
| 125 | using namespace outerinner; | ||
| 126 | StructNested f; | ||
| 127 | AnotherStruct g; | ||
| 128 | f.//-9- | ||
| 129 | ; //#9# ( "one" "two" ) | ||
| 130 | g.//-10- | ||
| 131 | ; //#10# ( "four" "three" ) | ||
| 132 | } | ||
| 133 | |||
| 134 | // arch-tag: 8e68d5d1-4d48-47c6-a910-d8d6b66b2768 | ||
diff --git a/test/cedet/tests/testusing.hh b/test/cedet/tests/testusing.hh deleted file mode 100644 index 4c91bf0db24..00000000000 --- a/test/cedet/tests/testusing.hh +++ /dev/null | |||
| @@ -1,127 +0,0 @@ | |||
| 1 | // test usings header file. | ||
| 2 | |||
| 3 | namespace moose { | ||
| 4 | |||
| 5 | class Point; | ||
| 6 | |||
| 7 | class MyClass; | ||
| 8 | |||
| 9 | } | ||
| 10 | |||
| 11 | |||
| 12 | namespace moose { | ||
| 13 | |||
| 14 | class Point; | ||
| 15 | |||
| 16 | class MyClass { | ||
| 17 | public: | ||
| 18 | MyClass() : fVal(0) { | ||
| 19 | } | ||
| 20 | |||
| 21 | ~MyClass() {}; | ||
| 22 | |||
| 23 | /** | ||
| 24 | * fVal Accessors | ||
| 25 | * @{ | ||
| 26 | */ | ||
| 27 | int getVal() const { | ||
| 28 | return fVal; | ||
| 29 | } | ||
| 30 | void setVal(int Val) const { | ||
| 31 | fVal = Val; | ||
| 32 | } | ||
| 33 | /** | ||
| 34 | * @} | ||
| 35 | */ | ||
| 36 | private: | ||
| 37 | int fVal; | ||
| 38 | }; | ||
| 39 | |||
| 40 | } | ||
| 41 | |||
| 42 | namespace deer { | ||
| 43 | |||
| 44 | class Pickle; | ||
| 45 | |||
| 46 | }; | ||
| 47 | |||
| 48 | // Code from Zhiqiu Kong | ||
| 49 | |||
| 50 | #ifndef BREAD_H | ||
| 51 | #define BREAD_H | ||
| 52 | |||
| 53 | namespace bread_name { | ||
| 54 | class bread | ||
| 55 | { | ||
| 56 | public: | ||
| 57 | void geta(); | ||
| 58 | private: | ||
| 59 | int m_a; | ||
| 60 | int m_b; | ||
| 61 | }; | ||
| 62 | } | ||
| 63 | |||
| 64 | #endif | ||
| 65 | |||
| 66 | // Code from David Engster | ||
| 67 | // Creating alias types through 'using' trickery | ||
| 68 | |||
| 69 | namespace somestuff { | ||
| 70 | class OneClass { | ||
| 71 | public: | ||
| 72 | void aFunc(); | ||
| 73 | int anInt; | ||
| 74 | }; | ||
| 75 | struct aStruct { | ||
| 76 | int foo; | ||
| 77 | int bar; | ||
| 78 | }; | ||
| 79 | } | ||
| 80 | |||
| 81 | namespace otherstuff { | ||
| 82 | // make otherstuff::OneClass an alias for somestuff::OneClass | ||
| 83 | using somestuff::OneClass; | ||
| 84 | } | ||
| 85 | |||
| 86 | namespace morestuff { | ||
| 87 | // make morestuff an alias namespace for somestuff | ||
| 88 | using namespace somestuff; | ||
| 89 | // but hide aStruct with own type | ||
| 90 | struct aStruct { | ||
| 91 | int anotherFoo; | ||
| 92 | int anotherBar; | ||
| 93 | }; | ||
| 94 | } | ||
| 95 | |||
| 96 | // We can also create an alias for an alias | ||
| 97 | namespace evenmorestuff { | ||
| 98 | using otherstuff::OneClass; | ||
| 99 | } | ||
| 100 | |||
| 101 | // Now with nested namespaces | ||
| 102 | namespace outer { | ||
| 103 | namespace inner { | ||
| 104 | struct StructNested { | ||
| 105 | int one; | ||
| 106 | int two; | ||
| 107 | }; | ||
| 108 | struct AnotherStruct { | ||
| 109 | int three; | ||
| 110 | int four; | ||
| 111 | }; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | // Elevate the first struct into 'outer' | ||
| 116 | // so that we can access it via 'outer::StructNested' | ||
| 117 | namespace outer { | ||
| 118 | using outer::inner::StructNested; | ||
| 119 | } | ||
| 120 | |||
| 121 | // Create an alias for a nested namespace | ||
| 122 | namespace outerinner { | ||
| 123 | // equivalent to 'namespace outerinner = outer::inner;' | ||
| 124 | using namespace outer::inner; | ||
| 125 | } | ||
| 126 | |||
| 127 | // arch-tag: f7e59fad-100b-47d3-ae8b-a8390a026ade | ||
diff --git a/test/cedet/tests/testvarnames.c b/test/cedet/tests/testvarnames.c index eeb5997b0ba..f069efa7258 100644 --- a/test/cedet/tests/testvarnames.c +++ b/test/cedet/tests/testvarnames.c | |||
| @@ -1,6 +1,25 @@ | |||
| 1 | /* | 1 | /* testvarnames.cpp |
| 2 | * Test variable and function names, lists of variables on one line, etc. | 2 | Test variable and function names, lists of variables on one line, etc. |
| 3 | */ | 3 | |
| 4 | Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | Author: Eric M. Ludlam <eric@siege-engine.com> | ||
| 7 | |||
| 8 | This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | it under the terms of the GNU General Public License as published by | ||
| 12 | the Free Software Foundation, either version 3 of the License, or | ||
| 13 | (at your option) any later version. | ||
| 14 | |||
| 15 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | GNU General Public License for more details. | ||
| 19 | |||
| 20 | You should have received a copy of the GNU General Public License | ||
| 21 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | */ | ||
| 4 | 23 | ||
| 5 | struct independent { | 24 | struct independent { |
| 6 | int indep_1; | 25 | int indep_1; |