From 5876be3d480694f0faf7e1e4d94c3c79a9e9384c Mon Sep 17 00:00:00 2001 From: gwenn Date: Sat, 19 Dec 2015 17:01:06 +0100 Subject: [PATCH] Add test with cacheable set to false --- src/cache.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/cache.rs b/src/cache.rs index f7599ca..1173901 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -145,4 +145,20 @@ mod test { assert_eq!(0, cache.len()); assert_eq!(15, cache.capacity()); } + + #[test] + fn test_cacheable() { + let db = Connection::open_in_memory().unwrap(); + let cache = StatementCache::new(&db, 15); + + let sql = "PRAGMA schema_version"; + { + let mut stmt = cache.get(sql).unwrap(); + assert_eq!(0, cache.len()); + assert_eq!(0, + stmt.query(&[]).unwrap().get_expected_row().unwrap().get::(0)); + stmt.cacheable = false; + } + assert_eq!(0, cache.len()); + } }