Lines
100 %
Functions
66.67 %
Branches
use core::fmt::Debug;
use bonsaidb::core::schema::{Collection, CollectionName, Schema, Schematic};
#[test]
fn core() {
#[derive(Schema, Debug)]
#[schema(name = "name", core = ::bonsaidb::core)]
struct Test<T: Sync + Send + Debug + 'static>(T);
assert_eq!(
Test::<String>::schema_name(),
bonsaidb::core::schema::SchemaName::private("name")
);
}
fn name_only() {
#[schema(name = "name")]
fn name_and_authority() {
#[schema(name = "name", authority = "authority")]
bonsaidb::core::schema::SchemaName::new("authority", "name")
fn collections() {
#[schema(name = "name", authority = "authority", collections = [TestCollection])]
struct TestSchema;
let schematic = Schematic::from_schema::<TestSchema>().unwrap();
assert!(schematic
.collections()
.contains(&CollectionName::private("name")));
#[derive(Collection, Debug)]
#[collection(name = "name")]
struct TestCollection;