mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-24 23:57:57 +01:00
Modules state commit
This commit is contained in:
parent
2c1b522021
commit
03ff3fcf86
12
modules/dummy/Cargo.toml
Normal file
12
modules/dummy/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "dummy"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
sdk = { path = "../sdk" }
|
29
modules/dummy/src/lib.rs
Normal file
29
modules/dummy/src/lib.rs
Normal file
@ -0,0 +1,29 @@
|
||||
use sdk::BoxFuture;
|
||||
use sdk::initiators::{Initiator, InitiatorError, ResourceID, UpdateSink};
|
||||
|
||||
#[sdk::module]
|
||||
struct Dummy {
|
||||
a: u32,
|
||||
b: u32,
|
||||
c: u32,
|
||||
d: u32,
|
||||
}
|
||||
|
||||
impl Initiator for Dummy {
|
||||
fn start_for(&mut self, machine: ResourceID) -> BoxFuture<'static, Result<(), Box<dyn InitiatorError>>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn run(&mut self, request: &mut UpdateSink) -> BoxFuture<'static, Result<(), Box<dyn InitiatorError>>> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
let result = 2 + 2;
|
||||
assert_eq!(result, 4);
|
||||
}
|
||||
}
|
22
modules/sdk/sdk_proc/Cargo.toml
Normal file
22
modules/sdk/sdk_proc/Cargo.toml
Normal file
@ -0,0 +1,22 @@
|
||||
[package]
|
||||
name = "sdk-proc"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
autotests = false
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
[[test]]
|
||||
name = "tests"
|
||||
path = "tests/progress.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
trybuild = "1.0"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "1.0"
|
||||
syn = "1.0"
|
||||
quote = "1.0"
|
11
modules/sdk/sdk_proc/tests/02-not-or-bad-struct.stderr
Normal file
11
modules/sdk/sdk_proc/tests/02-not-or-bad-struct.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error: Modules must be structs
|
||||
--> tests/02-not-or-bad-struct.rs:4:1
|
||||
|
|
||||
4 | enum EnumModule {
|
||||
| ^^^^
|
||||
|
||||
error: Modules can't be unit structs
|
||||
--> tests/02-not-or-bad-struct.rs:9:24
|
||||
|
|
||||
9 | struct UnitStructModule;
|
||||
| ^
|
12
modules/sdk/sdk_proc/tests/progress.rs
Normal file
12
modules/sdk/sdk_proc/tests/progress.rs
Normal file
@ -0,0 +1,12 @@
|
||||
#[test]
|
||||
fn tests() {
|
||||
let t = trybuild::TestCases::new();
|
||||
t.pass("tests/01-parse-struct.rs");
|
||||
t.compile_fail("tests/02-not-or-bad-struct.rs");
|
||||
//t.compile_fail("tests/03-out-of-order.rs");
|
||||
//t.compile_fail("tests/04-variants-with-data.rs");
|
||||
//t.compile_fail("tests/05-match-expr.rs");
|
||||
//t.compile_fail("tests/06-pattern-path.rs");
|
||||
//t.compile_fail("tests/07-unrecognized-pattern.rs");
|
||||
//t.pass("tests/08-underscore.rs");
|
||||
}
|
Loading…
Reference in New Issue
Block a user