MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / test_multiple_paths_with_params

Function test_multiple_paths_with_params

aiscript-runtime/src/parser.rs:716–739  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

714 #[test]
715 #[ignore = "temporary ignore"]
716 fn test_multiple_paths_with_params() {
717 let input = r#"
718 route /api {
719 get /users/:id, post /users {
720 return "ok";
721 }
722 }
723 "#;
724
725 let mut parser = Parser::new(input);
726 let result = parser.parse_route().unwrap();
727
728 let endpoint = &result.endpoints[0];
729 assert_eq!(endpoint.path_specs.len(), 2);
730
731 assert_eq!(endpoint.path_specs[0].method, HttpMethod::Get);
732 assert_eq!(endpoint.path_specs[0].path, "/users/{id}");
733 assert_eq!(endpoint.path_specs[0].params.len(), 1);
734 assert_eq!(endpoint.path_specs[0].params[0], "id");
735
736 assert_eq!(endpoint.path_specs[1].method, HttpMethod::Post);
737 assert_eq!(endpoint.path_specs[1].path, "/users");
738 assert_eq!(endpoint.path_specs[1].params.len(), 0);
739 }
740
741 #[test]
742 fn test_empty_paths() {

Callers

nothing calls this directly

Calls 1

parse_routeMethod · 0.80

Tested by

no test coverage detected