Skip to content

Commit f48f311

Browse files
committed
Test that leading underscores are preserved
1 parent ca7f805 commit f48f311

File tree

4 files changed

+6179
-3
lines changed

4 files changed

+6179
-3
lines changed

tests/introspection.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ extern crate graphql_client;
33
#[macro_use]
44
extern crate serde_derive;
55
extern crate serde;
6+
extern crate serde_json;
67

78
#[derive(GraphQLQuery)]
89
#[graphql(
910
query_path = "tests/introspection/introspection_query.graphql",
1011
schema_path = "tests/introspection/introspection_schema.graphql",
12+
response_derives = "Debug,PartialEq"
1113
)]
1214
#[allow(dead_code)]
1315
struct IntrospectionQuery;
@@ -16,3 +18,14 @@ struct IntrospectionQuery;
1618
fn introspection_schema() {
1719
()
1820
}
21+
22+
const INTROSPECTION_RESPONSE: &'static str =
23+
include_str!("./introspection/introspection_response.json");
24+
25+
#[test]
26+
fn leading_underscores_are_preserved() {
27+
let deserialized: graphql_client::GraphQLResponse<introspection_query::ResponseData> =
28+
serde_json::from_str(INTROSPECTION_RESPONSE).unwrap();
29+
assert!(deserialized.data.is_some());
30+
assert!(deserialized.data.unwrap().schema.is_some());
31+
}

tests/introspection/introspection_query.graphql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
query IntrospectionQuery {
2-
__Schema {
2+
__schema {
33
queryType {
44
name
55
}

0 commit comments

Comments
 (0)