package alcotest
Alcotest is a lightweight and colourful test framework
Install
Dune Dependency
Authors
Maintainers
Sources
alcotest-js-1.5.0.tbz
sha256=54281907e02d78995df246dc2e10ed182828294ad2059347a1e3a13354848f6c
sha512=1aea91de40795ec4f6603d510107e4b663c1a94bd223f162ad231316d8595e9e098cabbe28a46bdcb588942f3d103d8377373d533bcc7413ba3868a577469b45
doc/src/alcotest.engine/safe_string.ml.html
Source file safe_string.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 28 29 30 31 32
open! Import let escape str = let add_codepoint buf uchar = Uchar.to_int uchar |> Fmt.str "U+%04X" |> Buffer.add_string buf in let buf = Buffer.create (String.length str * 2) in let get_normalized_char _ _ u = match u with | `Uchar u -> if Uchar.is_char u then match Uchar.to_char u with | ('A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '_' | '-' | ' ' | '.') as c -> Buffer.add_char buf c | '/' | '\\' -> Buffer.add_char buf '-' | _ -> add_codepoint buf u else add_codepoint buf u | `Malformed _ -> Uutf.Buffer.add_utf_8 buf Uutf.u_rep in Uutf.String.fold_utf_8 get_normalized_char () str; Buffer.contents buf type t = { raw : string; escaped : string } let v raw = { raw; escaped = escape raw } let to_string { escaped; _ } = escaped let to_unescaped_string { raw; _ } = raw let pp = Fmt.using (fun { raw; _ } -> raw) Fmt.string let length { raw; _ } = String.length_utf8 raw let equal t t' = String.equal t.escaped t'.escaped let compare t t' = String.compare t.escaped t'.escaped
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>