annotate test/cedet/semantic-utest.el @ 107678:cca79b32ecaa

* maintaining.texi (VCS Concepts): Fix typo.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 25 Mar 2010 19:32:51 -0400
parents 1d1d5d9bd884
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104494
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; semantic-utest.el --- Tests for semantic's parsing system.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
3 ;;; Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
104494
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; the Free Software Foundation, either version 3 of the License, or
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; (at your option) any later version.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; GNU General Public License for more details.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;;; Commentary:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; Semantic's parsing and partial parsing system is pretty complex.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; These unit tests attempt to emulate semantic's partial reparsing
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; and full reparsing system, and anything else I may feel the urge
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; to write a test for.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 (require 'semantic)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 (load-file "cedet-utests.el")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 (defvar semantic-utest-temp-directory (if (fboundp 'temp-directory)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 (temp-directory)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 temporary-file-directory)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 "Temporary directory to use when creating files.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 (defun semantic-utest-fname (name)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 "Create a filename for NAME in /tmp."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (expand-file-name name semantic-utest-temp-directory))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 ;; Data for C tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (defvar semantic-utest-C-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 "/* Test file for C language for Unit Tests */
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 #include <stdio.h>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 #include \"sutest.h\"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 struct mystruct1 {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 int slot11;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 char slot12;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 float slot13;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 };
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 int var1;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 float funp1(char arg11, char arg12);
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 char fun2(int arg_21, int arg_22) /*1*/
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 struct mystruct1 *ms1 = malloc(sizeof(struct mystruct1));
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 char sv = calc_sv(var1);
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 if (var1 == 0) {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 sv = 1;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 } else if (arg_21 == 0) {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 sv = 2;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 } else if (arg_22 == 0) {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 sv = 3;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 } else {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 sv = 4;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 printf(\"SV = %d\\n\", sv);
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 /* Memory Leak */
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ms1.slot1 = sv;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 return 'A' + sv;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 "Contents of a C buffer initialized by this unit test.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 Be sure to change `semantic-utest-C-name-contents' when you
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 change this variable.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (defvar semantic-utest-C-h-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 "/* Test file for C language header file for Unit Tests */
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 int calc_sv(int);
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 "Contents of a C header file buffer initialized by this unit test.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (defvar semantic-utest-C-filename (semantic-utest-fname "sutest.c")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 "File to open and erase during this test for C.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (defvar semantic-utest-C-filename-h
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (concat (file-name-sans-extension semantic-utest-C-filename)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 ".h")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 "Header file filename for C")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (defvar semantic-utest-C-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 '(("stdio.h" include
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (:system-flag t)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 nil (overlay 48 66 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ("sutest.h" include nil nil (overlay 67 86 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 ("mystruct1" type
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 (:members
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (("slot11" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (reparse-symbol classsubparts)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (overlay 109 120 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 ("slot12" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (:type "char")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (reparse-symbol classsubparts)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (overlay 123 135 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 ("slot13" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (:type "float")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (reparse-symbol classsubparts)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (overlay 138 151 "sutest.c")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 :type "struct")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 nil (overlay 88 154 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 ("var1" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 nil (overlay 156 165 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 ("funp1" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (:prototype-flag t :arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (("arg11" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (:type "char")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (reparse-symbol arg-sub-list)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (overlay 179 190 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 ("arg12" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (:type "char")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (reparse-symbol arg-sub-list)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (overlay 191 202 "sutest.c")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 :type "float")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 nil (overlay 167 203 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (("arg_21" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (reparse-symbol arg-sub-list)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (overlay 215 226 "sutest.c"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 ("arg_22" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (reparse-symbol arg-sub-list)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (overlay 227 238 "sutest.c")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 :type "char")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 nil (overlay 205 566 "sutest.c")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 "List of expected tag names for C.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 ;; Data for Python tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (defvar semantic-utest-Python-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 def fun1(a,b,c):
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 return a
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 def fun2(a,b,c): #1
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 return b
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 ; "pyhon test case. notice that python is indentation sensitive
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (defvar semantic-utest-Python-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 '(("fun1" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (("a" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (reparse-symbol function_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (overlay 10 11 "tst.py"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 ("b" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (reparse-symbol function_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (overlay 12 13 "tst.py"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 ("c" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (reparse-symbol function_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (overlay 14 15 "tst.py"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 nil (overlay 1 31 "tst.py"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (("a" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (reparse-symbol function_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (overlay 41 42 "tst.py"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 ("b" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (reparse-symbol function_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (overlay 43 44 "tst.py"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 ("c" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (reparse-symbol function_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (overlay 45 46 "tst.py"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 nil (overlay 32 65 "tst.py")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 "List of expected tag names for Python.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 ;; Data for Java tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 (defvar semantic-utest-Java-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 class JavaTest{
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 void fun1(int a,int b){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 return a;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 void fun2(int a,int b){ //1
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 return b;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (defvar semantic-utest-Java-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 '(("JavaTest" type
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (:members
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (("fun1" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (("a" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (overlay 30 35 "JavaTest.java"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 ("b" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (overlay 36 41 "JavaTest.java")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 :type "void")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (reparse-symbol class_member_declaration)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (overlay 20 61 "JavaTest.java"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 (("a" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 (overlay 75 80 "JavaTest.java"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 ("b" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (overlay 81 86 "JavaTest.java")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 :type "void")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (reparse-symbol class_member_declaration)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (overlay 65 110 "JavaTest.java")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 :type "class")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 nil (overlay 2 113 "JavaTest.java")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 "List of expected tag names for Java."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 ;; Data for Javascript tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (defvar semantic-utest-Javascript-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 function fun1(a, b){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 return a;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 function fun2(a,b){ //1
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 return b;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 (defvar semantic-utest-Javascript-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 '(("fun1" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 (("a" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (reparse-symbol FormalParameterList)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 (overlay 15 16 "tst.js"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 ("b" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 (reparse-symbol FormalParameterList)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (overlay 18 19 "tst.js"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 nil (overlay 1 39 "tst.js"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (("a" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 (reparse-symbol FormalParameterList)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 (overlay 55 56 "tst.js"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 ("b" variable nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 (reparse-symbol FormalParameterList)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (overlay 57 58 "tst.js"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 nil (overlay 41 82 "tst.js")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 "List of expected tag names for Javascript.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 ;; Data for Makefile tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 (defvar semantic-utest-Makefile-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 t1:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 \techo t1
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 t2:t1 #1
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 \techo t2
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (defvar semantic-utest-Makefile-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 '(("t1" function nil nil (overlay 1 9 "Makefile"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 ("t2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 ("t1"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 nil (overlay 18 28 "Makefile")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 "List of expected tag names for Makefile.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 ;; Data for Scheme tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 (defvar semantic-utest-Scheme-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (define fun1 2)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (define fun2 3 ;1
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 ")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (defvar semantic-utest-Scheme-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 '(("fun1" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (:default-value ("2"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 nil (overlay 3 18 "tst.scm"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 ("fun2" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (:default-value ("3"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 nil (overlay 21 55 "tst.scm")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 ;; Data for Html tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (defvar semantic-utest-Html-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 <html>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 <body>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 <h1>hello</h1>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 </body><!--1-->
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 </html>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (defvar semantic-utest-Html-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 '(("hello" section
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (:members
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (("hello" section nil nil (overlay 21 24 "tst.html"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 nil (overlay 10 15 "tst.html")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 ;; Data for PHP tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (defvar semantic-utest-PHP-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 "<?php
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 function fun1(){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 return \"fun1\";
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 function fun2($arg1){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 $output = \"argument to fun2: \" . $arg1;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 return $output;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 class aClass {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 public function fun1($a, $b){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 return $a;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 public function fun2($a, $b){
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 return $b;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 ?> "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 (defvar semantic-utest-PHP-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 '(("fun1" function nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 nil (overlay 9 45 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (:arguments (("$arg1" variable nil (reparse-symbol formal_parameters) (overlay 61 66 "phptest.php"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (overlay 47 132 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 ("aClass" type
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (:members (("fun1" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (:typemodifiers ("public") :arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (("$a" variable nil (reparse-symbol formal_parameters) (overlay 174 176 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 ("$b" variable nil (reparse-symbol formal_parameters) (overlay 178 180 "phptest.php"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 (overlay 153 204 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 (:typemodifiers ("public") :arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 (("$a" variable nil (reparse-symbol formal_parameters) (overlay 230 232 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 ("$b" variable nil (reparse-symbol formal_parameters) (overlay 234 236 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 (overlay 209 260 "phptest.php"))) :type "class")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 (overlay 135 262 "phptest.php"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 "Expected results from the PHP Unit test"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 ;; Data for Csharp C# tests
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 (defvar semantic-utest-Csharp-buffer-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 "
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 class someClass {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 int fun1(int a, int b) {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 return a; }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 int fun2(int a, int b) {
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 return b; }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 }
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 ")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 (defvar semantic-utest-Csharp-name-contents
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 '(("someClass" type
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 (:members
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 (("fun1" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 (("a" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 (overlay 30 35 "tst.cs"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 ("b" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 (overlay 37 42 "tst.cs")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 :type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 (reparse-symbol class_member_declaration)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 (overlay 21 61 "tst.cs"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 ("fun2" function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (:arguments
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 (("a" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (overlay 73 78 "tst.cs"))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 ("b" variable
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 (:type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (reparse-symbol formal_parameters)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 (overlay 80 85 "tst.cs")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 :type "int")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 (reparse-symbol class_member_declaration)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 (overlay 64 104 "tst.cs")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 :type "class")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 nil (overlay 1 106 "tst.cs")))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 (defun semantic-utest-makebuffer (filename contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 "Create a buffer for FILENAME for use in a unit test.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 Pre-fill the buffer with CONTENTS."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 (let ((buff (semantic-find-file-noselect filename)))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 (set-buffer buff)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (setq buffer-offer-save nil)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 (font-lock-mode -1) ;; Font lock has issues in Emacs 23
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 (toggle-read-only -1) ;; In case /tmp doesn't exist.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 (erase-buffer)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (insert contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 ;(semantic-fetch-tags) ;JAVE could this go here?
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (set-buffer-modified-p nil)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 buff
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 (defun semantic-utest-C ()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 "Run semantic's C unit test."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 (save-excursion
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 (let ((buff (semantic-utest-makebuffer semantic-utest-C-filename semantic-utest-C-buffer-contents))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (buff2 (semantic-utest-makebuffer semantic-utest-C-filename-h semantic-utest-C-h-buffer-contents))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 (semantic-fetch-tags)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 (set-buffer buff)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 ;; Turn off a range of modes
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 (semantic-idle-scheduler-mode -1)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 ;; Turn on some modes
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 (semantic-highlight-edits-mode 1)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 ;; Update tags, and show it.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 (semantic-fetch-tags)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (switch-to-buffer buff)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 (sit-for 0)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 ;; Run the tests.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 ;;(message "First parsing test.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 (semantic-utest-verify-names semantic-utest-C-name-contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 ;;(message "Invalid tag test.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (semantic-utest-last-invalid semantic-utest-C-name-contents '("fun2") "/\\*1\\*/" "/* Deleted this line */")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (semantic-utest-verify-names semantic-utest-C-name-contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 (set-buffer-modified-p nil)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 ;; Clean up
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 ;; (kill-buffer buff)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 ;; (kill-buffer buff2)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 (message "All C tests passed.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 (defun semantic-utest-generic (testname filename contents name-contents names-removed killme insertme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 "Generic unit test according to template.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 Should work for languages withouth .h files, python javascript java.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 TESTNAME is the name of the test.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541 FILENAME is the name of the file to create.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 CONTENTS is the contents of the file to test.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 NAME-CONTENTS is the list of names that should be in the contents.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 NAMES-REMOVED is the list of names that gets removed in the removal step.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 KILLME is the name of items to be killed.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 INSERTME is the text to be inserted after the deletion."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 (save-excursion
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 (let ((buff (semantic-utest-makebuffer filename contents))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 ;; Turn off a range of modes
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 (semantic-idle-scheduler-mode -1)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 ;; Turn on some modes
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 (semantic-highlight-edits-mode 1)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 ;; Update tags, and show it.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (semantic-fetch-tags)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (switch-to-buffer buff)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (sit-for 0)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561 ;; Run the tests.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 ;;(message "First parsing test %s." testname)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 (semantic-utest-verify-names name-contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 ;;(message "Invalid tag test %s." testname)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 (semantic-utest-last-invalid name-contents names-removed killme insertme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 (semantic-utest-verify-names name-contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 (set-buffer-modified-p nil)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 ;; Clean up
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 ;; (kill-buffer buff)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 (message "All %s tests passed." testname)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 (defun semantic-utest-Python()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 (if (fboundp 'python-mode)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 (semantic-utest-generic "Python" (semantic-utest-fname "pytest.py") semantic-utest-Python-buffer-contents semantic-utest-Python-name-contents '("fun2") "#1" "#deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 (message "Skilling Python test: NO major mode."))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 (defun semantic-utest-Javascript()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 (if (fboundp 'javascript-mode)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (semantic-utest-generic "Javascript" (semantic-utest-fname "javascripttest.js") semantic-utest-Javascript-buffer-contents semantic-utest-Javascript-name-contents '("fun2") "//1" "//deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 (message "Skipping JavaScript test: NO major mode."))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 (defun semantic-utest-Java()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 ;; If JDE is installed, it might mess things up depending on the version
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 ;; that was installed.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 (let ((auto-mode-alist '(("\\.java\\'" . java-mode))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 (semantic-utest-generic "Java" (semantic-utest-fname "JavaTest.java") semantic-utest-Java-buffer-contents semantic-utest-Java-name-contents '("fun2") "//1" "//deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 (defun semantic-utest-Makefile()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 (semantic-utest-generic "Makefile" (semantic-utest-fname "Makefile") semantic-utest-Makefile-buffer-contents semantic-utest-Makefile-name-contents '("fun2") "#1" "#deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 (defun semantic-utest-Scheme()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 (semantic-utest-generic "Scheme" (semantic-utest-fname "tst.scm") semantic-utest-Scheme-buffer-contents semantic-utest-Scheme-name-contents '("fun2") ";1" ";deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
608
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 (defun semantic-utest-Html()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 ;; Disable html-helper auto-fill-in mode.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 (let ((html-helper-build-new-buffer nil))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 (semantic-utest-generic "HTML" (semantic-utest-fname "tst.html") semantic-utest-Html-buffer-contents semantic-utest-Html-name-contents '("fun2") "<!--1-->" "<!--deleted line-->")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
616
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 (defun semantic-utest-PHP()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 (if (fboundp 'php-mode)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 (semantic-utest-generic "PHP" (semantic-utest-fname "phptest.php") semantic-utest-PHP-buffer-contents semantic-utest-PHP-name-contents '("fun1") "fun2" "%^@")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 (message "Skipping PHP Test. No php-mode loaded."))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624 ;look at http://mfgames.com/linux/csharp-mode
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625 (defun semantic-utest-Csharp() ;; hmm i dont even know how to edit a scharp file. need a csharp mode implementation i suppose
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 (if (fboundp 'csharp-mode)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 (semantic-utest-generic "C#" (semantic-utest-fname "csharptest.cs") semantic-utest-Csharp-buffer-contents semantic-utest-Csharp-name-contents '("fun2") "//1" "//deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 (message "Skipping C# test. No csharp-mode loaded."))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 ;; stubs
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 ; stuff for Erlang
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637 ;;-module(hello).
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 ;-export([hello_world/0]).
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 ;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640 ;hello_world()->
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 ; io:format("Hello World ~n").
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 ;(defun semantic-utest-Erlang()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 ; (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 ; (semantic-utest-generic "Erlang" (semantic-utest-fname "tst.erl") semantic-utest-Erlang-buffer-contents semantic-utest-Erlang-name-contents '("fun2") "//1" "//deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 ; )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 ;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 ;;texi is also supported
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 ;(defun semantic-utest-Texi()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 ; (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 ; (semantic-utest-generic "texi" (semantic-utest-fname "tst.texi") semantic-utest-Texi-buffer-contents semantic-utest-Texi-name-contents '("fun2") "//1" "//deleted line")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 ; )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 ;;;###autoload
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 (defun semantic-utest-main()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 (interactive)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 "call all utests"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 (cedet-utest-log-start "multi-lang parsing")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 (cedet-utest-log " * C tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (semantic-utest-C)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (cedet-utest-log " * Python tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 (semantic-utest-Python)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 (cedet-utest-log " * Java tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 (semantic-utest-Java)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 (cedet-utest-log " * Javascript tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668 (semantic-utest-Javascript)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 (cedet-utest-log " * Makefile tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 (semantic-utest-Makefile)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 (cedet-utest-log " * Scheme tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (semantic-utest-Scheme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 (cedet-utest-log " * Html tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674 (semantic-utest-Html)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 (cedet-utest-log " * PHP tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 (semantic-utest-PHP)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677 (cedet-utest-log " * Csharp tests...")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 (semantic-utest-Csharp)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 (cedet-utest-log-shutdown "multi-lang parsing")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 ;;; Buffer contents validation
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 ;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 (defun semantic-utest-match-attributes (attr1 attr2 skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686 "Compare attribute lists ATTR1 and ATTR2.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 Argument SKIPNAMES is a list of names that may be child nodes to skip."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 (let ((res t))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 (while (and res attr1 attr2)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 ;; Compare
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 (setq res
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 (cond ((and (listp (car attr1))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 (semantic-tag-p (car (car attr1))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695 ;; Compare the list of tags...
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696 (semantic-utest-taglists-equivalent-p
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 (car attr2) (car attr1) skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 (t
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700 (equal (car attr1) (car attr2)))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702 (if (not res)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703 (error "TAG INTERNAL DIFF: %S %S"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704 (car attr1) (car attr2)))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706 (setq attr1 (cdr attr1)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707 attr2 (cdr attr2)))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
708 res))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
709
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 (defun semantic-utest-equivalent-tag-p (tag1 tag2 skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 "Determine if TAG1 and TAG2 are the same.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 SKIPNAMES includes lists of possible child nodes that should be missing."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713 (and (equal (semantic-tag-name tag1) (semantic-tag-name tag2))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 (semantic-tag-of-class-p tag1 (semantic-tag-class tag2))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
715 (semantic-utest-match-attributes
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (semantic-tag-attributes tag1) (semantic-tag-attributes tag2)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
717 skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
720 (defun semantic-utest-taglists-equivalent-p (table names skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
721 "Compare TABLE and NAMES, where skipnames allow list1 to be different.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722 SKIPNAMES is a list of names that should be skipped in the NAMES list."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 (let ((SN skipnames))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 (while SN
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
725 (setq names (remove (car SN) names))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
726 (setq SN (cdr SN))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727 (while (and names table)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 (if (not (semantic-utest-equivalent-tag-p (car names)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 (car table)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 skipnames))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 (error "Expected %s, found %s"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 (semantic-format-tag-prototype (car names))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 (semantic-format-tag-prototype (car table))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (setq names (cdr names)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
735 table (cdr table)))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 (when names (error "Items forgotten: %S"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737 (mapcar 'semantic-tag-name names)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739 (when table (error "Items extra: %S"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (mapcar 'semantic-tag-name table)))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
741 t)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 (defun semantic-utest-verify-names (name-contents &optional skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
744 "Verify the names of the test buffer from NAME-CONTENTS.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 Argument SKIPNAMES is a list of names that should be skipped
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
746 when analyzing the file.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
747
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
748 JAVE this thing would need to be recursive to handle java and csharp"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
749 (let ((names name-contents)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
750 (table (semantic-fetch-tags))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
751 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
752 (semantic-utest-taglists-equivalent-p table names skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
753 ))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
754
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755 ;;;;;;;;;;;;;;;;;;;;;;;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756 ; JAVE redefine a new validation function
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
757 ; is not quite as good as the old one yet
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758 (defun semantic-utest-verify-names-jave (name-contents &optional skipnames)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759 "JAVE version of `semantic-utest-verify-names'.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760 NAME-CONTENTS is a sample of the tags buffer to test against.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 SKIPNAMES is a list of names to remove from NAME-CONTENTS"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762 (assert (semantic-utest-verify-names-2 name-contents (semantic-fetch-tags))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763 nil "failed test")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766 (defun semantic-utest-verify-names-2 (l1 l2)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 (cond ( (and (consp l1) (equal (car l1) 'overlay))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768 (overlayp l2))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769 ((not (consp l1))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770 (equal l1 l2))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771 ((consp l1)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772 (and (semantic-utest-verify-names-2 (car l1) (car l2)) (semantic-utest-verify-names-2 (cdr l1) (cdr l2))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 (t (error "internal error"))))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
775
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
776
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
779 ;;; Kill indicator line
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780 ;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781 (defvar semantic-utest-last-kill-text nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
782 "The text from the last kill.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784 (defvar semantic-utest-last-kill-pos nil
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
785 "The position of the last kill.")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787 (defun semantic-utest-kill-indicator ( killme insertme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
788 "Kill the line with KILLME on it and insert INSERTME in its place."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
789 (goto-char (point-min))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
790 ; (re-search-forward (concat "/\\*" indicator "\\*/")); JAVE this isnt generic enough for different lagnuages
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
791 (re-search-forward killme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
792 (beginning-of-line)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
793 (setq semantic-utest-last-kill-pos (point))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
794 (setq semantic-utest-last-kill-text
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
795 (buffer-substring (point) (point-at-eol)))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
796 (delete-region (point) (point-at-eol))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
797 (insert insertme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
798 (sit-for 0)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
799 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
800
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
801 (defun semantic-utest-unkill-indicator ()
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
802 "Unkill the last indicator."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
803 (goto-char semantic-utest-last-kill-pos)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
804 (delete-region (point) (point-at-eol))
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
805 (insert semantic-utest-last-kill-text)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
806 (sit-for 0)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
807 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
808
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
809 ;;; EDITING TESTS
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
810 ;;
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
811
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
812 (defun semantic-utest-last-invalid (name-contents names-removed killme insertme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
813 "Make the last fcn invalid."
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
814 (semantic-utest-kill-indicator killme insertme)
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
815 ; (semantic-utest-verify-names name-contents names-removed); verify its gone ;new validator doesnt handle skipnames yet
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
816 (semantic-utest-unkill-indicator);put back killed stuff
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
817 )
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
818
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
819
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
820
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
821
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
822 ;"#<overlay from \\([0-9]+\\) to \\([0-9]+\\) in \\([^>]*\\)>"
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
823 ;#<overlay from \([0-9]+\) to \([0-9]+\) in \([^>]*\)>
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
824 ;(overlay \1 \2 "\3")
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
825
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
826
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
827 ;; JAVE
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
828 ;; these are some unit tests for cedet that I got from Eric and modified a bit for:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
829 ;; python
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
830 ;; javascript
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
831 ;; java
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
832 ;; I tried to generalize the structure of the tests a bit to make it easier to add languages
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
833
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
834 ;; Mail from Eric:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
835 ;; Many items in the checklist look like:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
836
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
837 ;; M-x global-semantic-highlight-edits-mode RET
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
838 ;; - Edit a file. See the highlight of newly inserted text.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
839 ;; - Customize `semantic-edits-verbose-flag' to be non-nil.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
840 ;; - Wait for the idle scheduler, it should clean up the edits.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
841 ;; - observe messages from incremental parser. Do they relate
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
842 ;; to the edits?
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
843 ;; - M-x bovinate RET - verify your changes are reflected.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
844
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
845 ;; It's all about watching the behavior. Timers go off, things get
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
846 ;; cleaned up, you type in new changes, etc. An example I tried to
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
847 ;; do is below, but covers only 1 language, and not very well at that.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
848 ;; I seem to remember seeing a unit test framework going by one of the
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
849 ;; lists. I'm not sure if that would help.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
850
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
851 ;; Another that might be automatable:
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
852
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
853 ;; M-x semantic-analyze-current-context RET
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
854 ;; - Do this in different contexts in your language
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
855 ;; files. Verify that reasonable results are returned
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
856 ;; such as identification of assignments, function arguments, etc.
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
857
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
858 ;; Anyway, those are some ideas. Any effort you put it will be helpful!
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
859
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
860 ;; Thanks
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
861 ;; Eric
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
862
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
863 ;; -----------
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
864
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
865
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
866
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 104494
diff changeset
867 ;; arch-tag: 082cbe6f-2290-476e-9760-a19a6bdd16b8
104494
e480034314ce Add Semantic unit tests.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
868 ;;; semantic-utest.el ends here