package commons

  1. Overview
  2. Docs
Yet another set of common utilities

Install

Dune Dependency

Authors

Maintainers

Sources

commons_1.8.0.tar.gz
md5=00142d2d5f299c86ee44f19820bf9874
sha512=d25a57c434514ecb9adc5a129eeec9feca1cea2d1383e3bde74b52a05da174a09e0f46e7407f7b86ecdf1bf6faf7e0a66ef744d6fb389cb5f8398bc32e349555

doc/src/commons.tests/Unit_immutable_buffer.ml.html

Source file Unit_immutable_buffer.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module B = Immutable_buffer

let test_immutable_buffer () =
  let check (expected, b) =
    Alcotest.(check string) expected expected (B.to_string b)
  in
  List.iter check
    [
      ("just string", B.of_string "just string");
      ( "combine",
        B.combine [ B.of_string "co"; B.of_string "mbi"; B.of_string "ne" ] );
      ( "with a separator",
        B.combine ~sep:" "
          [ B.of_string "with"; B.of_string "a"; B.of_string "separator" ] );
      ( "foo(1, 2, 3)",
        B.combine
          [
            B.of_string "foo(";
            B.combine ~sep:", "
              [ B.of_string "1"; B.of_string "2"; B.of_string "3" ];
            B.of_string ")";
          ] );
    ]

let tests =
  Testutil.pack_tests "immutable buffer"
    [ ("test immutable buffer", test_immutable_buffer) ]
OCaml

Innovation. Community. Security.