From 1acf2067d308b049e590d8b0e665f717f27a525f Mon Sep 17 00:00:00 2001 From: Jane Keibler <wanderingelf14@gmail.com> Date: Thu, 19 Oct 2017 08:28:00 -0400 Subject: [PATCH] Stabilized juniper_tests by using to FnvHashMap Registry uses fnv::FnvHashMap instead of the std lib HashMap. This commit updates the tests to match. --- juniper_tests/Cargo.toml | 3 +++ juniper_tests/src/codegen/derive_enum.rs | 4 ++-- juniper_tests/src/codegen/derive_input_object.rs | 4 ++-- juniper_tests/src/codegen/derive_object.rs | 4 ++-- juniper_tests/src/lib.rs | 3 +++ 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/juniper_tests/Cargo.toml b/juniper_tests/Cargo.toml index ad456fa9..dcfa9f1c 100644 --- a/juniper_tests/Cargo.toml +++ b/juniper_tests/Cargo.toml @@ -7,6 +7,9 @@ juniper = { path = "../juniper" } juniper_codegen = { path = "../juniper_codegen" } serde_json = { version = "^1.0.2" } +[dev-dependencies] +fnv = "1.0.3" + [[test]] name = "integration_tests" path = "src/lib.rs" diff --git a/juniper_tests/src/codegen/derive_enum.rs b/juniper_tests/src/codegen/derive_enum.rs index 63c04d53..b0f02363 100644 --- a/juniper_tests/src/codegen/derive_enum.rs +++ b/juniper_tests/src/codegen/derive_enum.rs @@ -1,5 +1,5 @@ #[cfg(test)] -use std::collections::HashMap; +use fnv::FnvHashMap; #[cfg(test)] use juniper::{self, FromInputValue, GraphQLType, InputValue, ToInputValue}; @@ -19,7 +19,7 @@ fn test_derived_enum() { assert_eq!(SomeEnum::name(&()), Some("Some")); // Ensure validity of meta info. - let mut registry = juniper::Registry::new(HashMap::new()); + let mut registry = juniper::Registry::new(FnvHashMap::default()); let meta = SomeEnum::meta(&(), &mut registry); assert_eq!(meta.name(), Some("Some")); diff --git a/juniper_tests/src/codegen/derive_input_object.rs b/juniper_tests/src/codegen/derive_input_object.rs index c275c563..57c24556 100644 --- a/juniper_tests/src/codegen/derive_input_object.rs +++ b/juniper_tests/src/codegen/derive_input_object.rs @@ -1,5 +1,5 @@ #[cfg(test)] -use std::collections::HashMap; +use fnv::FnvHashMap; #[cfg(test)] use juniper::{self, FromInputValue, GraphQLType, ToInputValue}; @@ -17,7 +17,7 @@ fn test_derived_input_object() { assert_eq!(Input::name(&()), Some("MyInput")); // Validate meta info. - let mut registry = juniper::Registry::new(HashMap::new()); + let mut registry = juniper::Registry::new(FnvHashMap::default()); let meta = Input::meta(&(), &mut registry); assert_eq!(meta.name(), Some("MyInput")); assert_eq!(meta.description(), Some(&"input descr".to_string())); diff --git a/juniper_tests/src/codegen/derive_object.rs b/juniper_tests/src/codegen/derive_object.rs index 63da87f4..84a9580b 100644 --- a/juniper_tests/src/codegen/derive_object.rs +++ b/juniper_tests/src/codegen/derive_object.rs @@ -1,5 +1,5 @@ #[cfg(test)] -use std::collections::HashMap; +use fnv::FnvHashMap; #[cfg(test)] use juniper::{self, execute, EmptyMutation, GraphQLType, RootNode, Value, Variables}; @@ -28,7 +28,7 @@ fn test_derived_object() { assert_eq!(Obj::name(&()), Some("MyObj")); // Verify meta info. - let mut registry = juniper::Registry::new(HashMap::new()); + let mut registry = juniper::Registry::new(FnvHashMap::default()); let meta = Obj::meta(&(), &mut registry); assert_eq!(meta.name(), Some("MyObj")); diff --git a/juniper_tests/src/lib.rs b/juniper_tests/src/lib.rs index 7da268b4..6f0a6e98 100644 --- a/juniper_tests/src/lib.rs +++ b/juniper_tests/src/lib.rs @@ -4,4 +4,7 @@ extern crate juniper; extern crate juniper_codegen; extern crate serde_json; +#[cfg(test)] +extern crate fnv; + mod codegen;