Lines
100 %
Functions
80 %
Branches
use bonsaidb::core::schema::Qualified;
use bonsaidb::files::{BonsaiFiles, FileConfig};
#[test]
fn defaults() {
#[derive(FileConfig)]
struct Test;
assert_eq!(
<Test as FileConfig>::Metadata::default(),
<BonsaiFiles as FileConfig>::Metadata::default()
);
assert_eq!(Test::BLOCK_SIZE, BonsaiFiles::BLOCK_SIZE);
assert_eq!(Test::files_name(), BonsaiFiles::files_name());
assert_eq!(Test::blocks_name(), BonsaiFiles::blocks_name());
}
fn names_only() {
#[file_config(blocks_name = "blocks_test", files_name = "files_test")]
assert_eq!(Test::files_name(), Qualified::private("files_test"));
assert_eq!(Test::blocks_name(), Qualified::private("blocks_test"));
fn names_and_authority() {
#[file_config(
authority = "test",
blocks_name = "blocks_test",
files_name = "files_test"
)]
assert_eq!(Test::files_name(), Qualified::new("test", "files_test"));
assert_eq!(Test::blocks_name(), Qualified::new("test", "blocks_test"));
fn block_size() {
#[file_config(block_size = 10)]
assert_eq!(Test::BLOCK_SIZE, 10);
fn response() {
#[file_config(metadata = String)]
assert_eq!(<Test as FileConfig>::Metadata::default(), String::default());