use microrm::prelude::*; use test_log::test; mod common; // this used to conflict with the microrm metadata table #[derive(Entity)] struct Meta {} #[derive(Default, Schema)] struct MetaConflictDB { #[allow(unused)] pub meta_list: microrm::IDMap, } #[test] fn builtin_name_conflict() { let (_pool, _db): (_, MetaConflictDB) = common::open_test_db!(); } #[derive(Entity)] struct OrdinaryEntity { v: usize, } #[derive(Default, Schema)] struct ConflictingDB { pub map1: microrm::IDMap, pub map2: microrm::IDMap, } #[test] #[should_panic(expected = "duplicate IDMap for entity ordinary_entity")] fn multimap_conflict() { let (pool, db): (_, ConflictingDB) = common::open_test_db!(); let mut lease = pool.acquire().unwrap(); assert_eq!(db.map1.count(&mut lease).unwrap(), 0); assert_eq!(db.map2.count(&mut lease).unwrap(), 0); db.map1.insert(&mut lease, OrdinaryEntity { v: 0 }).unwrap(); assert_eq!(db.map1.count(&mut lease).unwrap(), 1); assert_eq!(db.map2.count(&mut lease).unwrap(), 0); }