diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-28 09:06:08 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-28 09:06:08 +0800 |
| commit | 748c14588cf1c31c8b8d60a9c94349c0173ef607 (patch) | |
| tree | 4c09bfafd93b629a68f0f78902a33e8dd9ef18d1 /mingling_pathf/test/src/test_files | |
| parent | 50f2d767e2d07685e49fb7deae68d506ea11a79d (diff) | |
feat(pathf): add build-time type path resolution system
Add `mingling_pathf` sub-crate and `pathf` feature for automatic
resolution of Mingling type module paths at build time. Scans source
files, identifies macro invocations via pattern matchers, and generates
mapping files consumed by `gen_program!()`.
Diffstat (limited to 'mingling_pathf/test/src/test_files')
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_chain.rs | 61 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_completion.rs | 41 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_dispatcher.rs | 17 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_dispatcher_clap.rs | 33 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_group.rs | 13 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_groupped_derive.rs | 26 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_help.rs | 33 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_pack.rs | 17 | ||||
| -rw-r--r-- | mingling_pathf/test/src/test_files/test_renderer.rs | 33 |
9 files changed, 274 insertions, 0 deletions
diff --git a/mingling_pathf/test/src/test_files/test_chain.rs b/mingling_pathf/test/src/test_files/test_chain.rs new file mode 100644 index 0000000..e209a5e --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_chain.rs @@ -0,0 +1,61 @@ +#[mingling::macros::chain] +fn my_chain1(prev: Some1) -> Next { + +} + +#[mingling::macros::chain] +pub fn my_chain2(prev: Some2) -> Next { + +} + +#[mingling::macros::chain] +pub async fn my_chain3(prev: Some3) -> Next { + +} + +#[chain] +fn my_chain4(prev: Some4) { + +} + +#[chain] +pub fn my_chain5(prev: Some5) { + +} + +#[chain] +pub async fn my_chain6(prev: Some6) { + +} + +pub mod sub { + #[mingling::macros::chain] + fn my_chain1(prev: Some1) -> Next { + + } + + #[mingling::macros::chain] + pub fn my_chain2(prev: Some2) -> Next { + + } + + #[mingling::macros::chain] + pub async fn my_chain3(prev: Some3) -> Next { + + } + + #[chain] + fn my_chain4(prev: Some4) { + + } + + #[chain] + pub fn my_chain5(prev: Some5) { + + } + + #[chain] + pub async fn my_chain6(prev: Some6) { + + } +} diff --git a/mingling_pathf/test/src/test_files/test_completion.rs b/mingling_pathf/test/src/test_files/test_completion.rs new file mode 100644 index 0000000..87a655f --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_completion.rs @@ -0,0 +1,41 @@ +#[mingling::macros::completion(Some1)] +fn my_completion1(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() +} + +#[mingling::macros::completion(Some2)] +pub fn my_completion2(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() +} + +#[completion(Some3)] +fn my_completion3(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() +} + +#[completion(Some4)] +pub fn my_completion4(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() +} + +pub mod sub { + #[mingling::macros::completion(Some1)] + fn my_completion1(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() + } + + #[mingling::macros::completion(Some2)] + pub fn my_completion2(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() + } + + #[completion(Some3)] + fn my_completion3(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() + } + + #[completion(Some4)] + pub fn my_completion4(ctx: &mingling::ShellContext) -> mingling::Suggest { + mingling::Suggest::new() + } +} diff --git a/mingling_pathf/test/src/test_files/test_dispatcher.rs b/mingling_pathf/test/src/test_files/test_dispatcher.rs new file mode 100644 index 0000000..48f5e4d --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_dispatcher.rs @@ -0,0 +1,17 @@ +mingling::macros::dispatcher!("greet", CMDGreet => EntryGreet); +mingling::macros::dispatcher!("greet"); +mingling::macros::dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd); +mingling::macros::dispatcher!("remote.add"); + +dispatcher!("delete", CMDDelete => EntryDelete); +dispatcher!("delete"); +dispatcher!("remote.rm", CMDRemoteRm => EntryRemoteRm); +dispatcher!("remote.rm"); + +pub mod sub { + mingling::macros::dispatcher!("greet", CMDGreet => EntryGreet); + mingling::macros::dispatcher!("greet"); + + dispatcher!("delete", CMDDelete => EntryDelete); + dispatcher!("delete"); +} diff --git a/mingling_pathf/test/src/test_files/test_dispatcher_clap.rs b/mingling_pathf/test/src/test_files/test_dispatcher_clap.rs new file mode 100644 index 0000000..0ba884d --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_dispatcher_clap.rs @@ -0,0 +1,33 @@ +#[mingling::macros::dispatcher_clap] +struct EntryClap1 { + name: String, + age: i32, +} + +#[mingling::macros::dispatcher_clap] +#[command(name = "greet")] +pub struct EntryClap2 { + name: String, +} + +#[dispatcher_clap] +struct EntryClap3 { + value: String, +} + +#[dispatcher_clap] +pub struct EntryClap4 { + value: i32, +} + +pub mod sub { + #[mingling::macros::dispatcher_clap] + struct EntryClap1 { + name: String, + } + + #[dispatcher_clap] + struct EntryClap3 { + value: String, + } +} diff --git a/mingling_pathf/test/src/test_files/test_group.rs b/mingling_pathf/test/src/test_files/test_group.rs new file mode 100644 index 0000000..92c8cda --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_group.rs @@ -0,0 +1,13 @@ +mingling::macros::group!(Group1); +mingling::macros::group!(GroupAlias1 = std::io::Error); + +group!(Group2); +group!(GroupAlias2 = std::num::ParseIntError); + +pub mod sub { + mingling::macros::group!(Group1); + mingling::macros::group!(GroupAlias1 = std::io::Error); + + group!(Group2); + group!(GroupAlias2 = std::num::ParseIntError); +} diff --git a/mingling_pathf/test/src/test_files/test_groupped_derive.rs b/mingling_pathf/test/src/test_files/test_groupped_derive.rs new file mode 100644 index 0000000..f6c6fa9 --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_groupped_derive.rs @@ -0,0 +1,26 @@ +#[derive(Groupped)] +struct Derived1 { + value: String, +} + +#[derive(Groupped, Debug, Clone)] +struct Derived2 { + value: i32, +} + +#[derive(GrouppedSerialize)] +struct Derived3 { + value: bool, +} + +pub mod sub { + #[derive(Groupped)] + struct Derived1 { + value: String, + } + + #[derive(GrouppedSerialize)] + struct Derived3 { + value: bool, + } +} diff --git a/mingling_pathf/test/src/test_files/test_help.rs b/mingling_pathf/test/src/test_files/test_help.rs new file mode 100644 index 0000000..52d1408 --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_help.rs @@ -0,0 +1,33 @@ +#[mingling::macros::help] +fn my_help1(prev: Some1) { +} + +#[mingling::macros::help] +pub fn my_help2(prev: Some2) { +} + +#[help] +fn my_help3(prev: Some3) { +} + +#[help] +pub fn my_help4(prev: Some4) { +} + +pub mod sub { + #[mingling::macros::help] + fn my_help1(prev: Some1) { + } + + #[mingling::macros::help] + pub fn my_help2(prev: Some2) { + } + + #[help] + fn my_help3(prev: Some3) { + } + + #[help] + pub fn my_help4(prev: Some4) { + } +} diff --git a/mingling_pathf/test/src/test_files/test_pack.rs b/mingling_pathf/test/src/test_files/test_pack.rs new file mode 100644 index 0000000..759e35f --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_pack.rs @@ -0,0 +1,17 @@ +mingling::macros::pack!(ResultPack1 = String); +mingling::macros::pack_err!(ErrorPack1); +mingling::macros::pack_err!(ErrorPack2 = PathBuf); + +pack!(ResultPack2 = (u8, String)); +pack_err!(ErrorPack3); +pack_err!(ErrorPack4 = PathBuf); + +pub mod sub { + mingling::macros::pack!(ResultPack1 = String); + mingling::macros::pack_err!(ErrorPack1); + mingling::macros::pack_err!(ErrorPack2 = PathBuf); + + pack!(ResultPack2 = (u8, String)); + pack_err!(ErrorPack3); + pack_err!(ErrorPack4 = PathBuf); +} diff --git a/mingling_pathf/test/src/test_files/test_renderer.rs b/mingling_pathf/test/src/test_files/test_renderer.rs new file mode 100644 index 0000000..ea52f5c --- /dev/null +++ b/mingling_pathf/test/src/test_files/test_renderer.rs @@ -0,0 +1,33 @@ +#[mingling::macros::renderer] +fn my_renderer1(prev: Some1) { +} + +#[mingling::macros::renderer] +pub fn my_renderer2(prev: Some2) { +} + +#[renderer] +fn my_renderer3(prev: Some3) { +} + +#[renderer] +pub fn my_renderer4(prev: Some4) { +} + +pub mod sub { + #[mingling::macros::renderer] + fn my_renderer1(prev: Some1) { + } + + #[mingling::macros::renderer] + pub fn my_renderer2(prev: Some2) { + } + + #[renderer] + fn my_renderer3(prev: Some3) { + } + + #[renderer] + pub fn my_renderer4(prev: Some4) { + } +} |
