Part 4: Use value_and_span apparatus in root crate.

This commit is contained in:
Nick Alexander 2017-03-30 09:52:26 -07:00
parent ff136b2546
commit 720fbf3d01

View file

@ -129,9 +129,8 @@ impl Conn {
sqlite: &mut rusqlite::Connection, sqlite: &mut rusqlite::Connection,
transaction: &str) -> Result<TxReport> { transaction: &str) -> Result<TxReport> {
let assertion_vector = edn::parse::value(transaction) let assertion_vector = edn::parse::value(transaction)?;
.map(|x| x.without_spans())?; let entities = mentat_tx_parser::Tx::parse(assertion_vector)?;
let entities = mentat_tx_parser::Tx::parse(&[assertion_vector][..])?;
let tx = sqlite.transaction()?; let tx = sqlite.transaction()?;
@ -178,7 +177,6 @@ mod tests {
use super::*; use super::*;
extern crate mentat_parser_utils; extern crate mentat_parser_utils;
use self::mentat_parser_utils::ValueParseError;
#[test] #[test]
fn test_transact_errors() { fn test_transact_errors() {
@ -203,7 +201,7 @@ mod tests {
// Bad transaction data: missing leading :db/add. // Bad transaction data: missing leading :db/add.
let report = conn.transact(&mut sqlite, "[[\"t\" :db/ident :b/keyword]]"); let report = conn.transact(&mut sqlite, "[[\"t\" :db/ident :b/keyword]]");
match report.unwrap_err() { match report.unwrap_err() {
Error(ErrorKind::TxParseError(::mentat_tx_parser::errors::ErrorKind::ParseError(ValueParseError { .. })), _) => { }, Error(ErrorKind::TxParseError(::mentat_tx_parser::errors::ErrorKind::ParseError(_)), _) => { },
x => panic!("expected EDN parse error, got {:?}", x), x => panic!("expected EDN parse error, got {:?}", x),
} }