[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests 8989dc6 313/316: New Tests for e
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests 8989dc6 313/316: New Tests for ede-java-root-project type. |
Date: |
Sat, 28 Jan 2017 09:10:14 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit 8989dc6d0c0e44fe94071c85252a5f26b2cc6931
Author: Eric Ludlam <address@hidden>
Commit: Edward John Steere <address@hidden>
New Tests for ede-java-root-project type.
---
test/manual/cedet/cit-javaroot.el | 153 +++++++++++++++++++++++++++++++++++++
1 file changed, 153 insertions(+)
diff --git a/test/manual/cedet/cit-javaroot.el
b/test/manual/cedet/cit-javaroot.el
new file mode 100644
index 0000000..4f9ea5f
--- /dev/null
+++ b/test/manual/cedet/cit-javaroot.el
@@ -0,0 +1,153 @@
+;;; cit-javaroot.el --- Integration tests for java root
+;;
+;; Copyright (C) 2013 Eric M. Ludlam
+;;
+;; Author: Eric M. Ludlam <address@hidden>
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see http://www.gnu.org/licenses/.
+
+;;; Commentary:
+;;
+;; Integration test for the ede/java-root project type.
+
+(require 'semantic/db-javap)
+
+;;; Code:
+(defvar cit-integ-target-javaroot
+ (expand-file-name "edeproj_ede_javaroot" cedet-integ-base)
+ "Root of the EDE project integration tests for the ede/java-root project.")
+
+(defvar cit-integ-javaroot-subdir "integ_src/javaroot/"
+ "Directory of files to copy into the tmp project dir.")
+
+(defvar cit-integ-javaroot-sys-subdir "integ_src/fauxsyslib/"
+ "Directory of files to copy into the tmp project dir.")
+
+(defvar cit-integ-javaroot-srcdir
+ (expand-file-name
+ cit-integ-javaroot-subdir
+ (file-name-directory (locate-library "cit-javaroot")))
+ "The source directory for the JAVA root sources.")
+
+(defvar cit-integ-javaroot-sys-subdir "integ_src/fauxsyslib/"
+ "Directory of files to copy into the tmp project dir.")
+
+(defvar cit-integ-javaroot-sys-srcdir
+ (expand-file-name
+ cit-integ-javaroot-sys-subdir
+ (file-name-directory (locate-library "cit-javaroot")))
+ "The source directory dor the JAVA root sources.")
+
+(defvar cit-src-javaroot-main-tags
+ (list
+ (semantic-tag-new-include "TestLib" nil)
+ (semantic-tag-new-include "test.TestTest" nil)
+ (semantic-tag-new-include "testproj.TestInJar" nil)
+ (semantic-tag-new-include "syslib.TestSysJar" nil)
+ (semantic-tag-new-include "java.io.InputStream" nil)
+
+ (semantic-tag-new-type
+ "TestMain" "class"
+ (list
+ (semantic-tag-new-function
+ "main" "void"
+ (list (semantic-tag-new-variable "args" "String" nil
+ :dereference 1))
+ :typemodifiers '("public" "static"))
+ )
+ nil ;; parents
+ :typemodifiers '("public"))
+ )
+ "List of tags we need to be able to to find in main.java")
+
+(defvar cit-javaroot-depfiles
+ (list
+ (list 'semanticdb-table (expand-file-name "TestLib.java"
cit-integ-target-javaroot))
+ (list 'semanticdb-table (expand-file-name "test/TestTest.java"
cit-integ-target-javaroot))
+ (list 'semanticdb-table-jar-file "testproj/TestInJar.class")
+ (list 'semanticdb-table-jar-file "syslib/TestSysJar.class")
+ (list 'semanticdb-table-jar-file "java/io/InputStream.class")
+ ;;(expand-file-name "TestLib.h" cit-integ-javaroot-sys-srcdir)
+ )
+ "List of expected path names to include files found in TestMain.java")
+
+(defun cit-ede-javaroot-test ()
+ "Test the ede-java-root project type."
+ ;; Create directory for the project
+ (cit-make-dir cit-integ-target-javaroot)
+
+ ;; Copy source files into the javaroot directory
+ (condition-case nil
+ ;; Emacs 24.2
+ (copy-directory (file-name-as-directory cit-integ-javaroot-srcdir)
cit-integ-target-javaroot t t t)
+
+ ;; Emacs 23
+ (error
+ (copy-directory (file-name-as-directory cit-integ-javaroot-srcdir)
cit-integ-target-javaroot t t)))
+
+ ;; Create the ede-java-root-project class directly.
+ (ede-java-root-project
+ "TESTJAVAROOT"
+ :file (expand-file-name "TestMain.java" cit-integ-target-javaroot)
+ :localclasspath '( "/projjar/TestProj.jar" )
+ :classpath (list (expand-file-name "TestSys.jar"
cit-integ-javaroot-sys-srcdir))
+ )
+
+ ;; Load up main
+ (find-file (cit-file-javaroot "TestMain.java"))
+
+ ;; Did the parse work at all???
+ (when (not (semantic-fetch-tags))
+ (semantic-c-describe-environment)
+ (error "TestMain.java failed to parse."))
+
+ ;; Validate found tags based on project provided macros.
+ (cit-srecode-verify-tags (semantic-fetch-tags) cit-src-javaroot-main-tags)
+
+ ;; Test out the include paths by checking the discovered file names for the
includes.
+ (let ((itag (semantic-find-tags-included (current-buffer)))
+ (expected cit-javaroot-depfiles))
+ (while (and itag expected)
+
+ (let* ((db (semanticdb-find-table-for-include (car itag)))
+ (fn (if db (if (slot-exists-p db 'filename)
+ (oref db :filename)
+ (semanticdb-full-filename db))
+ "<no db>")))
+
+ (when (or (not (object-of-class-p db (nth 0 (car expected))))
+ (not (string= fn (nth 1 (car expected)))))
+
+ (error "Tag: %s found in db %s fname %s, expected db %s fname %s"
+ (semantic-format-tag-name (car itag))
+ (if db (object-class db) "<no DB>")
+ fn
+ (nth 0 (car expected))
+ (nth 1 (car expected)))
+ ))
+
+ (setq itag (cdr itag)
+ expected (cdr expected)))
+ (when (or itag expected)
+ (error "Number of found include tags does not match number of expected
tags.")))
+ )
+
+(defun cit-file-javaroot (filename)
+ "Return a testing filename.
+Append FILENAME to the target directory."
+ (expand-file-name filename cit-integ-target-javaroot))
+
+(provide 'cit-javaroot)
+
+;;; cit-javaroot.el ends here
- [Emacs-diffs] scratch/merge-cedet-tests 83bcf53 274/316: (cit-srecode-fill-el): Insert classes before methods., (continued)
- [Emacs-diffs] scratch/merge-cedet-tests 83bcf53 274/316: (cit-srecode-fill-el): Insert classes before methods., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 1373a94 285/316: (cit-gnu-externaldb-test-one): Improve test for bad search result., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 816e083 151/316: (ede-detect-utest-project-list): Add test for generic VC type project. (ede-detect-utest): Add fake autoloader for VC. (ede-detect-utest-generic-vc-p): New., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests e9c9716 279/316: Fixes for external db tests, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests e0d3d7b 303/316: New tests., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests ec14f1c 315/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests c2f09c4 182/316: (cedet-integ-test-proj): Add cit-remove-and-do-shared-lib., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 63dbe0c 276/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 9480090 261/316: Test updating the project version, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests e78d9b8 201/316: Fix merge error in unit tests., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 8989dc6 313/316: New Tests for ede-java-root-project type.,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests c89acc2 305/316: Add test code for use with sources in globalref, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 9b72617 282/316: Don't set :filename if it's already set, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 2448a55 268/316: Fix unit testing for several tests and do better error checking., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 6adc6be 266/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 3cb2319 243/316: Added code for test tags, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 101da66 306/316: Don't scan other files because Util.cc is already in a buffer, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 3cc63e2 316/316: Remove tests and redundant resources not destined for merge, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests d8c1209 234/316: CPP integration support. Core bits copied originally from cedet-integ-test.el, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 82586cd 209/316: eieio: Move to obsolete and use the one that ships with Emacs, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests e54714f 227/316: Add header comments and provide., Edward John Steere, 2017/01/28