1 extern crate assert_cmd;
2 extern crate escargot;
3
4 use assert_cmd::prelude::*;
5 use escargot::CargoBuild;
6
7 #[test]
test_hostipv4_1()8 fn test_hostipv4_1() {
9 let example = CargoBuild::new().example("hostipv4").run().unwrap();
10 let mut cmd = example.command();
11 let output = cmd.unwrap();
12 output.clone().assert().success();
13 output.assert().stdout("127.0.0.1\n");
14 }
15
16 #[test]
test_hostipv4_2()17 fn test_hostipv4_2() {
18 let example = CargoBuild::new().example("hostipv4").run().unwrap();
19 let mut cmd = example.command();
20 let output = cmd.args(&["-H", "10.0.0.1"]).unwrap();
21 output.clone().assert().success();
22 output.assert().stdout("10.0.0.1\n");
23 }
24
25 #[test]
test_hostipv4_3()26 fn test_hostipv4_3() {
27 let example = CargoBuild::new().example("hostipv4").run().unwrap();
28 let mut cmd = example.command();
29 cmd.args(&["-H", "::1"]).assert().failure();
30 }
31
32 #[test]
test_hostipv4_4()33 fn test_hostipv4_4() {
34 let example = CargoBuild::new().example("hostipv4").run().unwrap();
35 let mut cmd = example.command();
36 cmd.args(&["-H", "none"]).assert().failure();
37 }
38
39 #[test]
test_hostipv4_5()40 fn test_hostipv4_5() {
41 let example = CargoBuild::new().example("hostipv4").run().unwrap();
42 let mut cmd = example.command();
43 cmd.args(&["-H", "256.0.0.1"]).assert().failure();
44 }
45
46 #[test]
test_hostipv4param_1()47 fn test_hostipv4param_1() {
48 let example = CargoBuild::new().example("hostipv4_param").run().unwrap();
49 let mut cmd = example.command();
50 cmd.assert().failure();
51 }
52
53 #[test]
test_hostipv4param_2()54 fn test_hostipv4param_2() {
55 let example = CargoBuild::new().example("hostipv4_param").run().unwrap();
56 let mut cmd = example.command();
57 let output = cmd.args(&["-H", "10.0.0.1"]).unwrap();
58 output.clone().assert().success();
59 output.assert().stdout("10.0.0.1\n");
60 }
61
62 #[test]
test_hostipv4param_3()63 fn test_hostipv4param_3() {
64 let example = CargoBuild::new().example("hostipv4_param").run().unwrap();
65 let mut cmd = example.command();
66 cmd.args(&["-H", "::1"]).assert().failure();
67 }
68
69 #[test]
test_hostipv4param_4()70 fn test_hostipv4param_4() {
71 let example = CargoBuild::new().example("hostipv4_param").run().unwrap();
72 let mut cmd = example.command();
73 cmd.args(&["-H", "none"]).assert().failure();
74 }
75
76 #[test]
test_hostipv4param_5()77 fn test_hostipv4param_5() {
78 let example = CargoBuild::new().example("hostipv4_param").run().unwrap();
79 let mut cmd = example.command();
80 cmd.args(&["-H", "256.0.0.1"]).assert().failure();
81 }
82 #[test]
test_hostipv6_1()83 fn test_hostipv6_1() {
84 let example = CargoBuild::new().example("hostipv6").run().unwrap();
85 let mut cmd = example.command();
86 let output = cmd.unwrap();
87 output.clone().assert().success();
88 output.assert().stdout("::1\n");
89 }
90
91 #[test]
test_hostipv6_2()92 fn test_hostipv6_2() {
93 let example = CargoBuild::new().example("hostipv6").run().unwrap();
94 let mut cmd = example.command();
95 let output = cmd.args(&["-H", "200a::1"]).unwrap();
96 output.clone().assert().success();
97 output.assert().stdout("200a::1\n");
98 }
99
100 #[test]
test_hostipv6_3()101 fn test_hostipv6_3() {
102 let example = CargoBuild::new().example("hostipv6").run().unwrap();
103 let mut cmd = example.command();
104 cmd.args(&["-H", "127.0.0.1"]).assert().failure();
105 }
106
107 #[test]
test_hostipv6_4()108 fn test_hostipv6_4() {
109 let example = CargoBuild::new().example("hostipv6").run().unwrap();
110 let mut cmd = example.command();
111 cmd.args(&["-H", "none"]).assert().failure();
112 }
113
114 #[test]
test_hostipv6_5()115 fn test_hostipv6_5() {
116 let example = CargoBuild::new().example("hostipv6").run().unwrap();
117 let mut cmd = example.command();
118 cmd.args(&["-H", "200a::1::1"]).assert().failure();
119 }
120
121 #[test]
test_hostipv6param_1()122 fn test_hostipv6param_1() {
123 let example = CargoBuild::new().example("hostipv6_param").run().unwrap();
124 let mut cmd = example.command();
125 cmd.assert().failure();
126 }
127
128 #[test]
test_hostipv6param_2()129 fn test_hostipv6param_2() {
130 let example = CargoBuild::new().example("hostipv6_param").run().unwrap();
131 let mut cmd = example.command();
132 let output = cmd.args(&["-H", "200a::1"]).unwrap();
133 output.clone().assert().success();
134 output.assert().stdout("200a::1\n");
135 }
136
137 #[test]
test_hostipv6param_3()138 fn test_hostipv6param_3() {
139 let example = CargoBuild::new().example("hostipv6_param").run().unwrap();
140 let mut cmd = example.command();
141 cmd.args(&["-H", "127.0.0.1"]).assert().failure();
142 }
143
144 #[test]
test_hostipv6param_4()145 fn test_hostipv6param_4() {
146 let example = CargoBuild::new().example("hostipv6_param").run().unwrap();
147 let mut cmd = example.command();
148 cmd.args(&["-H", "none"]).assert().failure();
149 }
150
151 #[test]
test_hostipv6param_5()152 fn test_hostipv6param_5() {
153 let example = CargoBuild::new().example("hostipv6_param").run().unwrap();
154 let mut cmd = example.command();
155 cmd.args(&["-H", "200a::1::1"]).assert().failure();
156 }
157
158 #[test]
test_hostip_1()159 fn test_hostip_1() {
160 let example = CargoBuild::new().example("hostip").run().unwrap();
161 let mut cmd = example.command();
162 let output = cmd.unwrap();
163 output.clone().assert().success();
164 output.assert().stdout("::1\n");
165 }
166
167 #[test]
test_hostip_2()168 fn test_hostip_2() {
169 let example = CargoBuild::new().example("hostip").run().unwrap();
170 let mut cmd = example.command();
171 let output = cmd.args(&["-H", "200a::1"]).unwrap();
172 output.clone().assert().success();
173 output.assert().stdout("200a::1\n");
174 }
175
176 #[test]
test_hostip_3()177 fn test_hostip_3() {
178 let example = CargoBuild::new().example("hostip").run().unwrap();
179 let mut cmd = example.command();
180 let output = cmd.args(&["-H", "127.0.0.1"]).unwrap();
181 output.clone().assert().success();
182 output.assert().stdout("127.0.0.1\n");
183 }
184
185 #[test]
test_hostip_4()186 fn test_hostip_4() {
187 let example = CargoBuild::new().example("hostip").run().unwrap();
188 let mut cmd = example.command();
189 cmd.args(&["-H", "256.0.0.1"]).assert().failure();
190 }
191
192 #[test]
test_hostip_5()193 fn test_hostip_5() {
194 let example = CargoBuild::new().example("hostip").run().unwrap();
195 let mut cmd = example.command();
196 cmd.args(&["-H", "none"]).assert().failure();
197 }
198
199 #[test]
test_hostip_6()200 fn test_hostip_6() {
201 let example = CargoBuild::new().example("hostip").run().unwrap();
202 let mut cmd = example.command();
203 cmd.args(&["-H", "200a::1::1"]).assert().failure();
204 }
205
206 #[test]
test_hostipparam_1()207 fn test_hostipparam_1() {
208 let example = CargoBuild::new().example("hostip_param").run().unwrap();
209 let mut cmd = example.command();
210 cmd.assert().failure();
211 }
212
213 #[test]
test_hostipparam_2()214 fn test_hostipparam_2() {
215 let example = CargoBuild::new().example("hostip_param").run().unwrap();
216 let mut cmd = example.command();
217 let output = cmd.args(&["-H", "200a::1"]).unwrap();
218 output.clone().assert().success();
219 output.assert().stdout("200a::1\n");
220 }
221
222 #[test]
test_hostipparam_3()223 fn test_hostipparam_3() {
224 let example = CargoBuild::new().example("hostip_param").run().unwrap();
225 let mut cmd = example.command();
226 let output = cmd.args(&["-H", "127.0.0.1"]).unwrap();
227 output.clone().assert().success();
228 output.assert().stdout("127.0.0.1\n");
229 }
230
231 #[test]
test_hostipparam_4()232 fn test_hostipparam_4() {
233 let example = CargoBuild::new().example("hostip_param").run().unwrap();
234 let mut cmd = example.command();
235 cmd.args(&["-H", "256.0.0.1"]).assert().failure();
236 }
237
238 #[test]
test_hostipparam_5()239 fn test_hostipparam_5() {
240 let example = CargoBuild::new().example("hostip_param").run().unwrap();
241 let mut cmd = example.command();
242 cmd.args(&["-H", "none"]).assert().failure();
243 }
244
245 #[test]
test_hostipparam_6()246 fn test_hostipparam_6() {
247 let example = CargoBuild::new().example("hostip_param").run().unwrap();
248 let mut cmd = example.command();
249 cmd.args(&["-H", "200a::1::1"]).assert().failure();
250 }
251