summaryrefslogtreecommitdiffstats
path: root/tests/008
Commit message (Collapse)AuthorAgeFilesLines
* parser: @(mdo) must not be subject to expand-meta.Kaz Kylheku2021-08-111-0/+7
| | | | | | | | | | | | | | | | | | | | * parser.y (elem): When the elem is a list, if it starts with mdo, then we evaluate it immediately and substitute (do) as the semantic value. We no longer not allow mdo to precipitate into match_expand_elem, where expand_meta will be unleashed on it. Doing so causes the bug that expessions like @1, denoting the form (sys:var 1), are rewritten to (sys:expr 1), which op syntax. So two bugs are fixed: the incorrect treatment of meta-syntax, and the neglect to perform mdo in nested contexts. (check_parse_time_action): We need not handle mdo here any more; it will never make it into this function. Only actions done in the main clause list belong here, not parse time actions done at any nesting level. * tests/008/mdo.txr: New file. * y.tab.c.shipped: Updated.
* tests: implicitly generate empty .expected files.Kaz Kylheku2021-04-122-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Makefile (%.expected): New implicit rule. Whenever a test requires a .expected file, if it is missing, we create an empty one. This file will be treated as an intermediate by GNU Make, which means that it will be deleted when make terminates. * tests/012/compile.tl: Some of the .tl files no longer have an .expected file, so we have to test for that in the catenating logic. * tests/008/call-2.expected, * tests/008/no-stdin-hang.expected, * tests/011/macros-3.expected, * tests/011/patmatch.expected, * tests/012/aseq.expected, * tests/012/ashwin.expected, * tests/012/compile.tl, * tests/012/cont.expected, * tests/012/defset.expected, * tests/012/ifa.expected, * tests/012/oop-seq.expected, * tests/012/parse.expected, * tests/012/quasi.expected, * tests/012/quine.expected, * tests/012/seq.expected, * tests/012/struct.expected, * tests/012/stslot.expected, * tests/014/dgram-stream.expected, * tests/014/in6addr-str.expected, * tests/014/inaddr-str.expected, * tests/014/socket-basic.expected, * tests/015/awk-fconv.expected, * tests/015/split.expected, * tests/015/trim.expected, * tests/016/arith.expected, * tests/016/ud-arith.expected, * tests/017/ffi-misc.expected, * tests/018/chmod.expected: Empty file deleted.
* txr: bugfix: give @(call) same semantics as direct call.Kaz Kylheku2021-02-222-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The @(call) directive is buggy in the following ways, which cause an indirect call to behave differently from a direct call. It creates a new context, and so if the opening of a data source is deferred into the indirectly called function, that data source is lost when the indirect call terminates. Furthermore, if a data source is already established, there is no progress through the data: two consecutive @(call ...) directives operate on the same data. It also fails to implement vertical to horizontal fallback; if a function is not vertically defined, the directive fails. * match.c (v_call): Rewrite the core logic in the following way: we rewrite the indirect @(call) syntax into direct call syntax, substitute that into c->spec, and then just call v_fun. * tests/008/call-2.expected: New file. * tests/008/call-2.txr: New file. Test fails before this commit because both calls are matching against the same "A" element of the list.
* txr: pattern function calls are non-matching.Kaz Kylheku2021-02-212-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* @(call): bugfix: matching doesn't continue.Kaz Kylheku2021-02-172-0/+15
| | | | | | | | | | | * match.c (v_call): This function must propagate the next_spec_k return value, rather than return a short-circuiting match object, which causes the parent to immediately succeed. * tests/008/call.txr: New test case, from Frank Schwidom. * tests/008/call.expected: Likewise.
* Strengthen :filter test.Kaz Kylheku2017-01-222-2/+2
| | | | | | | | | * tests/008/filtenv.txr (f): Don't just copy the input to the output but transform it by upcase-str. Otherwise the test will pass even if the :filter syntax is not processed at all! * tests/08/filtenv.expected: Updated.
* Fixing long-time (pre-GIT) bug. The object (nil) was stupidly used toKaz Kylheku2012-02-262-0/+24
| | | | | | | | | | | | | | | | | | | | | represent empty optional output clauses, distinguishing them from missing clauses. This creates an ambiguity, so that an @(output) block which puts out a single empty line is treated as empty. Present but empty clauses are now represented by t. * match.c (do_output_line): Check for t and bail. (do_output): Check for t instead of (nil) and bail. * parser.y (o_elems_opt2): Nonterminal deleted. (out_clauses_opt): Empty case generates nil. (req_parts_opt): o_elems_opt2 replaced by o_elems_opt. (repeat_rep_helper): Function now keeps track of which clauses were specified. For those that were specified, but empty, it substitutes t. * tests/008/empty-clauses.expected: New file. * tests/008/empty-clauses.txr: New file.
* * tests/008/filtenv.expected: New file.Kaz Kylheku2012-02-252-0/+7
| | | | * tests/008/filtenv.txr: New file.
* * lib.c (getplist_f): New function.Kaz Kylheku2011-11-241-1/+1
| | | | | | | | | | | | | * lib.h (getplist_f): Declared. * match.c (v_collect, h_coll): Use getplist_f to distinguish the case that :vars is explicitly specified as (). In this case, no bindings escape from the collect. * tests/008/soundex.txr: This test case broke due to using :vars () and yet counting on the variable to exist. * RELNOTES: Updated.
* * Makefile (tests/008/soundex.ok): New test case.Kaz Kylheku2011-11-192-0/+85
| | | | | | | | (TXR_ARGS): Specified for new test case. * tests/008/soundex.expected: New file. * tests/008/soundex.txr: New file.
* * tests/008/students.txr: Use disciplined collect with :vars.Kaz Kylheku2011-11-031-4/+1
|
* * tests/008/students.txr: Regexes removed.Kaz Kylheku2011-11-031-2/+2
|
* Added missing data.Kaz Kylheku2011-10-011-0/+6
|
* New test case, covering some filtering from HTML/XML.Kaz Kylheku2011-10-013-0/+31
| | | | | | | | * Makefile: Defined TXR_ARGS for new test case. * tests/008/students.expected: New file. * tests/008/students.txr: New file. * tests/008/students.xml: New file.
* New test case under tests/008.Kaz Kylheku2011-10-013-0/+56
| | | | | | | | | | | | * Makefile: Made previous TXR_ARGS for 008 specific to tokenizing test case, and introduced separate TXR_ARGS for this test case. * tests/008/configfile: New file. * tests/008/configfile.expected: New file. * tests/008/configfile.txr: New file.
* Tokenizing test case, exercising for @(coll :gap 0)Kaz Kylheku2011-10-013-0/+28
and horizontal @(choose :shortest ...). * Makefile: Defined TXR_ARGS for tests/008 directory. * tests/008/data: New file. * tests/008/tokenize.expected: New file. * tests/008/tokenize.txr: New file.