()
| 886 | |
| 887 | #[test] |
| 888 | fn program_template_instantiates_step_args() { |
| 889 | let template = ProgramTemplate::new("search", "Search") |
| 890 | .with_parameter(ProgramParameter::required("query", "Search query")) |
| 891 | .with_parameter(ProgramParameter::optional( |
| 892 | "path", |
| 893 | "Search path", |
| 894 | serde_json::json!("."), |
| 895 | )) |
| 896 | .with_step(ProgramStepTemplate::new( |
| 897 | "grep", |
| 898 | serde_json::json!({ |
| 899 | "pattern": "{{query}}", |
| 900 | "path": "{{path}}", |
| 901 | "message": "query={{query}}" |
| 902 | }), |
| 903 | )); |
| 904 | |
| 905 | let program = template |
| 906 | .instantiate(&serde_json::json!({ "query": "AgentLoop" })) |
| 907 | .unwrap(); |
| 908 | |
| 909 | assert_eq!(program.name, "search"); |
| 910 | assert_eq!(program.steps.len(), 1); |
| 911 | assert_eq!(program.steps[0].args["pattern"], "AgentLoop"); |
| 912 | assert_eq!(program.steps[0].args["path"], "."); |
| 913 | assert_eq!(program.steps[0].args["message"], "query=AgentLoop"); |
| 914 | } |
| 915 | |
| 916 | #[test] |
| 917 | fn program_template_requires_declared_inputs() { |
nothing calls this directly
no test coverage detected