mirror of https://github.com/fafhrd91/actix-web
test: move test_services into lib
This commit is contained in:
parent
fac2af3d6c
commit
ab10615589
|
@ -5,7 +5,6 @@
|
||||||
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
- On Windows, an error is now returned from `HttpServer::bind()` (or TLS variants) when binding to a socket that's already in use.
|
||||||
- Update `brotli` dependency to `7`.
|
- Update `brotli` dependency to `7`.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.75.
|
- Minimum supported Rust version (MSRV) is now 1.75.
|
||||||
- Service macro comments are now filtered out see [issue 3472](https://github.com/actix/actix-web/issues/3472).
|
|
||||||
|
|
||||||
## 4.9.0
|
## 4.9.0
|
||||||
|
|
||||||
|
|
|
@ -871,4 +871,40 @@ mod tests {
|
||||||
let req = test::TestRequest::default().to_request();
|
let req = test::TestRequest::default().to_request();
|
||||||
let _res = test::call_service(&app, req).await;
|
let _res = test::call_service(&app, req).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn define_services_macro_with_multiple_arguments() {
|
||||||
|
let result = services!(1, 2, 3);
|
||||||
|
assert_eq!(result, (1, 2, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn define_services_macro_with_single_argument() {
|
||||||
|
let result = services!(1);
|
||||||
|
assert_eq!(result, (1,));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn define_services_macro_with_no_arguments() {
|
||||||
|
let result = services!();
|
||||||
|
let () = result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn define_services_macro_with_trailing_comma() {
|
||||||
|
let result = services!(1, 2, 3,);
|
||||||
|
assert_eq!(result, (1, 2, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn define_services_macro_with_comments_in_arguments() {
|
||||||
|
let result = services!(
|
||||||
|
1, // First comment
|
||||||
|
2, // Second comment
|
||||||
|
3 // Third comment
|
||||||
|
);
|
||||||
|
|
||||||
|
// Assert that comments are ignored and it correctly returns a tuple.
|
||||||
|
assert_eq!(result, (1, 2, 3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use actix_web::services;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_define_services_macro_with_multiple_arguments() {
|
|
||||||
let result = services!(1, 2, 3);
|
|
||||||
assert_eq!(result, (1, 2, 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_define_services_macro_with_single_argument() {
|
|
||||||
let result = services!(1);
|
|
||||||
assert_eq!(result, (1,));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_define_services_macro_with_no_arguments() {
|
|
||||||
let result = services!();
|
|
||||||
result
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_define_services_macro_with_trailing_comma() {
|
|
||||||
let result = services!(1, 2, 3,);
|
|
||||||
assert_eq!(result, (1, 2, 3));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_define_services_macro_with_comments_in_arguments() {
|
|
||||||
let result = services!(
|
|
||||||
1, // First comment
|
|
||||||
2, // Second comment
|
|
||||||
3 // Third comment
|
|
||||||
);
|
|
||||||
|
|
||||||
// Assert that comments are ignored and it correctly returns a tuple.
|
|
||||||
assert_eq!(result, (1, 2, 3));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue