Skip to content

Commit 99c0d26

Browse files
committed
Comment out attr_arg_descr and attr_arg_descr_collapse tests
1 parent ec76bf5 commit 99c0d26

File tree

2 files changed

+93
-87
lines changed

2 files changed

+93
-87
lines changed

juniper/src/macros/tests/args.rs

Lines changed: 77 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,17 @@ impl Root {
7373
0
7474
}
7575

76-
fn attr_arg_descr(arg: i32) -> i32 {
77-
0
78-
}
79-
fn attr_arg_descr_collapse(arg: i32) -> i32 {
80-
0
81-
}
76+
// TODO: enable once [this issue](https://github.com/graphql-rust/juniper/pull/441) is implemented
77+
// fn attr_arg_descr(
78+
// #[graphql(description = "The arg")]
79+
// arg: i32) -> i32
80+
// { 0 }
81+
//
82+
// fn attr_arg_descr_collapse(
83+
// #[graphql(description = "The first arg")]
84+
// #[graphql(description = "and more details")]
85+
// arg: i32,
86+
// ) -> i32 { 0 }
8287

8388
#[graphql(arguments(arg(default = 123,),))]
8489
fn arg_with_default(arg: i32) -> i32 {
@@ -558,71 +563,72 @@ fn introspect_field_multi_args_descr_trailing_comma() {
558563
});
559564
}
560565

561-
#[test]
562-
fn introspect_field_attr_arg_descr() {
563-
run_args_info_query("attrArgDescr", |args| {
564-
assert_eq!(args.len(), 1);
565-
566-
assert!(args.contains(&Value::object(
567-
vec![
568-
("name", Value::scalar("arg")),
569-
("description", Value::scalar("The arg")),
570-
("defaultValue", Value::null()),
571-
(
572-
"type",
573-
Value::object(
574-
vec![
575-
("name", Value::null()),
576-
(
577-
"ofType",
578-
Value::object(
579-
vec![("name", Value::scalar("Int"))].into_iter().collect(),
580-
),
581-
),
582-
]
583-
.into_iter()
584-
.collect(),
585-
),
586-
),
587-
]
588-
.into_iter()
589-
.collect(),
590-
)));
591-
});
592-
}
593-
594-
#[test]
595-
fn introspect_field_attr_arg_descr_collapse() {
596-
run_args_info_query("attrArgDescrCollapse", |args| {
597-
assert_eq!(args.len(), 1);
598-
599-
assert!(args.contains(&Value::object(
600-
vec![
601-
("name", Value::scalar("arg")),
602-
("description", Value::scalar("The arg\nand more details")),
603-
("defaultValue", Value::null()),
604-
(
605-
"type",
606-
Value::object(
607-
vec![
608-
("name", Value::null()),
609-
(
610-
"ofType",
611-
Value::object(
612-
vec![("name", Value::scalar("Int"))].into_iter().collect(),
613-
),
614-
),
615-
]
616-
.into_iter()
617-
.collect(),
618-
),
619-
),
620-
]
621-
.into_iter()
622-
.collect(),
623-
)));
624-
});
625-
}
566+
// TODO: enable once [this issue](https://github.com/graphql-rust/juniper/pull/441) is implemented
567+
//#[test]
568+
//fn introspect_field_attr_arg_descr() {
569+
// run_args_info_query("attrArgDescr", |args| {
570+
// assert_eq!(args.len(), 1);
571+
//
572+
// assert!(args.contains(&Value::object(
573+
// vec![
574+
// ("name", Value::scalar("arg")),
575+
// ("description", Value::scalar("The arg")),
576+
// ("defaultValue", Value::null()),
577+
// (
578+
// "type",
579+
// Value::object(
580+
// vec![
581+
// ("name", Value::null()),
582+
// (
583+
// "ofType",
584+
// Value::object(
585+
// vec![("name", Value::scalar("Int"))].into_iter().collect(),
586+
// ),
587+
// ),
588+
// ]
589+
// .into_iter()
590+
// .collect(),
591+
// ),
592+
// ),
593+
// ]
594+
// .into_iter()
595+
// .collect(),
596+
// )));
597+
// });
598+
//}
599+
//
600+
//#[test]
601+
//fn introspect_field_attr_arg_descr_collapse() {
602+
// run_args_info_query("attrArgDescrCollapse", |args| {
603+
// assert_eq!(args.len(), 1);
604+
//
605+
// assert!(args.contains(&Value::object(
606+
// vec![
607+
// ("name", Value::scalar("arg")),
608+
// ("description", Value::scalar("The arg\nand more details")),
609+
// ("defaultValue", Value::null()),
610+
// (
611+
// "type",
612+
// Value::object(
613+
// vec![
614+
// ("name", Value::null()),
615+
// (
616+
// "ofType",
617+
// Value::object(
618+
// vec![("name", Value::scalar("Int"))].into_iter().collect(),
619+
// ),
620+
// ),
621+
// ]
622+
// .into_iter()
623+
// .collect(),
624+
// ),
625+
// ),
626+
// ]
627+
// .into_iter()
628+
// .collect(),
629+
// )));
630+
// });
631+
//}
626632

627633
#[test]
628634
fn introspect_field_arg_with_default() {

juniper_codegen/src/util.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,20 @@ impl GraphQLTypeDefiniton {
731731
}
732732
});
733733

734+
let scalar = self
735+
.scalar
736+
.as_ref()
737+
.map(|s| quote!( #s ))
738+
.unwrap_or_else(|| {
739+
if self.generic_scalar {
740+
// If generic_scalar is true, we always insert a generic scalar.
741+
// See more comments below.
742+
quote!(__S)
743+
} else {
744+
quote!(#juniper_crate_name::DefaultScalarValue)
745+
}
746+
});
747+
734748
let resolve_matches = self.fields.iter().map(|field| {
735749
let name = &field.name;
736750
let code = &field.resolver_code;
@@ -740,7 +754,7 @@ impl GraphQLTypeDefiniton {
740754
#name => {
741755
panic!("Tried to resolve async field {} on type {:?} with a sync resolver",
742756
#name,
743-
Self::name(_info)
757+
<Self as #juniper_crate_name::GraphQLType<#scalar>>::name(_info)
744758
);
745759
},
746760
)
@@ -782,20 +796,6 @@ impl GraphQLTypeDefiniton {
782796
)
783797
});
784798

785-
let scalar = self
786-
.scalar
787-
.as_ref()
788-
.map(|s| quote!( #s ))
789-
.unwrap_or_else(|| {
790-
if self.generic_scalar {
791-
// If generic_scalar is true, we always insert a generic scalar.
792-
// See more comments below.
793-
quote!(__S)
794-
} else {
795-
quote!(#juniper_crate_name::DefaultScalarValue)
796-
}
797-
});
798-
799799
// Preserve the original type_generics before modification,
800800
// since alteration makes them invalid if self.generic_scalar
801801
// is specified.
@@ -999,7 +999,7 @@ impl GraphQLTypeDefiniton {
999999
_ => {
10001000
panic!("Field {} not found on type {:?}",
10011001
field,
1002-
Self::name(_info)
1002+
<Self as #juniper_crate_name::GraphQLType<#scalar>>::name(_info)
10031003
);
10041004
}
10051005
}

0 commit comments

Comments
 (0)