]> git.proxmox.com Git - perlmod.git/commitdiff
update test files
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 23 Jun 2021 08:58:31 +0000 (10:58 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Wed, 23 Jun 2021 08:58:31 +0000 (10:58 +0200)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
perlmod-test/Cargo.toml
perlmod-test/src/pkg142.rs
test.pl
test.pl.expected

index 058323be2a674d0afe1ca2167c71964deb65b2ad..09006fecb44c4cac4c9a1e488bcf403ae9225d70 100644 (file)
@@ -10,3 +10,4 @@ crate-type = [ "cdylib" ]
 [dependencies]
 anyhow = "1.0"
 perlmod = { path = "../perlmod", features = [ "exporter" ] }
+serde = { version = "1.0", features = [ "derive" ] }
index 6a9b75a3f7ab65192c65db2375e3a12351086416..14e4690664ed8f6126f66aaa454aa5b88b35498e 100644 (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(())
+    }
 }
diff --git a/test.pl b/test.pl
index 782e4671fe222d0e65050f9607eb82bd392b9e0b..e75c867bd83e216a625086471f6f92f6f36ca9be 100644 (file)
--- a/test.pl
+++ b/test.pl
@@ -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");
index c118214133b931c150130db45dc95f04dc031273..226bb7e0f2067997d987e762d0b9d0dfbe481b1a 100644 (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: