From 7fa573334f7e92baa6adaae83bd1757f3ea61202 Mon Sep 17 00:00:00 2001 From: Humza Shahid Date: Sat, 7 Feb 2026 00:33:29 +0000 Subject: [PATCH] add failing test for PersistentVector.extendExistingMatch. (Need to fix.) --- test/persistent-vector-tests.sml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/persistent-vector-tests.sml b/test/persistent-vector-tests.sml index 3c61f1c..0dfeab2 100644 --- a/test/persistent-vector-tests.sml +++ b/test/persistent-vector-tests.sml @@ -592,6 +592,31 @@ struct in Expect.isTrue (outputList = expectedOutput) end) + , test + "removes all subsequent elements when new 'finish' is greater \ + \than any finish in the vector" + (fn _ => + let + (* arrange *) + val inputList = List.tabulate (500, fn i => + {start = i, finish = i}) + val pv = PersistentVector.fromList inputList + + (* act *) + val pv = PersistentVector.extendExistingMatch (5, 999, pv) + + (* assert *) + val outputList = PersistentVector.toList pv + val expectedOutput = + [ {start = 1, finish = 1} + , {start = 2, finish = 2} + , {start = 3, finish = 3} + , {start = 4, finish = 4} + , {start = 5, finish = 999} + ] + in + Expect.isTrue (outputList = expectedOutput) + end) ] val tests =