summaryrefslogtreecommitdiffstats
path: root/tests/010/csv.tl
Commit message (Collapse)AuthorAgeFilesLines
* get-csv: bugfix: return nil on EOF.Kaz Kylheku2025-01-241-1/+23
| | | | | | | | | | | | | | | | | * stream.c (get_csv): Let's add a new state init. If get_char returns nil and we are in the init state, let's bail to a nil return. While we are at it, let's not allocate the record or string until we read at least one character. If we read a character in the init state, let's allocate those two objects, and then change to the rfield state and fall through to it to handle the character. * tests/010/csv.tl: Fix one incorrect test: (tocsv "") now returns nil, as it should. Add tests for multiple record extraction, also covering missing line termination on the last record as well as CR-LF termination. * txr.1: Documented nil return conditions.
* New functions for producing CSV.Kaz Kylheku2025-01-241-0/+19
| | | | | | | | | | | | * stream.c (put_csv, tocsv): New functions. (stream_init): put-csv and tocsv intrinsics registered. * stream.h (put_csv, tocsv): Declared. * tests/010/csv.tl (mtest-pcsv): New macro. New test cases. * txr.1: Documented.
* New function: get-csv.Kaz Kylheku2025-01-211-0/+166
* autloload.c (csv_set_entries, csv_instantiate): New static funtions. (autoload_init): Register autoload of stdlib/csv module via new functions. * stdlib/csv.tl: New file. * tests/010/csv.tl: Likewise. * txr.1: Documented.