1use macroblog::router::{Router};
2
3#[test]
4fn test_router_new_posts() {
5 match Router::new("/posts/k8s.html") {
6 Router::NotFound => assert!(false, "Wrong type parse"),
7 Router::Index => assert!(false, "Wrong type parse"),
8 Router::Post { page } => assert_eq!(page, "k8s.html".to_string())
9 };
10}
11
12#[test]
13fn test_router_new_index() {
14 match Router::new("/") {
15 Router::Index => assert!(true),
16 Router::NotFound => assert!(false, "Wrong type parse"),
17 Router::Post { page: _ } => assert!(false, "Wrong type parse")
18 };
19}
20
21#[test]
22fn test_router_new_not_found() {
23 match Router::new("/not_found") {
24 Router::NotFound => assert!(true),
25 Router::Index => assert!(false, "Wrong type parse"),
26 Router::Post { page: _ } => assert!(false, "Wrong type parse")
27 };
28}