trillium_testing/
methods.rs1macro_rules! method {
4 ($fn_name:ident, $method:ident) => {
5 method!(
6 $fn_name,
7 $method,
8 concat!(
9 "Builds a new [`TestConn`](crate::TestConn) with the ",
11 stringify!($fn_name),
12 " http method and the provided path.
13
14```
15use trillium_testing::prelude::*;
16
17let conn = ",
18 stringify!($fn_name),
19 "(\"/some/route\").on(&());
20
21assert_eq!(conn.method(), Method::",
22 stringify!($method),
23 ");
24assert_eq!(conn.path(), \"/some/route\");
25```
26"
27 )
28 );
29 };
30
31 ($fn_name:ident, $method:ident, $doc_comment:expr_2021) => {
32 #[doc = $doc_comment]
33 pub fn $fn_name(path: impl Into<String>) -> $crate::TestConn {
34 $crate::TestConn::build($crate::prelude::Method::$method, path, ())
35 }
36 };
37}
38
39method!(get, Get);
40method!(post, Post);
41method!(put, Put);
42method!(delete, Delete);
43method!(patch, Patch);