[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests a3da4e8 121/316: Added new file
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests a3da4e8 121/316: Added new file to test completion on STL classes and namespace. |
Date: |
Sat, 28 Jan 2017 09:09:53 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit a3da4e890b5a68d1a73e86f815bcb62abef31c53
Author: David Engster <address@hidden>
Commit: Edward John Steere <address@hidden>
Added new file to test completion on STL classes and namespace.
* tests/cedet/semantic/stltest.el: New file to test completion on STL
classes and namespace.
---
test/manual/cedet/cedet/semantic/stltest.el | 103 +++++++++++++++++++++++++++
1 file changed, 103 insertions(+)
diff --git a/test/manual/cedet/cedet/semantic/stltest.el
b/test/manual/cedet/cedet/semantic/stltest.el
new file mode 100644
index 0000000..62153d9
--- /dev/null
+++ b/test/manual/cedet/cedet/semantic/stltest.el
@@ -0,0 +1,103 @@
+;;; semantic-stltest --- Test Semantic's C++ parser on the STL
+
+;;; Copyright (C) 2012 David Engster
+
+;; Author: David Engster <address@hidden>
+
+;; This file is not part of GNU Emacs.
+
+;; Semantic 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/>.
+
+;;; Commentary:
+;;
+;; Test completions on STL classes and namespaces.
+;; This test is not run by default since it requires a full STL installation.
+;; It can also be used very well to benchmark the C++ parser.
+
+(defvar semantic-stltest-vector-buf
+ "#include <vector>\nint main(void) { std::vector<int> foo; foo.TESTHERE
\n}")
+(defvar semantic-stltest-vector-members
+ '("begin" "end" "rbegin" "rend" "size" "max_size" "resize" "capacity"
+ "empty" "reserve" "at" "front" "back" "assign" "push_back" "pop_back"
+ "insert" "erase" "swap" "clear" "iterator" "const_iterator"
"reverse_iterator"
+ "const_reverse_iterator" "reference" "const_reference" "size_type"
+ "value_type" "difference_type" "allocator_type" "pointer" "const_pointer"))
+
+(defvar semantic-stltest-string-buf
+ "#include <string>\nint main(void) { std::string foo; foo.TESTHERE \n}")
+(defvar semantic-stltest-string-members
+ '("allocator_type" "append" "assign" "at" "begin" "c_str" "capacity" "clear"
+ "compare" "const_iterator" "const_pointer" "const_reference"
"const_reverse_iterator"
+ "copy" "data" "difference_type" "empty" "end" "erase" "find"
"find_first_not_of"
+ "find_first_of" "find_last_not_of" "find_last_of" "get_allocator" "insert"
+ "iterator" "length" "max_size" "npos" "pointer" "push_back" "rbegin"
"reference"
+ "rend" "replace" "reserve" "resize" "reverse_iterator" "size" "size_type"
"substr"
+ "swap" "traits_type" "value_type"))
+
+(defvar semantic-stltest-map-buf
+ "#include <map>\n#include <string>\nint main(void) {
std::map<int,std::string> foo; foo.TESTHERE \n}")
+(defvar semantic-stltest-map-members
+ '("allocator_type" "at" "begin" "clear" "const_iterator" "const_pointer"
+ "const_reference" "const_reverse_iterator" "count" "difference_type"
"empty"
+ "end" "equal_range" "erase" "find" "get_allocator" "insert" "iterator"
"key_comp"
+ "key_compare" "key_type" "lower_bound" "mapped_type" "max_size" "pointer"
"rbegin"
+ "reference" "rend" "reverse_iterator" "size" "size_type" "swap"
"upper_bound" "value_comp"
+ "value_compare" "value_type"))
+
+(defvar semantic-stltest-map-buf
+ "#include <map>\n#include <string>\nint main(void) {
std::map<int,std::string> foo; foo.TESTHERE \n}")
+(defvar semantic-stltest-map-members
+ '("allocator_type" "at" "begin" "clear" "const_iterator" "const_pointer"
+ "const_reference" "const_reverse_iterator" "count" "difference_type"
"empty"
+ "end" "equal_range" "erase" "find" "get_allocator" "insert" "iterator"
"key_comp"
+ "key_compare" "key_type" "lower_bound" "mapped_type" "max_size" "pointer"
"rbegin"
+ "reference" "rend" "reverse_iterator" "size" "size_type" "swap"
"upper_bound" "value_comp"
+ "value_compare" "value_type"))
+
+(defvar semantic-stltest-iostream-buf
+ "#include <iostream>\nint main(void) { std::TESTHERE \n}")
+(defvar semantic-stltest-iostream-members
+ '("ios_base" "ios" "istream" "ostream" "iostream" "ifstream" "ofstream"
"fstream" "istringstream"
+ "ostringstream" "stringstream" "streambuf" "filebuf" "stringbuf" "cin"
"cout" "cerr" "clog" "fpos"
+ "streamoff" "streampos" "streamsize" "boolalpha" "dec" "endl" "ends"
"fixed" "flush" "hex" "internal"
+ "left" "noboolalpha" "noshowbase" "noshowpoint" "noshowpos" "noskipws"
"nounitbuf" "nouppercase" "oct"
+ "right" "scientific" "showbase" "showpoint" "showpos" "skipws" "unitbuf"
"uppercase" "ws"))
+
+
+(defun semantic-stltest (class)
+ "Test completions on CLASS."
+ (semantic-mode 1)
+ (with-current-buffer
+ (find-file-noselect "/tmp/stltest.cpp")
+ (erase-buffer)
+ (insert (symbol-value (intern
+ (concat "semantic-stltest-" class "-buf"))))
+ (goto-char (point-min))
+ (search-forward "TESTHERE")
+ (delete-region (match-beginning 0) (match-end 0))
+ (let* ((out (or (semantic-analyze-possible-completions (point))
+ (error "%s: Did not get any tags." class)))
+ (names (mapcar 'semantic-tag-name out)))
+ (dolist (cur (symbol-value (intern
+ (concat "semantic-stltest-" class "-members"))))
+ (unless (member cur names)
+ (error "Did not find %s in %s class." cur class)))))
+ (message "STL %s PASSED." class))
+
+(setq-default semanticdb-new-database-class 'semanticdb-project-database)
+(semantic-stltest "vector")
+(semantic-stltest "string")
+(semantic-stltest "map")
+;; I know, not a class...
+(semantic-stltest "iostream")
- [Emacs-diffs] scratch/merge-cedet-tests adc318b 115/316: New test file., (continued)
- [Emacs-diffs] scratch/merge-cedet-tests adc318b 115/316: New test file., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 901dc28 119/316: New test file., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests f580185 118/316: Expand preprocessor to handle macros which open or close scope., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ded1e9b 109/316: EDE security tests, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests cc6e417 123/316: Improve test utilities re complation and deletion, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests c86be27 133/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 216e4f4 129/316: Synchronize cedet/semantic with Emacs., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 377e041 142/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 702d44d 139/316: Fix how the target file name is created, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 7b417f2 131/316: Tests contributed by Barry OReilly, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a3da4e8 121/316: Added new file to test completion on STL classes and namespace.,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests 309ef34 124/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ae78cf0 140/316: Tests: Add ERT test for the C Bovinator, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 39048f9 153/316: (ede-detect-utest): Re-run tests with inode optimization disabled., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests af4eb43 149/316: Additions to generic project testing, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 614a6bb 044/316: Synchronize base 'cedet/ede' with Emacs, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests a375d40 093/316: ("cit"): Give it a new name. (Misc): New target., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests b0da906 144/316: New unit test for EDE project detection., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 9c2d002 145/316: Added cpproot and java root to detection tests, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 47c4081 165/316: sample lib srces for dirmatch tests., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ef840da 159/316: compdb: add project detection tests, Edward John Steere, 2017/01/28