Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/tokenless/crates/tokenless-ccr/src/tests/store_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,25 @@ fn stash_error_display() {
let e = StashError::Backend("test error".to_string());
assert!(format!("{}", e).contains("test error"));
}

#[test]
fn default_trait_creates_working_store() {
let store = InMemoryStore::default();
assert!(store.is_empty());
let key = store.stash("payload").unwrap();
assert!(!store.is_empty());
let retrieved = store.retrieve(&key).unwrap();
assert_eq!(retrieved, Some("payload".to_string()));
}

#[cfg(feature = "sqlite")]
#[test]
fn stash_error_from_rusqlite() {
let rusqlite_err = rusqlite::Error::SqliteFailure(
rusqlite::ffi::Error::new(1),
Some("test error".to_string()),
);
let stash_err: StashError = StashError::from(rusqlite_err);
let msg = format!("{}", stash_err);
assert!(msg.contains("test error"));
}
5 changes: 4 additions & 1 deletion src/tokenless/crates/tokenless-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,11 @@ fn open_stash_store(override_path: Option<&str>) -> Option<Arc<dyn StashStore>>

fn run() -> Result<(), (String, i32)> {
let cli = Cli::parse();
run_command(cli.command)
}

match cli.command {
fn run_command(command: Commands) -> Result<(), (String, i32)> {
match command {
Commands::CompressSchema {
file,
batch,
Expand Down
Loading
Loading