module scheme import os import rand // A three-byte facade scalar occupies only two bytes in the raw UTF16 stream. fn test_utf16_quoted_three_byte_scalar_requires_retaining_partial_boundary() { path := os.join_path(os.vtmp_dir(), 'vile-fractional-negative-' + rand.ulid()) defer { os.rm(path) or {} } os.write_file_array(path, [u8(0xfe), 0xff, 0, 34, 9, 5, 0, 34, 0, 66]) or { panic(err.msg()) } mut vm := new() p := vm.open_file_input_output_port(path, no_create: true no_truncate: true buffer_mode: .none transcoder: transcoder_value(.utf16, .none, .raise) ) or { panic(err.msg()) } defer { vm.close_port(p) or {} } assert (vm.read(p) or { panic(err.msg()) }).text() == 'अ' }