commit
6c54873ca2
34 changed files with 5502 additions and 0 deletions
24
tests/basic.rs
Normal file
24
tests/basic.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
use owl::prelude::*;
|
||||
|
||||
#[cfg(test)]
|
||||
#[model]
|
||||
pub struct TestModel {
|
||||
pub id: Id,
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn save_load_db() {
|
||||
let data = "TestData".to_string();
|
||||
let db = Database::in_memory();
|
||||
|
||||
let m = TestModel {
|
||||
id: Id::String(data.clone()),
|
||||
data: data.clone(),
|
||||
};
|
||||
|
||||
db.save(m);
|
||||
|
||||
let get_model: Model<TestModel> = db.get(data.as_str()).unwrap();
|
||||
assert_eq!(get_model.read().id.to_string(), data);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue