9mm/lib/slice.test.fnl

20 lines
953 B
Plaintext
Raw Normal View History

2024-05-30 01:26:41 +00:00
(let [{: slice} (require :lib.slice)
{: describe :end test-end} (require :lib.test)]
(describe "slice()" (fn [t]
(t
(let [t [:apple :orange :pear :banana :strawberry]
]
{:given "a list of elements and a start"
:should "return the list starting at start"
:expected [:orange :pear :banana :strawberry]
:actual (slice t 2)}))
(t
(let [t [:apple :orange :pear :banana :strawberry]
]
{:given "a list of elements and a start and a stop"
:should "return the items between the two"
:expected [:orange :pear]
:actual (slice t 2 3)}))
(test-end))))