summaryrefslogtreecommitdiffstats
path: root/tests/008
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-02-21 22:32:18 -0800
committerKaz Kylheku <kaz@kylheku.com>2021-02-21 22:32:18 -0800
commit54c3c4929abf062717f36712cd20dc4873c8d04c (patch)
tree651da4d587c3039492024c707f85b7c2f1442598 /tests/008
parent7349b5de069f831d23119f6fc0124a0b8daa4401 (diff)
downloadtxr-54c3c4929abf062717f36712cd20dc4873c8d04c.tar.gz
txr-54c3c4929abf062717f36712cd20dc4873c8d04c.tar.bz2
txr-54c3c4929abf062717f36712cd20dc4873c8d04c.zip
txr: pattern function calls are non-matching.
This patch causes TXR to treat calls to verticatl functions, as well as the @(call) directive to be considered non-matching directives, so that opening the data source is deferred. This allows included .txr files to call the funtions that they define, without the side effect of standard input being read. * match.c (open_data_source): Function refactored to reduce duplication. c->data is checked first, and if it is not t, nothing is done, making the function cheaper in the frequent case. The non_matching_dir condition changes. We now check that the first element of the first spec is a non-nil symbol. If it has a function binding as a vertical function, then that is considered non_matching. (dir_tables_init): Treat @(call) as a non-matching directive. * Makefile (tst/tests/008/no-stdin-hang.ok): Add -n argument for non-interactive, which will cause stdin to be read in that test case if there is a regression in this change. If make tests is run in a terminal, this will hang make tests. * tests/no-stdin-hang.txr: New file. * tests/no-stdin-hang.expected: New file.
Diffstat (limited to 'tests/008')
-rw-r--r--tests/008/no-stdin-hang.expected0
-rw-r--r--tests/008/no-stdin-hang.txr5
2 files changed, 5 insertions, 0 deletions
diff --git a/tests/008/no-stdin-hang.expected b/tests/008/no-stdin-hang.expected
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/008/no-stdin-hang.expected
diff --git a/tests/008/no-stdin-hang.txr b/tests/008/no-stdin-hang.txr
new file mode 100644
index 00000000..4b29f021
--- /dev/null
+++ b/tests/008/no-stdin-hang.txr
@@ -0,0 +1,5 @@
+@(define foo (var))
+@(next :list '("a"))
+@var
+@(end)
+@(foo x)