update test files

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-06-23 10:58:31 +02:00
parent fbf0c7a20b
commit fa780264ca
4 changed files with 15 additions and 0 deletions

View File

@ -10,3 +10,4 @@ crate-type = [ "cdylib" ]
[dependencies]
anyhow = "1.0"
perlmod = { path = "../perlmod", features = [ "exporter" ] }
serde = { version = "1.0", features = [ "derive" ] }

View File

@ -1,3 +1,8 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize)]
pub struct Blubber(String);
#[perlmod::package(name = "RSPM::Foo142", lib = "perlmod_test")]
mod export {
use anyhow::{bail, Error};
@ -22,4 +27,10 @@ mod export {
println!("teststr called with {:?}", t);
Ok(())
}
#[export]
fn test_serde(value: super::Blubber) -> Result<(), Error> {
println!("got {:?}", value);
Ok(())
}
}

View File

@ -24,3 +24,5 @@ print "Parameter exists: " . (exists($param->{x}) ? "YES" : "NO") . "\n";
RSPM::Foo142::test($param->{x});
print "Was auto-vivified: " . (exists($param->{x}) ? "YES" : "NO") . "\n";
RSPM::Foo142::teststr($param->{x});
RSPM::Foo142::test_serde("Hello");

View File

@ -4,6 +4,7 @@ test called with Some("lo ")
teststr called with Some("lo ")
test called with None
teststr called with None
got Blubber("Hello")
Got (17, 32, )
Got: 2 values: 17 32
These should be called with a valid substr: