diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2024-12-15 22:37:17 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2024-12-15 22:37:17 -0800 |
commit | a3532279d5d16f1f69bff1bae06f477cdbc53b0f (patch) | |
tree | b24324d40af254e2178024e309bf5edba6dbe621 /lib.c | |
parent | a2f6a5744045f75f5c5b991cea7fe0df64e2cba4 (diff) | |
download | txr-a3532279d5d16f1f69bff1bae06f477cdbc53b0f.tar.gz txr-a3532279d5d16f1f69bff1bae06f477cdbc53b0f.tar.bz2 txr-a3532279d5d16f1f69bff1bae06f477cdbc53b0f.zip |
string ranges: bug: ranges of length 1.
* lib.c (seq_iter_init_with_info): String ranges are
inclusive. We must not assume at a range whose endpoints are
the same is empty; we must check that case for the endpoints
being strings.
* tests/012/seq.tl: New tests.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -1060,7 +1060,17 @@ void seq_iter_init_with_info(val self, seq_iter_t *it, seq_info_t si) /* fallthrough */ default: unsup_obj(self, it->inf.obj); - } else { + } else switch (type(rf)) { + case LIT: + case STR: + case LSTR: + it->ui.vn = copy_str(rf); + it->ul.vbound = rt; + it->ops = &si_range_str_ops; + if (eql(length_str(rf), length_str(rt))) + break; + unsup_obj(self, it->inf.obj); + default: seq_iter_init_with_info(self, it, seq_info(nil)); break; } |