Skip to content

Commit

Permalink
The charset test may also raise Error(FATAL,_)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris00 committed Feb 6, 2019
1 parent b101398 commit feb26f7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/test_dblib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ let get_params () =
| _ ->
None

let with_conn (user, password, server, database) f =
let conn = Dblib.connect ~user ~password server in
let with_conn ?charset (user, password, server, database) f =
let conn = Dblib.connect ?charset ~user ~password server in
Dblib.use conn database;
try
f conn;
Expand Down Expand Up @@ -136,14 +136,13 @@ let test_insert params _ =
)

let test_exception_in_callback params _ =
with_conn params (fun conn ->
with_conn params ~charset:"iso_1" (fun conn ->
begin
try
(* \x81 is invalid in UTF-8 and CP1252 *)
Dblib.sqlexec conn "\x81"
Dblib.sqlexec conn "SELECT ξ"
with
| Dblib.Error(CONVERSION, _) -> ()
| e -> raise e
Dblib.Error(CONVERSION, _) | Dblib.Error(FATAL, _) -> ()
end;
Dblib.sqlexec conn "SELECT 1")

Expand Down

0 comments on commit feb26f7

Please sign in to comment.