aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore22
-rw-r--r--Makefile.am2
-rw-r--r--TODO3
-rw-r--r--configure.ac2
-rw-r--r--tests/Makefile.am37
-rw-r--r--tests/atlocal.in9
-rw-r--r--tests/testsuite.at5
7 files changed, 71 insertions, 9 deletions
diff --git a/.gitignore b/.gitignore
index 52d0795..185dd0b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,17 +18,29 @@
Makefile
Makefile.in
stamp-*
+
+# Autotest
+/tests/package.m4
+atconfig
+atlocal
+testsuite
+testsuite.log
+testsuite.dir
+
+# Binaries
/src/sciteco
/src/sciteco-minimal
-# Generated code
+# Generated source files
+/src/interface-gtk/gtk-info-popup.[ch]
+/src/interface-gtk/gtk-canonicalized-label.[ch]
+/src/symbols-scintilla.cpp
+/src/symbols-scilexer.cpp
+
+# Generated documentation
/doc/sciteco.[17]
/doc/sciteco.[17].html
/doc/sciteco.7.in
/doc/sciteco.7.htbl
/doc/Doxyfile
/doc/doxygen
-
-/src/gtk-info-popup*.[ch]
-/src/symbols-scintilla.cpp
-/src/symbols-scilexer.cpp
diff --git a/Makefile.am b/Makefile.am
index 67a9d0f..0c99647 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = src lib doc
+SUBDIRS = lib src doc tests
dist_pkgdata_DATA = sample.teco_ini
diff --git a/TODO b/TODO
index fe271fb..5374869 100644
--- a/TODO
+++ b/TODO
@@ -180,9 +180,6 @@ Features:
Unfortunately, not every UNIX has X11 (e.g. linux console,
OS X). What do we do on those systems?
This will also allow us to reverse clipboard modifications.
- * Add a test suite. Most bugs can be tested for regressions
- using a simple test suite that calls sciteco.
- Use Autotest for instance.
Optimizations:
* Add G_UNLIKELY to all error throws.
diff --git a/configure.ac b/configure.ac
index 56e61c9..4d17cf9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,6 +13,7 @@ AC_DEFINE_UNQUOTED(PACKAGE_URL_DEV, ["$PACKAGE_URL_DEV"],
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE
+AC_CONFIG_TESTDIR([tests])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([config.h])
@@ -342,4 +343,5 @@ AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([src/Makefile src/interface-gtk/Makefile src/interface-curses/Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([doc/Makefile doc/Doxyfile])
+AC_CONFIG_FILES([tests/Makefile tests/atlocal])
AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..2fe3a53
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,37 @@
+# The `:;' works around a Bash 3.2 bug when the output is not writable.
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ :;{ \
+ echo '# Signature of the current package.' && \
+ echo 'm4_define([AT_PACKAGE_NAME],' && \
+ echo ' [$(PACKAGE_NAME)])' && \
+ echo 'm4_define([AT_PACKAGE_TARNAME],' && \
+ echo ' [$(PACKAGE_TARNAME)])' && \
+ echo 'm4_define([AT_PACKAGE_VERSION],' && \
+ echo ' [$(PACKAGE_VERSION)])' && \
+ echo 'm4_define([AT_PACKAGE_STRING],' && \
+ echo ' [$(PACKAGE_STRING)])' && \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
+ echo ' [$(PACKAGE_BUGREPORT)])'; \
+ echo 'm4_define([AT_PACKAGE_URL],' && \
+ echo ' [$(PACKAGE_URL)])'; \
+ } >'$(srcdir)/package.m4'
+
+EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) atlocal.in
+TESTSUITE = $(srcdir)/testsuite
+
+check-local: atconfig atlocal $(TESTSUITE)
+ $(SHELL) '$(TESTSUITE)' $(TESTSUITEFLAGS)
+
+installcheck-local: atconfig atlocal $(TESTSUITE)
+ $(SHELL) '$(TESTSUITE)' AUTOTEST_PATH='$(bindir)' \
+ $(TESTSUITEFLAGS)
+
+clean-local:
+ test ! -f '$(TESTSUITE)' || \
+ $(SHELL) '$(TESTSUITE)' --clean
+
+AUTOM4TE = $(SHELL) $(top_srcdir)/config/missing --run autom4te
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): $(srcdir)/testsuite.at $(srcdir)/package.m4
+ $(AUTOTEST) -I '$(srcdir)' -o $@.tmp $@.at
+ mv $@.tmp $@
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..a4f30cc
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,9 @@
+# `tests` is after `src`, so the target SciTECO is already
+# built.
+# Using the $BOOTSTRAP_SCITECO wouldn't make sense
+# anyway as we don't want to test some preinstalled SciTECO.
+SCITECO=@abs_top_builddir@/src/sciteco
+
+# Make sure that the standard library from the source package
+# is used.
+SCITECOPATH=@abs_top_srcdir@/lib
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..b43f874
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,5 @@
+AT_INIT
+
+AT_SETUP([Closing loops at the correct macro level])
+AT_CHECK([$SCITECO -e '@^Ua{>} <Ma'], 1, ignore, ignore)
+AT_CLEANUP