MCPcopy Index your code
hub / github.com/AI45Lab/Code / program_template_instantiates_step_args

Function program_template_instantiates_step_args

core/src/program.rs:888–914  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 3

with_stepMethod · 0.80
with_parameterMethod · 0.80
instantiateMethod · 0.80

Tested by

no test coverage detected