Skip to content

Commit 637afdf

Browse files
committed
Fix parser unit tests
1 parent d2dd70f commit 637afdf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

aiscript-runtime/src/parser.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ mod tests {
372372
#[test]
373373
fn test_basic_route() {
374374
let input = r#"
375-
route /test/<id:int> {
375+
route /test/:id {
376376
"""
377377
Test route line1
378378
Test route line2
@@ -412,10 +412,10 @@ mod tests {
412412

413413
let route = result.unwrap();
414414
assert_eq!(route.docs, "Test route line1\nTest route line2");
415-
assert_eq!(route.prefix, "/test/:id");
415+
assert_eq!(route.prefix, "/test/{id}");
416416
assert_eq!(route.params.len(), 1);
417417
assert_eq!(route.params[0].name, "id");
418-
assert_eq!(route.params[0].param_type, "int");
418+
assert_eq!(route.params[0].param_type, "str");
419419

420420
let endpoint = &route.endpoints[0];
421421
assert_eq!(endpoint.docs, "Test endpoint");
@@ -607,7 +607,7 @@ mod tests {
607607
fn test_multiple_paths_with_params() {
608608
let input = r#"
609609
route /api {
610-
get /users/<id:int>, post /users {
610+
get /users/:id, post /users {
611611
return "ok";
612612
}
613613
}
@@ -620,7 +620,7 @@ mod tests {
620620
assert_eq!(endpoint.path_specs.len(), 2);
621621

622622
assert_eq!(endpoint.path_specs[0].method, HttpMethod::Get);
623-
assert_eq!(endpoint.path_specs[0].path, "/users/:id");
623+
assert_eq!(endpoint.path_specs[0].path, "/users/{id}");
624624
assert_eq!(endpoint.path_specs[0].params.len(), 1);
625625
assert_eq!(endpoint.path_specs[0].params[0].name, "id");
626626

0 commit comments

Comments
 (0)