aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2016-11-01 06:58:18 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2016-11-01 07:23:49 +0100
commit9f6cba5c0370aee2f9803abbc35ab7e67f57ee84 (patch)
treeb03485f177d6ff700aac7fc8ff1e7e9e23a61866 /tests
parentb5e6f4c61b7b8e220fb3faa071e30b3dfc559f2f (diff)
downloadsciteco-9f6cba5c0370aee2f9803abbc35ab7e67f57ee84.tar.gz
globbing supports character classes now and ^EN string building construct to escape glob patterns
* globbing is fnmatch(3) compatible, now on every supported platform. * which means that escaping of glob patterns is possible now. ^ENq has been introduced to ease this task. * This finally allows you to pass unmodified filenames to EB. Previously it was impossible to open file names containing glob wildcards. * this was achieved by moving from GPattern to GRegex as the underlying implementation. * The glob pattern is converted to a regular expression before being compiled to a GRegex. This turned out to be trickier than anticipated (~140 lines of code) and has a runtime penalty of course (complexity is O(2*n) over the pattern length). It is IMHO still better than the alternatives, like importing external code from libiberty, which is potentially non-cross-platform. * Using GRegex also opens the potential of supporting brace "expansions" later in the form of glob pattern constructs (they won't actually expand but match alternatives). * is_glob_pattern() has been simplified and moved to Globber::is_pattern(). It makes sense to reuse the Globber class namespace instead of using plain functions for functions working on glob patterns. * The documentation has a new subsection on glob patterns now. * Testsuite extended with glob pattern test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/testsuite.at20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 81a770c..2e613ee 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,12 +1,30 @@
AT_INIT
AT_COLOR_TESTS
+# NOTE: There is currently no way to influence the return
+# code of SciTECO, except to provoke an error.
+# Since errors cannot be yielded explicitly, we use the
+# idiom "(0/0)" to enforce a "Division by zero" error
+# whenever we want to fail.
+
AT_SETUP([Closing loops at the correct macro level])
AT_CHECK([$SCITECO -e '@^Ua{>} <Ma'], 1, ignore, ignore)
AT_CLEANUP
AT_SETUP([Automatic EOL normalization])
-AT_CHECK([$SCITECO -e "@EB'${srcdir}/autoeol-input.txt' EL-2\"N/0' 2LR 13@I'' 0EL @EW'autoeol-sciteco.txt'"],
+AT_CHECK([$SCITECO -e "@EB'${srcdir}/autoeol-input.txt' EL-2\"N(0/0)' 2LR 13@I'' 0EL @EW'autoeol-sciteco.txt'"],
0, ignore, ignore)
AT_CHECK([cmp -b autoeol-sciteco.txt ${srcdir}/autoeol-output.txt], 0, ignore, ignore)
AT_CLEANUP
+
+AT_SETUP([Glob patterns with character classes])
+# Also checks closing brackets as part of the character set.
+# NOTE: The worse-than-average escaping of the square brackets with
+# ^EU< and ^EU> is necessary here since it is the current M4
+# quotation character and must be balanced:
+AT_CHECK([$SCITECO -e "91U< 93U> :@EN/*.^EU<^EU>ch^EU>/foo.h/\"F(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP
+
+AT_SETUP([Glob patterns with unclosed trailing brackets])
+AT_CHECK([$SCITECO -e "91U< :@EN/*.^EU<h/foo.^EU<h/\"F(0/0)'"], 0, ignore, ignore)
+AT_CLEANUP