Created
September 27, 2020 11:13
-
-
Save leviroth/3ce45434124b94be47c0834b86e29337 to your computer and use it in GitHub Desktop.
Sqlite3_utils error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open! Core | |
let sexp_of_return_code return_code : Sexp.t = Atom (Sqlite3.Rc.to_string return_code) | |
let create_tables database = | |
Sqlite3_utils.exec0_exn database "CREATE TABLE ids(id INTEGER PRIMARY KEY)" | |
;; | |
let insert database = | |
ignore | |
(Sqlite3_utils.exec_no_cursor | |
database | |
"INSERT INTO ids (id) VALUES(1)" | |
~ty:Sqlite3_utils.Ty.nil | |
: (unit, Sqlite3.Rc.t) Result.t) | |
;; | |
let%expect_test _ = | |
let database = Sqlite3.db_open ":memory:" in | |
create_tables database; | |
insert database; | |
insert database | |
[@@expect.uncaught_exn | |
{| | |
(* CR expect_test_collector: This test expectation appears to contain a backtrace. | |
This is strongly discouraged as backtraces are fragile. | |
Please change this test to not include a backtrace. *) | |
("sqlite error: CONSTRAINT") | |
Raised at file "src/sqlite3_utils.ml", line 254, characters 4-11 | |
Called from file "philosophy-utils/link-archiver/test/test.ml" (inlined), line 11, characters 4-117 | |
Called from file "philosophy-utils/link-archiver/test/test.ml", line 23, characters 2-17 | |
Called from file "collector/expect_test_collector.ml", line 244, characters 12-19 |}] | |
;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment