mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-22 16:29:20 +08:00
[ci skip] Make test_array_module fails without sanitizer
This commit is contained in:
parent
3aca24792c
commit
e8dc412af1
@ -170,8 +170,7 @@ mod test {
|
|||||||
use Connection;
|
use Connection;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(rustfmt, rustfmt_skip)]
|
#[ignore] // cargo test --lib --features "array" -- --ignored
|
||||||
#[ignore] // RUSTFLAGS="-Z sanitizer=address" cargo test --lib --features "array" -- --ignored
|
|
||||||
fn test_array_module() {
|
fn test_array_module() {
|
||||||
let db = Connection::open_in_memory().unwrap();
|
let db = Connection::open_in_memory().unwrap();
|
||||||
array::load_module(&db).unwrap();
|
array::load_module(&db).unwrap();
|
||||||
@ -179,16 +178,18 @@ mod test {
|
|||||||
let v = vec![1i64, 2, 3, 4];
|
let v = vec![1i64, 2, 3, 4];
|
||||||
let values = v.into_iter().map(|i| Value::from(i)).collect();
|
let values = v.into_iter().map(|i| Value::from(i)).collect();
|
||||||
let ptr = Rc::new(values);
|
let ptr = Rc::new(values);
|
||||||
let mut stmt = db.prepare("SELECT value from rarray(?);").unwrap();
|
{
|
||||||
|
let mut stmt = db.prepare("SELECT value from rarray(?);").unwrap();
|
||||||
|
|
||||||
let rows = stmt.query_map(&[&ptr], |row| row.get::<_, i64>(0)).unwrap();
|
let rows = stmt.query_map(&[&ptr], |row| row.get::<_, i64>(0)).unwrap();
|
||||||
assert_eq!(2, Rc::strong_count(&ptr));
|
assert_eq!(2, Rc::strong_count(&ptr));
|
||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
for (i, value) in rows.enumerate() {
|
for (i, value) in rows.enumerate() {
|
||||||
assert_eq!(i as i64, value.unwrap()-1);
|
assert_eq!(i as i64, value.unwrap() - 1);
|
||||||
count += 1;
|
count += 1;
|
||||||
|
}
|
||||||
|
assert_eq!(4, count);
|
||||||
}
|
}
|
||||||
assert_eq!(4, count);
|
|
||||||
assert_eq!(1, Rc::strong_count(&ptr));
|
assert_eq!(1, Rc::strong_count(&ptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user