lib.dropEnd: init
Naming borrowed from Haskell - `base`: [`dropWhileEnd`] - `extra`, `mono-traversable`, ...: [`dropEnd`] [`dropEnd`]: https://hackage.haskell.org/package/mono-traversable-1.0.21.0/docs/Data-Sequences.html#v:dropEnd [`dropWhileEnd`]: https://hackage.haskell.org/package/base-4.21.0.0/docs/Data-List.html#v:dropWhileEnd
This commit is contained in:
@@ -866,6 +866,18 @@ runTests {
|
||||
(drop 1 [ ] == [ ])
|
||||
];
|
||||
|
||||
testDropEnd = let inherit (lib) dropEnd; in testAllTrue [
|
||||
(dropEnd 0 [ 1 2 3 ] == [ 1 2 3 ])
|
||||
(dropEnd 1 [ 1 2 3 ] == [ 1 2 ])
|
||||
(dropEnd 2 [ 1 2 3 ] == [ 1 ])
|
||||
(dropEnd 3 [ 1 2 3 ] == [ ])
|
||||
(dropEnd 4 [ 1 2 3 ] == [ ])
|
||||
(dropEnd 0 [ ] == [ ])
|
||||
(dropEnd 1 [ ] == [ ])
|
||||
(dropEnd (-1) [ 1 2 3 ] == [ 1 2 3 ])
|
||||
(dropEnd (-1) [ ] == [ ])
|
||||
];
|
||||
|
||||
testListHasPrefixExample1 = {
|
||||
expr = lists.hasPrefix [ 1 2 ] [ 1 2 3 4 ];
|
||||
expected = true;
|
||||
|
||||
Reference in New Issue
Block a user