mirror of
https://github.com/janet-lang/janet
synced 2026-10-13 03:01:41 +00:00
Add tests for partition-by (#1795)
Co-authored-by: sogaiu <983021772@users.noreply.github.com> Co-authored-by: Calvin Rose <calsrose@gmail.com>
This commit is contained in:
co-authored by
sogaiu
Calvin Rose
parent
ffb6648742
commit
0888a6dfb0
@@ -1040,6 +1040,11 @@
|
||||
(assert (deep= (frequencies (coro (yield 1) (yield 8) (yield 2) (yield 8)))
|
||||
@{1 1 2 1 8 2}))
|
||||
|
||||
# partition-by
|
||||
(assert (deep= (partition-by even? "hello")
|
||||
@[@[104] @[101] @[108 108] @[111]]))
|
||||
(assert (deep= (partition-by keyword? [:a "b" 'c :d])
|
||||
@[@[:a] @["b" 'c] @[:d]]))
|
||||
# update
|
||||
(assert (deep= (update @"hello" 0 (fn [old delta] (+ old delta)) 17)
|
||||
@"yello"))
|
||||
|
||||
Reference in New Issue
Block a user