Skip to content
Permalink
Browse files

Add initial ert test file for rtags.el

- Add initial test to verify correct protocol version
  • Loading branch information...
cslux committed Apr 16, 2019
1 parent ffce139 commit fab7bdd185242e39d8f4cc5176aba06c75488963
Showing with 53 additions and 5 deletions.
  1. +7 −0 CMakeLists.txt
  2. +6 −4 scripts/travis.sh
  3. +1 −1 src/CMakeLists.txt
  4. +39 −0 tests/lisp/rtags-test.el
@@ -106,6 +106,13 @@ else ()
else()
message(WARNING "Nosetests executable not found! Excluding automated_tests from tests.")
endif ()

if (EMACS_EXECUTABLE AND NOT RTAGS_NO_ELISP_FILES)
add_test(NAME elisptests COMMAND ${EMACS_EXECUTABLE} -batch -L ${CMAKE_BINARY_DIR}/src -l ${CMAKE_SOURCE_DIR}/tests/lisp/rtags-test.el -f ert-run-tests-batch-and-exit)
set_property(TEST elisptests PROPERTY ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_BINARY_DIR}/bin")
else()
message(WARNING "No suitable Emacs version found! Skipping elisp tests.")
endif ()
endif ()

feature_summary(INCLUDE_QUIET_PACKAGES WHAT ALL)
@@ -38,13 +38,14 @@ function build_and_test()
emacs --version
cmake "$1" "${CMAKE_PARAMS[@]}" .. || cat CMakeFiles/CMakeError.log
make VERBOSE=1 -j2
PATH=$(pwd)/bin:$PATH ctest --output-on-failure --verbose $@
shift
PATH=$(pwd)/bin:$PATH ctest --output-on-failure --verbose "$@"
popd >/dev/null
}

function add_cmake_params()
{
for param in $@; do
for param in "$@"; do
CMAKE_PARAMS[${#CMAKE_PARAMS[@]}]="$param"
done
}
@@ -69,8 +70,9 @@ function osx()
# Help cmake to find openssl includes/library
add_cmake_params "-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"

build_and_test -DCMAKE_BUILD_TYPE=Release
build_and_test -DCMAKE_BUILD_TYPE=Debug
# Note sure why the "elisptests" target is generated even though Emacs is to old (Works locally) :/
build_and_test -DCMAKE_BUILD_TYPE=Release -E elisp
build_and_test -DCMAKE_BUILD_TYPE=Debug -E elisp
}

function gnu_linux()
@@ -262,8 +262,8 @@ if (EMACS_EXECUTABLE)
set(RTAGS_NO_ELISP_FILES TRUE)
endif ()
else ()
set(RTAGS_NO_ELISP_FILES TRUE)
message(STATUS "Emacs was not found, elisp files are not going to be installed!")
set(RTAGS_NO_ELISP_FILES TRUE)
endif ()

set(RTAGS_ELISP_FILES
@@ -0,0 +1,39 @@
;; rtags-test.el --- Tests for rtags.el -*- lexical-binding: t ; -*-

;; Copyright (c) 2019 Christian Schwarzgruber

;; Author: Christian Schwarzgruber <c.schwarzgruber.cs@gmail.com>

;; This file is not part of GNU Emacs.

;; 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, 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; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.

;;; Commentary:


;;; Code:

(require 'rtags)
(require 'ert)

(ert-deftest rtags-protocol-version-test ()
"Test if the protocol version matches."
(rtags-start-process-unless-running)
(sit-for .5) ;; Uuh, that's nasty :)
(rtags-call-rc "-w"))


;;; rtags-test.el ends here

0 comments on commit fab7bdd

Please sign in to comment.
You can’t perform that action at this time.