Skip to content

Commit ed0fab9

Browse files
committed
Add regression tests for qualified names in codegen
For now only ensure that a locally defined `Result` type or `Send` trait do not affect the generated code.
1 parent 27ded82 commit ed0fab9

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

tests/codegen/pass/local_results.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Local types overriding the stdlib Result should not affect generated code
2+
3+
type Result<T> = std::result::Result<T, ()>;
4+
5+
#[derive(juniper::GraphQLInputObject)]
6+
#[graphql(name = "UserInformation")]
7+
pub struct Update {
8+
pub email: Option<String>,
9+
pub username: Option<String>,
10+
}
11+
12+
pub fn main() {}

tests/codegen/pass/local_send.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Local types overriding the stdlib Send should not affect generated code
2+
3+
trait Send {}
4+
5+
#[derive(juniper::GraphQLInputObject)]
6+
#[graphql(name = "UserInformation")]
7+
pub struct Update {
8+
pub email: Option<String>,
9+
pub username: Option<String>,
10+
}
11+
12+
pub fn main() {}

tests/codegen/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ fn test_failing_compilation() {
77
let t = trybuild::TestCases::new();
88
t.compile_fail("fail/**/*.rs");
99
}
10+
11+
#[rustversion::nightly]
12+
#[test]
13+
fn test_passing_compilation() {
14+
let t = trybuild::TestCases::new();
15+
t.pass("pass/**/*.rs");
16+
}

0 commit comments

Comments
 (0)