Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 76 additions & 80 deletions juniper/src/macros/tests/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@ impl Root {
arg1 + arg2
}

// TODO: enable once [parameter attributes are supported by proc macros]
// (https://github.com/graphql-rust/juniper/pull/441)
//fn attr_arg_descr(
// #[graphql(description = "The arg")]
// arg: i32) -> i32
//{ 0 }
//fn attr_arg_descr_collapse(
// #[graphql(description = "The first arg")]
// #[graphql(description = "and more details")]
// arg: i32,
//) -> i32 { 0 }
fn attr_arg_descr(#[graphql(description = "The arg")] arg: i32) -> i32 {
0
}

fn attr_arg_descr_collapse(
#[graphql(description = "The first arg")]
#[graphql(description = "and more details")]
arg: i32,
) -> i32 {
0
}

#[graphql(arguments(arg(default = 123,),))]
fn arg_with_default(arg: i32) -> i32 {
Expand Down Expand Up @@ -580,75 +580,71 @@ async fn introspect_field_multi_args_descr_trailing_comma() {
.await;
}

// TODO: enable once [parameter attributes are supported by proc macros]
// (https://github.com/graphql-rust/juniper/pull/441)
// #[tokio::test]
// fn introspect_field_attr_arg_descr() {
// run_args_info_query("attrArgDescr", |args| {
// assert_eq!(args.len(), 1);

// assert!(args.contains(&Value::object(
// vec![
// ("name", Value::scalar("arg")),
// ("description", Value::scalar("The arg")),
// ("defaultValue", Value::null()),
// (
// "type",
// Value::object(
// vec![
// ("name", Value::null()),
// (
// "ofType",
// Value::object(
// vec![("name", Value::scalar("Int"))].into_iter().collect(),
// ),
// ),
// ]
// .into_iter()
// .collect(),
// ),
// ),
// ]
// .into_iter()
// .collect(),
// )));
// });
// }

// TODO: enable once [parameter attributes are supported by proc macros]
// (https://github.com/graphql-rust/juniper/pull/441)
// #[tokio::test]
// fn introspect_field_attr_arg_descr_collapse() {
// run_args_info_query("attrArgDescrCollapse", |args| {
// assert_eq!(args.len(), 1);

// assert!(args.contains(&Value::object(
// vec![
// ("name", Value::scalar("arg")),
// ("description", Value::scalar("The arg\nand more details")),
// ("defaultValue", Value::null()),
// (
// "type",
// Value::object(
// vec![
// ("name", Value::null()),
// (
// "ofType",
// Value::object(
// vec![("name", Value::scalar("Int"))].into_iter().collect(),
// ),
// ),
// ]
// .into_iter()
// .collect(),
// ),
// ),
// ]
// .into_iter()
// .collect(),
// )));
// });
// }
#[tokio::test]
async fn introspect_field_attr_arg_descr() {
run_args_info_query("attrArgDescr", |args| {
assert_eq!(args.len(), 1);

assert!(args.contains(&Value::object(
vec![
("name", Value::scalar("arg")),
("description", Value::scalar("The arg")),
("defaultValue", Value::null()),
(
"type",
Value::object(
vec![
("name", Value::null()),
(
"ofType",
Value::object(
vec![("name", Value::scalar("Int"))].into_iter().collect(),
),
),
]
.into_iter()
.collect(),
),
),
]
.into_iter()
.collect(),
)));
});
}

#[tokio::test]
async fn introspect_field_attr_arg_descr_collapse() {
run_args_info_query("attrArgDescrCollapse", |args| {
assert_eq!(args.len(), 1);

assert!(args.contains(&Value::object(
vec![
("name", Value::scalar("arg")),
("description", Value::scalar("The arg\nand more details")),
("defaultValue", Value::null()),
(
"type",
Value::object(
vec![
("name", Value::null()),
(
"ofType",
Value::object(
vec![("name", Value::scalar("Int"))].into_iter().collect(),
),
),
]
.into_iter()
.collect(),
),
),
]
.into_iter()
.collect(),
)));
});
}

#[tokio::test]
async fn introspect_field_arg_with_default() {
Expand Down