From c07459fd10a9352b32d4de6e9145a419772bd70b Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 10 Feb 2021 04:14:48 +0100 Subject: [PATCH] Move semantic/format.el tests to follow our conventions * test/lisp/cedet/semantic-utest-fmt.el: Move from here... * test/lisp/cedet/semantic/format-tests.el: ...to here. (ert, ert-x): Require. (semantic-fmt-utest-file-list): Use ert-resource-file. * test/manual/cedet/tests/test-fmt.cpp: * test/manual/cedet/tests/test-fmt.el: Move from here... * test/lisp/cedet/semantic/format-resources/test-fmt.cpp: * test/lisp/cedet/semantic/format-resources/test-fmt.el: ...to here. --- .../semantic/format-resources}/test-fmt.cpp | 0 .../semantic/format-resources}/test-fmt.el | 2 +- .../format-tests.el} | 38 ++++++------------- 3 files changed, 12 insertions(+), 28 deletions(-) rename test/{manual/cedet/tests => lisp/cedet/semantic/format-resources}/test-fmt.cpp (100%) rename test/{manual/cedet/tests => lisp/cedet/semantic/format-resources}/test-fmt.el (95%) rename test/lisp/cedet/{semantic-utest-fmt.el => semantic/format-tests.el} (79%) diff --git a/test/manual/cedet/tests/test-fmt.cpp b/test/lisp/cedet/semantic/format-resources/test-fmt.cpp similarity index 100% rename from test/manual/cedet/tests/test-fmt.cpp rename to test/lisp/cedet/semantic/format-resources/test-fmt.cpp diff --git a/test/manual/cedet/tests/test-fmt.el b/test/lisp/cedet/semantic/format-resources/test-fmt.el similarity index 95% rename from test/manual/cedet/tests/test-fmt.el rename to test/lisp/cedet/semantic/format-resources/test-fmt.el index 122571323b2..941aaae8595 100644 --- a/test/manual/cedet/tests/test-fmt.el +++ b/test/lisp/cedet/semantic/format-resources/test-fmt.el @@ -1,4 +1,4 @@ -;;; test-fmt.el --- test semantic tag formatting +;;; test-fmt.el --- test semantic tag formatting -*- lexical-binding: t -*- ;;; Copyright (C) 2012, 2019-2021 Free Software Foundation, Inc. diff --git a/test/lisp/cedet/semantic-utest-fmt.el b/test/lisp/cedet/semantic/format-tests.el similarity index 79% rename from test/lisp/cedet/semantic-utest-fmt.el rename to test/lisp/cedet/semantic/format-tests.el index d6e5ce7a0fd..a9eb4489d59 100644 --- a/test/lisp/cedet/semantic-utest-fmt.el +++ b/test/lisp/cedet/semantic/format-tests.el @@ -1,4 +1,4 @@ -;;; cedet/semantic-utest-fmt.el --- Parsing / Formatting tests -*- lexical-binding:t -*- +;;; semantic/format-tests.el --- Parsing / Formatting tests -*- lexical-binding:t -*- ;;; Copyright (C) 2003-2004, 2007-2021 Free Software Foundation, Inc. @@ -28,19 +28,14 @@ ;; make sure that the semantic-tag-format-* functions in question ;; created the desired output. -(require 'semantic) -(require 'semantic/format) - ;;; Code: -(defvar cedet-utest-directory - (let* ((C (file-name-directory (locate-library "cedet"))) - (D (expand-file-name "../../test/manual/cedet/" C))) - D) - "Location of test files for this test suite.") +(require 'ert) +(require 'ert-x) +(require 'semantic/format) (defvar semantic-fmt-utest-file-list - '("tests/test-fmt.cpp" + (list (ert-resource-file "test-fmt.cpp") ;; "tests/test-fmt.el" - add this when elisp is support by dflt in Emacs ) "List of files to run unit tests in.") @@ -53,21 +48,10 @@ Files to visit are in `semantic-fmt-utest-file-list'." (save-current-buffer (semantic-mode 1) - (let ((fl semantic-fmt-utest-file-list) - (fname nil) - ) - - (dolist (FILE fl) - - (save-current-buffer - (setq fname (expand-file-name FILE cedet-utest-directory)) - - ;; Make sure we have the files we think we have. - (should (file-exists-p fname)) - ;; (error "Cannot find unit test file: %s" fname)) - - ;; Run the tests. - (let ((fb (find-buffer-visiting fname)) + (let ((fl semantic-fmt-utest-file-list)) + (dolist (fname fl) + (save-current-buffer + (let ((fb (find-buffer-visiting fname)) (b (semantic-find-file-noselect fname)) (tags nil)) @@ -122,6 +106,6 @@ Files to visit are in `semantic-fmt-utest-file-list'." ))) -(provide 'cedet/semantic/fmt-utest) +(provide 'format-tests) -;;; semantic-fmt-utest.el ends here +;;; format-tests.el ends here -- 2.39.2