1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-09 09:36:20 +09:00

lib.takeEnd: init (#398222)

This commit is contained in:
Johannes Kirschbauer 2025-04-23 14:20:47 +02:00 committed by GitHub
commit be393db73e
Signed by: github
GPG key ID: B5690EEEBB952194
3 changed files with 98 additions and 0 deletions

View file

@ -1357,6 +1357,69 @@ runTests {
)
];
testTakeEnd =
let
inherit (lib) takeEnd;
in
testAllTrue [
(
takeEnd 0 [
1
2
3
] == [ ]
)
(
takeEnd 1 [
1
2
3
] == [ 3 ]
)
(
takeEnd 2 [
1
2
3
] == [
2
3
]
)
(
takeEnd 3 [
1
2
3
] == [
1
2
3
]
)
(
takeEnd 4 [
1
2
3
] == [
1
2
3
]
)
(takeEnd 0 [ ] == [ ])
(takeEnd 1 [ ] == [ ])
(
takeEnd (-1) [
1
2
3
] == [ ]
)
(takeEnd (-1) [ ] == [ ])
];
testDrop =
let
inherit (lib) drop;