open OUnit2 let _msg ~expected ~result = Printf.sprintf "Expected %s but got %s" (String.escaped expected) (String.escaped result) let test_decode env = begin let result = Unicode.decode ~encoding:`ISO_8859_1 "caf\xE9" |> Unicode.to_utf8 and expected = "café" in assert_equal ~msg:(_msg ~expected ~result) expected result end let test_tolist env = begin let result = Unicode.decode ~encoding:`UTF_8 "café" |> Unicode.to_list in let expected = ['c'; 'a'; 'f'; '\xE9'] |> List.map Uchar.of_char in assert_equal expected result end let tests = "unicode_test">::: [ "test_decode" >:: test_decode; "test_tolist" >:: test_tolist ]