From 06d38b335b10d6def68f3f3a340306393fec67fd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 29 Apr 2021 22:37:36 -0700 Subject: mapcar*: fix broken. * eval.c (lazy_mapcar_func): We must capture the return value of iter_step, since we refer to it in the next statement, expecting it to have stepped. This bug causes a behavior as if the original list had an extra nil. * tests/012/lazy.tl: Tests. Poor test coverage is why this sort of thing comes up and bites us. --- tests/012/lazy.tl | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 tests/012/lazy.tl (limited to 'tests/012/lazy.tl') diff --git a/tests/012/lazy.tl b/tests/012/lazy.tl new file mode 100644 index 00000000..be04412a --- /dev/null +++ b/tests/012/lazy.tl @@ -0,0 +1,6 @@ +(load "../common") + +(test [mapcar* list nil] nil) +(test [mapcar* list '(1)] ((1))) +(test [mapcar* list '(1 2 3)] ((1) (2) (3))) +(test [mapcar* list '(1 2 3) '(a b c)] ((1 a) (2 b) (3 c))) -- cgit v1.2.3