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

Function test_path_with_dash

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

Source from the content-addressed store, hash-verified

937
938 #[test]
939 fn test_path_with_dash() {
940 let input = r#"
941 route /api {
942 get /get-messages {
943 return "Messages";
944 }
945
946 post /user-profile/update-settings {
947 return "Settings updated";
948 }
949 }
950 "#;
951
952 let mut parser = Parser::new(input);
953 let result = parser.parse_route();
954
955 let route = result.unwrap();
956 assert_eq!(route.prefix, "/api");
957
958 let endpoint1 = &route.endpoints[0];
959 assert_eq!(endpoint1.path_specs[0].method, HttpMethod::Get);
960 assert_eq!(endpoint1.path_specs[0].path, "/get-messages");
961
962 let endpoint2 = &route.endpoints[1];
963 assert_eq!(endpoint2.path_specs[0].method, HttpMethod::Post);
964 assert_eq!(
965 endpoint2.path_specs[0].path,
966 "/user-profile/update-settings"
967 );
968 }
969}

Callers

nothing calls this directly

Calls 1

parse_routeMethod · 0.80

Tested by

no test coverage detected