1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#[allow(unused_imports)]
use feignhttp::get;
#[test]
fn test_validate_no_url () {
// error: no metadata assign
// | #[get]
// | ^^^^^^^^
// #[get]
// pub fn get() {}
}
#[test]
fn test_validate_url() {
// error: metadata url not specified
// | #[get(aaa = "http://xxx")]
// | ^^^^^^^^^^^^^^^^^^^^^^^^^^
// #[get(aaa = "http://xxx")]
// pub fn get() {}
}
#[test]
fn test_validate_url2() {
// error: metadata url not specified
// | #[get(path = "/xxx")]
// | ^^^^^^^^^^^^^^^^^^^^^
// #[get(path = "/xxx")]
// pub fn get() {}
}
#[test]
fn test_validate_invalid_url() {
// error: metadata url is invalid
// | #[get(url + "/aaa")]
// | ^^^^^^^^^^^^^^^^^^^^
// let url = "http://xxx";
// #[get(url + "/aaa")]
// pub fn get() {}
}
#[test]
fn test_validate_async () {
// error: only support async fn
// | pub fn get() {}
// | ^^
// #[get("http://xxx")]
// pub fn get() {}
}
#[test]
fn test_validate_return_value() {
// error: function must have a return value
// | pub async fn get() {}
// | ^^^^^^^^^^^^^^
// #[get("http://xxx")]
// pub async fn get() {}
}
#[test]
fn test_validate_return_value2() {
// error: return value must be Result
// | pub async fn get() -> i32 {}
// | ^^^^^^^^^^^^^^^^^^^^^
// #[get("http://xxx")]
// pub async fn get() -> i32 {}
}
#[test]
fn test_validate_arg() {
// error: unknown content marker: aaa
// | pub async fn get(#[aaa] a: i32) -> Result<String, String> {}
// | ^^^
// #[get("http://xxx")]
// pub async fn get(#[aaa] a: i32) -> Result<String, String> {}
}
#[test]
fn test_validate_arg2() {
// error: unknown content marker: bbb
// | pub async fn get(a: i32, #[bbb] b: i32) -> Result<String, String> {}
// | ^^^
// #[get("http://xxx")]
// pub async fn get(a: i32, #[bbb] b: i32) -> Result<String, String> {}
}