Skip to content

Commit

Permalink
Add regression tests for qualified names in codegen
Browse files Browse the repository at this point in the history
For now only ensure that a locally defined `Result` type or `Send` trait
do not affect the generated code.
  • Loading branch information
tpoliaw committed Oct 2, 2023
1 parent 27ded82 commit ed0fab9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/codegen/pass/local_results.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Local types overriding the stdlib Result should not affect generated code

type Result<T> = std::result::Result<T, ()>;

#[derive(juniper::GraphQLInputObject)]
#[graphql(name = "UserInformation")]
pub struct Update {
pub email: Option<String>,
pub username: Option<String>,
}

pub fn main() {}
12 changes: 12 additions & 0 deletions tests/codegen/pass/local_send.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Local types overriding the stdlib Send should not affect generated code

trait Send {}

#[derive(juniper::GraphQLInputObject)]
#[graphql(name = "UserInformation")]
pub struct Update {
pub email: Option<String>,
pub username: Option<String>,
}

pub fn main() {}
7 changes: 7 additions & 0 deletions tests/codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ fn test_failing_compilation() {
let t = trybuild::TestCases::new();
t.compile_fail("fail/**/*.rs");
}

#[rustversion::nightly]
#[test]
fn test_passing_compilation() {
let t = trybuild::TestCases::new();
t.pass("pass/**/*.rs");
}

0 comments on commit ed0fab9

Please sign in to comment.