Updated the OCaml/bitwriter.ml test for OCaml 4.06+
Since OCaml 4.02 (released in 2014), strings and bytes are different types, but up until OCaml 4.06, the compiler defaulted to a compatibility mode "unsafe-string". OCaml 4.06 flips the default to "safe-string", breaking the test. This change should be compatible with OCaml 4.02+, but is only truly necessary for OCaml 4.06+. For more information, see: https://caml.inria.fr/pub/docs/manual-ocaml/libref/String.html https://ocaml.org/releases/4.02.html
This commit is contained in:
parent
cee62e6fcf
commit
b094258661
|
@ -17,7 +17,7 @@ let test x = if not x then exit 1 else ()
|
|||
let read_file name =
|
||||
let ic = open_in_bin name in
|
||||
let len = in_channel_length ic in
|
||||
let buf = String.create len in
|
||||
let buf = Bytes.create len in
|
||||
|
||||
test ((input ic buf 0 len) = len);
|
||||
|
||||
|
@ -46,4 +46,4 @@ let _ =
|
|||
test (file_buf = temp_bitcode m);
|
||||
test (file_buf = temp_bitcode ~unbuffered:false m);
|
||||
test (file_buf = temp_bitcode ~unbuffered:true m);
|
||||
test (file_buf = Llvm.MemoryBuffer.as_string (Llvm_bitwriter.write_bitcode_to_memory_buffer m))
|
||||
test (file_buf = Bytes.of_string (Llvm.MemoryBuffer.as_string (Llvm_bitwriter.write_bitcode_to_memory_buffer m)))
|
||||
|
|
Loading…
Reference in New Issue