[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: |
Fri, 27 Jan 2017 20:03:33 +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 3739238 086/316: Move tests in cedet/semantic, (continued)
- [Emacs-diffs] scratch/merge-cedet-tests 3739238 086/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 19ad5c7 095/316: Merge from 1.0pre6 branch, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 217feb1 080/316: Synchronize cedet/semantic with Emacs., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 9641120 108/316: Fake configure.in for project detection purposes., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 85a3b5a 106/316: (cit): Add "cit-projvar.el"., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests adc318b 115/316: New test file., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 216e4f4 129/316: Synchronize cedet/semantic with Emacs., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests ceb9293 130/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 7b417f2 131/316: Tests contributed by Barry OReilly, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 6d9366a 135/316: Make 'this' a pointer., Edward John Steere, 2017/01/27
- [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 a7926fd 155/316: detect-utest.el: (ede-detect-utest-configdir): New fcn (ede-detect-utest-arduino-install): New faux install dir (ede-detect-utest-init-dirmatch): Point at fake intalldir to get fake board., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 8900419 148/316: Added arduino project detection, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 9c2d002 145/316: Added cpproot and java root to detection tests, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 39048f9 153/316: (ede-detect-utest): Re-run tests with inode optimization disabled., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 14c75f7 175/316: (cit-version): New variable. (semantic): New require, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests fa54ec1 162/316: (isFooLike, A, B, main2): New test tweaked from example by Liang Wang, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 4972b30 176/316: (ede, ede-make): New require (cit-srecode-verify-tags): Fix debugging output on failure. Patch from David Engster (cit-compile-and-wait): Use ede-make-command, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 47c4081 165/316: sample lib srces for dirmatch tests., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 86ed340 147/316: Additions to detection testing, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 0781aac 164/316: Add comments, require cedet-files., Edward John Steere, 2017/01/27