|
| 1 | +(********************************************************************************) |
| 2 | +(* crs - A tool for managing code review comments embedded in source code *) |
| 3 | +(* Copyright (C) 2024-2025 Mathieu Barbin <mathieu.barbin@gmail.com> *) |
| 4 | +(* *) |
| 5 | +(* This file is part of crs. *) |
| 6 | +(* *) |
| 7 | +(* crs is free software; you can redistribute it and/or modify it under the *) |
| 8 | +(* terms of the GNU Lesser General Public License as published by the Free *) |
| 9 | +(* Software Foundation either version 3 of the License, or any later version, *) |
| 10 | +(* with the LGPL-3.0 Linking Exception. *) |
| 11 | +(* *) |
| 12 | +(* crs is distributed in the hope that it will be useful, but WITHOUT ANY *) |
| 13 | +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *) |
| 14 | +(* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License and *) |
| 15 | +(* the file `NOTICE.md` at the root of this repository for more details. *) |
| 16 | +(* *) |
| 17 | +(* You should have received a copy of the GNU Lesser General Public License *) |
| 18 | +(* and the LGPL-3.0 Linking Exception along with this library. If not, see *) |
| 19 | +(* <http://www.gnu.org/licenses/> and <https://spdx.org>, respectively. *) |
| 20 | +(********************************************************************************) |
| 21 | + |
| 22 | +let%expect_test "all" = |
| 23 | + List.iter Cr_comment.Qualifier.all ~f:(fun qualifier -> |
| 24 | + let priority = Cr_comment.Qualifier.priority qualifier in |
| 25 | + print_s |
| 26 | + [%sexp { qualifier : Cr_comment.Qualifier.t; priority : Cr_comment.Priority.t }]); |
| 27 | + [%expect |
| 28 | + {| |
| 29 | + ((qualifier None) |
| 30 | + (priority Now)) |
| 31 | + ((qualifier Soon) |
| 32 | + (priority Soon)) |
| 33 | + ((qualifier Someday) |
| 34 | + (priority Someday)) |
| 35 | + |}]; |
| 36 | + () |
| 37 | +;; |
| 38 | + |
| 39 | +let%expect_test "equal" = |
| 40 | + require_equal [%here] (module Cr_comment.Qualifier) None None; |
| 41 | + require_not_equal [%here] (module Cr_comment.Qualifier) None Soon; |
| 42 | + [%expect {||}]; |
| 43 | + () |
| 44 | +;; |
| 45 | + |
| 46 | +let%expect_test "compare" = |
| 47 | + print_s |
| 48 | + [%sexp |
| 49 | + (List.sort |
| 50 | + (List.concat |
| 51 | + [ List.rev Cr_comment.Qualifier.all; [ Soon; None; Someday; None ] ]) |
| 52 | + ~compare:Cr_comment.Qualifier.compare |
| 53 | + : Cr_comment.Qualifier.t list)]; |
| 54 | + [%expect {| (None None None Soon Soon Someday Someday) |}]; |
| 55 | + () |
| 56 | +;; |
0 commit comments