MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / test_no_top_route

Function test_no_top_route

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

Source from the content-addressed store, hash-verified

556
557 #[test]
558 fn test_no_top_route() {
559 let input = r#"
560 get / {
561 return "hello";
562 }
563
564 post / {
565 return "hello";
566 }
567 "#;
568 let mut parser = Parser::new(input);
569 let result = parser.parse_route();
570 // assert!(result.is_ok());
571 let route = result.unwrap();
572 assert_eq!(route.endpoints.len(), 2);
573 assert_eq!(route.endpoints[0].path_specs[0].method, HttpMethod::Get);
574 assert_eq!(route.endpoints[1].path_specs[0].method, HttpMethod::Post);
575 assert_eq!(route.endpoints[0].path_specs[0].path, "/");
576 assert_eq!(route.endpoints[1].path_specs[0].path, "/");
577 }
578
579 #[test]
580 fn test_multiple_methods() {

Callers

nothing calls this directly

Calls 1

parse_routeMethod · 0.80

Tested by

no test coverage detected