feat(wpcarro/emacs): Support list-chunk function

Would be nice to remove the top-level `if` statement, but I can't be bothered to
debug the first unit test without that workaround.

Change-Id: I4ba576bda915eeb11f9fbfeb5d95d8e5668fd0bd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6022
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
This commit is contained in:
William Carroll 2022-08-01 13:43:34 -07:00 committed by clbot
parent 852cc4a9c8
commit 5417b512e7
2 changed files with 28 additions and 0 deletions

View file

@ -42,3 +42,13 @@
(ert-deftest list-join ()
(should (equal "foo-bar-baz"
(list-join "-" '("foo" "bar" "baz")))))
(ert-deftest list-chunk ()
(should (equal '((1 2 3 4 5 6))
(list-chunk 7 '(1 2 3 4 5 6))))
(should (equal '((1) (2) (3) (4) (5) (6))
(list-chunk 1 '(1 2 3 4 5 6))))
(should (equal '((1 2 3) (4 5 6))
(list-chunk 3 '(1 2 3 4 5 6))))
(should (equal '((1 2) (3 4) (5 6))
(list-chunk 2 '(1 2 3 4 5 6)))))