Merge pull request #223 from jgallagher/fix-type-inference-with-newest-serde-json

Add more explicit types in unit tests.
This commit is contained in:
John Gallagher 2017-02-05 19:33:40 -05:00 committed by GitHub
commit 53b85d2ab1
5 changed files with 19 additions and 13 deletions

View File

@ -258,7 +258,11 @@ mod test {
{
let mut stmt = db.prepare_cached(sql).unwrap();
assert_eq!(1i32,
stmt.query_map(&[], |r| r.get(0)).unwrap().next().unwrap().unwrap());
stmt.query_map::<i32, _>(&[], |r| r.get(0))
.unwrap()
.next()
.unwrap()
.unwrap());
}
db.execute_batch(r#"

View File

@ -1333,7 +1333,7 @@ mod test {
db.execute("INSERT INTO foo(x) VALUES (?)", &[&2i32]).unwrap());
assert_eq!(3i32,
db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap());
db.query_row::<i32, _>("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap());
}
#[test]
@ -1449,7 +1449,7 @@ mod test {
db.execute_batch(sql).unwrap();
assert_eq!(10i64,
db.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0))
db.query_row::<i64, _>("SELECT SUM(x) FROM foo", &[], |r| r.get(0))
.unwrap());
let result: Result<i64> = db.query_row("SELECT x FROM foo WHERE x > 5", &[], |r| r.get(0));

View File

@ -229,9 +229,9 @@ mod test {
1);
assert_eq!(3i32,
db.query_row_named("SELECT SUM(x) FROM foo WHERE x > :x",
&[(":x", &0i32)],
|r| r.get(0))
db.query_row_named::<i32, _>("SELECT SUM(x) FROM foo WHERE x > :x",
&[(":x", &0i32)],
|r| r.get(0))
.unwrap());
}
@ -246,9 +246,9 @@ mod test {
stmt.execute_named(&[(":name", &"one")]).unwrap();
assert_eq!(1i32,
db.query_row_named("SELECT COUNT(*) FROM test WHERE name = :name",
&[(":name", &"one")],
|r| r.get(0))
db.query_row_named::<i32, _>("SELECT COUNT(*) FROM test WHERE name = :name",
&[(":name", &"one")],
|r| r.get(0))
.unwrap());
}

View File

@ -427,7 +427,8 @@ mod test {
{
let tx = db.transaction().unwrap();
assert_eq!(2i32,
tx.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap());
tx.query_row::<i32, _>("SELECT SUM(x) FROM foo", &[], |r| r.get(0))
.unwrap());
}
}
@ -453,7 +454,8 @@ mod test {
{
let tx = db.transaction().unwrap();
assert_eq!(6i32,
tx.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap());
tx.query_row::<i32, _>("SELECT SUM(x) FROM foo", &[], |r| r.get(0))
.unwrap());
}
}
@ -547,7 +549,7 @@ mod test {
}
fn assert_current_sum(x: i32, conn: &Connection) {
let i = conn.query_row("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap();
let i = conn.query_row::<i32, _>("SELECT SUM(x) FROM foo", &[], |r| r.get(0)).unwrap();
assert_eq!(x, i);
}
}

View File

@ -175,7 +175,7 @@ mod test {
db.execute("INSERT INTO foo(i) VALUES (?)", &[&Value::Integer(10)]).unwrap();
assert_eq!(10i64,
db.query_row("SELECT i FROM foo", &[], |r| r.get(0)).unwrap());
db.query_row::<i64, _>("SELECT i FROM foo", &[], |r| r.get(0)).unwrap());
}
#[test]