import gleeunit import gleeunit/should import glentities pub fn main() { gleeunit.main() } pub fn decode_test() { let input = "This & 'string' contains 👀 many ꙮ "encoded" characters. ☃" should.equal( glentities.decode(input), "This & 'string' contains 👀 many ꙮ \"encoded\" characters. ☃", ) } pub fn encode_named_test() { let input = "This & 'string' contains    many Θ \"encoded\" characters. ☃" should.equal( glentities.encode(input, glentities.Named), "This &amp 'string' contains    many Θ "encoded" characters. ☃", ) } pub fn encode_hex_test() { let input = "This & 'string' contains    many Θ \"encoded\" characters. ☃" should.equal( glentities.encode(input, glentities.Hex), "This &amp 'string' contains    many Θ "encoded" characters. ☃", ) } pub fn roundtrip_named_test() { let input = normalise( "Ἰοὺ ἰού· τὰ πάντʼ ἂν ἐξήκοι σαφῆ. ஸ்றீனிவாஸ ராமானுஜன் ஐயங்கார் A ∩ B = { c : c ∈ A, c ∈ B }", ) should.equal( input |> glentities.encode(glentities.Named) |> glentities.decode(), input, ) } pub fn roundtrip_hex_test() { let input = normalise( "Ἰοὺ ἰού· τὰ πάντʼ ἂν ἐξήκοι σαφῆ. ஸ்றீனிவாஸ ராமானுஜன் ஐயங்கார் A ∩ B = { c : c ∈ A, c ∈ B }", ) should.equal( input |> glentities.encode(glentities.Hex) |> glentities.decode(), input, ) } external fn normalise(text: String) -> String = "unicode" "characters_to_nfc_binary"