Terminal styling and layout widgets
866 B
26 lines
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Thomas Gazagnaire. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6open Console
7
8let test_none () =
9 let ansi = Style.to_ansi Style.none in
10 Alcotest.(check string) "none produces empty" "" ansi
11
12let test_bold () =
13 let ansi = Style.to_ansi Style.bold in
14 Alcotest.(check string) "bold ANSI code" "\027[1m" ansi
15
16let test_composition () =
17 let style = Style.(bold + fg Color.red + underline) in
18 Alcotest.(check bool) "composed style not none" false (Style.is_none style)
19
20let suite =
21 ( "style",
22 [
23 Alcotest.test_case "none" `Quick test_none;
24 Alcotest.test_case "bold" `Quick test_bold;
25 Alcotest.test_case "composition" `Quick test_composition;
26 ] )