Something went wrong. Try again.
SQL frontend over the catalog engine
Something went wrong. Try again.
123456789101112131415161718192021222324(* The errors in sqlite3's words (sqlite/src/json.c, jsonBadPathError), a path quoted as %Q quotes it, each quote doubled. *)
module E = Sql.Jsonb.Error
let runtime = Alcotest.testable Catalog.Error.pp ( = )
let test_path () = Alcotest.check runtime "bad" (Catalog.Error.Runtime "bad JSON path: '$.a''b['") (E.path Bad_path "$.a'b["); Alcotest.check runtime "not an array element" (Catalog.Error.Runtime "not an array element: '$.a'") (E.path Not_array_element "$.a"); Alcotest.check runtime "too deep" (Catalog.Error.Runtime "JSON path too deep") (E.path Path_too_deep "$.a"); Alcotest.check runtime "malformed" (Catalog.Error.Runtime "malformed JSON") (E.path Malformed "$.a"); Alcotest.check_raises "fail_path" (Catalog.Error (Catalog.Error.Runtime "bad JSON path: 'x'")) (fun () -> E.fail_path Bad_path "x")
let suite = ("jsonb_error", [ Alcotest.test_case "path" `Quick test_path ])