Skip to content

Commit 082c43a

Browse files
committed
Merge branch 'feature/cli-payment-tests'
Conflicts: cli/src/commands/ledger.rs cli/src/commands/payment_address.rs
2 parents 121f5c8 + 468b654 commit 082c43a

File tree

4 files changed

+337
-27
lines changed

4 files changed

+337
-27
lines changed

cli/src/commands/common.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub mod load_plugin_command {
113113

114114
pub fn load_plugin(ctx: &CommandContext, library: &str, initializer: &str) -> Result<(), ()> {
115115
let lib = libloading::Library::new(library)
116-
.map_err(|_| println_err!("Plugin not found: \"{:?}\"", library))?;
116+
.map_err(|_| println_err!("Plugin not found: {:?}", library))?;
117117

118118
unsafe {
119119
let init_func: libloading::Symbol<unsafe extern fn() -> ErrorCode> = lib.get(initializer.as_bytes())
@@ -178,6 +178,30 @@ pub mod tests {
178178

179179
TestUtils::cleanup_storage();
180180
}
181+
182+
#[test]
183+
#[cfg(feature = "nullpay_plugin")]
184+
pub fn load_works_for_unknown_plugin() {
185+
let ctx = CommandContext::new();
186+
187+
let cmd = load_plugin_command::new();
188+
let mut params = CommandParams::new();
189+
params.insert("library", "unknown_payment_plugin".to_string());
190+
params.insert("initializer", NULL_PAYMENT_PLUGIN_INIT_FUNCTION.to_string());
191+
cmd.execute(&ctx, &params).unwrap_err();
192+
}
193+
194+
#[test]
195+
#[cfg(feature = "nullpay_plugin")]
196+
pub fn load_works_for_unknown_init_function() {
197+
let ctx = CommandContext::new();
198+
199+
let cmd = load_plugin_command::new();
200+
let mut params = CommandParams::new();
201+
params.insert("library", NULL_PAYMENT_PLUGIN.to_string());
202+
params.insert("initializer", "unknown_init_function".to_string());
203+
cmd.execute(&ctx, &params).unwrap_err();
204+
}
181205
}
182206

183207
pub fn load_null_payment_plugin(ctx: &CommandContext) -> () {

0 commit comments

Comments
 (0)