From be2a1ddf9641322832d01234d17e0d8e6eba1f6e Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sun, 30 Nov 2025 08:47:01 -0600 Subject: [PATCH] Add test case for dollar suffix match. --- CHANGELOG.md | 1 + test/suite-corelib.janet | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ceb7c8b..b08f27f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file. ## Unreleased - ??? - Add `thaw-keep-keys` as a variant of thaw - The `repl` function now respects the `*repl-prompt*` dynamic binding. +- Allow matching exact lengths of datastructures with the `match` macro using a dollar suffix. ## 1.40.1 - 2025-11-16 - Fix `JANET_REDUCED_OS` build regression caused by `os/posix-chroot`. diff --git a/test/suite-corelib.janet b/test/suite-corelib.janet index 3008ef3d..b1fddd56 100644 --- a/test/suite-corelib.janet +++ b/test/suite-corelib.janet @@ -191,5 +191,9 @@ (assert (deep= (thaw ds1) (thaw-keep-keys ds1)) "thaw vs. thaw-keep-keys 1") (assert (deep-not= (thaw ds2) (thaw-keep-keys ds2)) "thaw vs. thaw-keep-keys 2") +# match +(assert (= :yes (match [1 2 3] [x y z w] :no1 [x y $] :no2 [x y z] :yes)) "match dollar suffix 1") +(assert (= :yes (match [1 2 3] [x y z w] :no1 [x y z $] :yes [x y z] :no2)) "match dollar suffix 2") + (end-suite)