summaryrefslogtreecommitdiffstats
path: root/tests/006
Commit message (Collapse)AuthorAgeFilesLines
* lazy-str-get-trailing-list: spurious empty string issue.Kaz Kylheku2022-01-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | * lib.c (lazy_str_get_trailing_list): Remove the spurious empty string caused by splitting on the terminator. Whenever the materialized prefix is not-empty, and there is a non-empty terminator, the prefix necessarily ends in the termintator. If we split on the terminator, the list of pieces ends in in an empty string, which is undesirable. This has to be subject to compat, unfortunately; it's a very visible behavior that affects the continuation of line-based matching after the @(freeform) directive. * tests/006/freeform-5.txr: With this fix, we no longer have to match the spurious blank line coming from @(freeform). * tests/015/lazy-str.tl: New file. * txr.1: Updated documentation with compat notes. There was some outright incorrect text describing lazy-str-get-trailing-list. Also, the lazy-str-force-upto and lazy-str-force were under-documented. The return value of the former was not completely described: that it returns t in the other case when not returning nil. It wasn't mentioned that the functions observe the limit-count. Moreover, the exact algorithm for forcing is now documented.
* freeform: bug: account for consumed prefix.Kaz Kylheku2022-01-042-0/+12
| | | | | | | | | | | | | | | | | | | | This was reported by user vapnik spaknik. The @(freeform), when reconstituting the unmatched trailing portion of the virtual line back into a list of lines, uses the abstract match position, neglecting to account for the fact that a prefix of the line may have been physically consumed to save memory. * match.c (v_freeform): When calling lazy_str_get_trailing_list, indicate the correct amount of prefix material, by subtracting, from the matching length, the base variable, which indicates how much of the prefix had been consumed. This consumption takes place above 4000 bytes, which is why the freeform test cases are not catching this. * tests/006/freeform-5.txr: New file. * tests/006/freeform-5.expected: New file.
* lazy-sub-str: bugfix: invalid substructure sharing.Kaz Kylheku2021-01-252-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | This addresses a bug manifesting itself as a regression in the behavior of @(freeform), which was reported by Frank Schwidom. The sub_str operation calls lazy_subs_str for a lazy string. But lazy_sub_str again relies on sub_str for extracting part of the lazy string prefix. But sub_str can potentially return the whole object rather than a copy of a substring of it. In this case, lazy_sub_str produces a new lazy string object which shares the prefix string object with the original lazy string. This is incorrect because the lazy string data type destructively manipulates the prefix. It means that operations one one lazy string are mucking with the prefix of another lazy string. * lib.c (lazy_sub_str): When creating the new lazy string object, make a copy of the prefix string pulled from the original. We do the carefully: the copy of the prefix is made before the make_obj call which allocates the new lazy string, otherwise we create a wrong-way assignment from the perspective of generational GC. * tests/006/freeform-4.txr: New test case, from Frank. * tests/006/freeform-4.expected: Expected output of test case.
* Add test case for recent breakage.Kaz Kylheku2014-10-083-0/+324
| | | | | | | | | | * tests/006/freeform-3.expected: New file. * tests/006/freeform-3.txr: New file. * tests/006/passwd: New file. * Makefile (TXR_ARGS): Set up for new test case.
* More testcases.Kaz Kylheku2010-02-282-0/+10
|
* New testcase for freeform.Kaz Kylheku2010-02-283-0/+31