aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/tests
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-21 05:49:00 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-21 05:49:00 +0800
commit700c049f64b66f424cda5da3021dfce4462655ca (patch)
treeb4fd21e5e6f82be29b18c47d8617814b28c159a6 /mingling_core/tests
parent2097238b57810d78989d3ecab8bc97ce1b8a6aa1 (diff)
feat(core): add generic parameter `C` to `StructuralData` trait
Make `StructuralData` and `StructuralDataSealed` generic over a program collector type to bypass the orphan rule for `group_structural!`. This enables external types to implement `StructuralData<crate::ThisProgram>` without violating coherence.
Diffstat (limited to 'mingling_core/tests')
-rw-r--r--mingling_core/tests/test-all/tests/integration.rs9
-rw-r--r--mingling_core/tests/test-structural-renderer/tests/integration.rs3
2 files changed, 8 insertions, 4 deletions
diff --git a/mingling_core/tests/test-all/tests/integration.rs b/mingling_core/tests/test-all/tests/integration.rs
index 08703b0..d36b9df 100644
--- a/mingling_core/tests/test-all/tests/integration.rs
+++ b/mingling_core/tests/test-all/tests/integration.rs
@@ -1,5 +1,4 @@
use mingling::Flag;
-use mingling::MockProgramCollect;
use mingling::NextProcess;
use mingling::Node;
use mingling::Program;
@@ -125,13 +124,13 @@ fn test_structural_renderer_json() {
#[test]
fn test_is_completing() {
- let program: Program<MockProgramCollect> = Program::new_with_args(["app", "__comp"]);
+ let program: Program<crate::ThisProgram> = Program::new_with_args(["app", "__comp"]);
assert!(program.is_completing());
}
#[test]
fn test_is_not_completing() {
- let program: Program<MockProgramCollect> = Program::new_with_args(["app", "greet"]);
+ let program: Program<crate::ThisProgram> = Program::new_with_args(["app", "greet"]);
assert!(!program.is_completing());
}
@@ -141,7 +140,7 @@ fn test_is_not_completing() {
fn test_hook_setup() {
static CALLED: AtomicBool = AtomicBool::new(false);
- let hook = ProgramHook::<MockProgramCollect>::empty().on_begin::<_, ()>(|_| {
+ let hook = ProgramHook::<crate::ThisProgram>::empty().on_begin::<_, ()>(|_| {
CALLED.store(true, Ordering::SeqCst);
});
@@ -166,3 +165,5 @@ fn test_string_vec_from_array() {
let v: Vec<String> = sv.into();
assert_eq!(v, vec!["a", "b", "c"]);
}
+
+mingling::macros::gen_program!();
diff --git a/mingling_core/tests/test-structural-renderer/tests/integration.rs b/mingling_core/tests/test-structural-renderer/tests/integration.rs
index 0bcf53a..e4057f8 100644
--- a/mingling_core/tests/test-structural-renderer/tests/integration.rs
+++ b/mingling_core/tests/test-structural-renderer/tests/integration.rs
@@ -74,3 +74,6 @@ fn test_render_ron() {
assert!(output.contains("value:"));
assert!(output.contains("42"));
}
+
+mingling::macros::gen_program!();
+