mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 03:35:30 -05:00
Merge pull request #182 from Fourchaux/master
Correcting test `CCList.tail_opt`
This commit is contained in:
commit
c3e11ba31b
1 changed files with 7 additions and 4 deletions
|
|
@ -859,6 +859,12 @@ let tail_opt = function
|
|||
| [] -> None
|
||||
| _ :: tail -> Some tail
|
||||
|
||||
(*$= & ~printer:Q.Print.(option (list int))
|
||||
(Some [2;3]) (tail_opt [1;2;3])
|
||||
(Some []) (tail_opt [1])
|
||||
None (tail_opt [])
|
||||
*)
|
||||
|
||||
let rec last_opt = function
|
||||
| [] -> None
|
||||
| [x] -> Some x
|
||||
|
|
@ -868,9 +874,6 @@ let rec last_opt = function
|
|||
(Some 1) (head_opt [1;2;3])
|
||||
(Some 1) (head_opt [1])
|
||||
None (head_opt [])
|
||||
(Some [2;3]) (tail_opt [1;2;3])
|
||||
(Some []) (tail_opt [1])
|
||||
None (tail_opt [])
|
||||
(Some 3) (last_opt [1;2;3])
|
||||
(Some 1) (last_opt [1])
|
||||
None (last_opt [])
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue