mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
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:
commit
53b85d2ab1
@ -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#"
|
||||
|
@ -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));
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user