mirror of
git://git.proxmox.com/git/perlmod.git
synced 2025-03-12 00:58:16 +03:00
test trailing-optional parameters
we'll need proper tests to check that too few and too many parameters actually trigger errors Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
4b5b75f1d8
commit
0044cdcef4
@ -70,6 +70,11 @@ mod export {
|
||||
_ => bail!("invalid"),
|
||||
})
|
||||
}
|
||||
|
||||
#[export]
|
||||
fn test_trailing_optional(first: u32, second: Option<u32>) {
|
||||
println!("{:?}, {:?}", first, second);
|
||||
}
|
||||
}
|
||||
|
||||
#[perlmod::package(name = "RSPM::EnvVarLibrary", lib = "x-${CARGO_PKG_NAME}-y")]
|
||||
|
6
test.pl
6
test.pl
@ -105,7 +105,13 @@ test_unsafe_clone(Storable::dclone($magic));
|
||||
|
||||
print("Testing unsafe clone\n");
|
||||
test_unsafe_clone(Clone::clone($magic));
|
||||
undef $magic;
|
||||
|
||||
print("Testing enum deserialization\n");
|
||||
my $ra = RSPM::Foo142::test_enums("something");
|
||||
die "unexpected result from test_enums: $ra\n" if $ra ne 'result-a';
|
||||
|
||||
print("Testing optional parameters\n");
|
||||
RSPM::Foo142::test_trailing_optional(1, 99);
|
||||
RSPM::Foo142::test_trailing_optional(2, undef);
|
||||
RSPM::Foo142::test_trailing_optional(3);
|
||||
|
@ -37,5 +37,9 @@ Testing unsafe dclone
|
||||
unsafe dclone dropped
|
||||
Testing unsafe clone
|
||||
unsafe dclone dropped
|
||||
Testing enum deserialization
|
||||
Dropping blessed magic with content "magic test"
|
||||
Testing enum deserialization
|
||||
Testing optional parameters
|
||||
1, Some(99)
|
||||
2, None
|
||||
3, None
|
||||
|
Loading…
x
Reference in New Issue
Block a user