+# test info
+{
+ my ($do_info, $check_info, $do_info_err, $check_info_err);
+
+ $do_info = make_cb('do_info' => sub {
+ $chg->info(info_cb => $check_info,
+ info => [ 'num_slots' ]);
+ });
+
+ $check_info = make_cb('check_info' => sub {
+ my ($err, %results) = @_;
+ die($err) if $err;
+ is_deeply(\%results, { 'num_slots' => 13 },
+ "info() works");
+ $do_info_err->();
+ });
+
+ $do_info_err = make_cb('do_info_err' => sub {
+ $chg->info(info_cb => $check_info_err,
+ info => [ 'mkerror1', 'mkerror2' ]);
+ });
+
+ $check_info_err = make_cb('check_info_err' => sub {
+ my ($err, %results) = @_;
+ is($err,
+ "While getting info key 'mkerror1': err1; While getting info key 'mkerror2': err2",
+ "info errors are handled correctly");
+ is($err->{'type'}, 'failed', "error has type 'failed'");
+ ok($err->failed, "\$err->failed is true");
+ ok(!$err->fatal, "\$err->fatal is false");
+ is($err->{'reason'}, 'unknown', "\$err->{'reason'} is 'unknown'");
+ ok($err->unknown, "\$err->unknown is true");
+ ok(!$err->notimpl, "\$err->notimpl is false");
+ Amanda::MainLoop::quit();
+ });
+
+ $do_info->();