From 5976869b0a61fa2e0d4405711c7d9a05f9b3ee1b Mon Sep 17 00:00:00 2001 From: Grisha Kruglov Date: Wed, 8 Aug 2018 17:37:03 -0700 Subject: [PATCH] Post: Make tests pass on Rust 1.25.0 For some reason, the converted doc test fails on Rust 1.25.0, while working with other Rust versions. For simplicity, just convert it into a regular test. --- core/src/sql_types.rs | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/core/src/sql_types.rs b/core/src/sql_types.rs index 7f267b9b..e32d01f9 100644 --- a/core/src/sql_types.rs +++ b/core/src/sql_types.rs @@ -68,19 +68,6 @@ impl SQLValueType for ValueType { /// Returns true if the provided integer is in the SQLite value space of this type. For /// example, `1` is how we encode `true`. - /// - /// ``` - /// extern crate core_traits; - /// extern crate mentat_core; - /// use core_traits::ValueType; - /// use mentat_core::SQLValueType; - /// assert!(!ValueType::Instant.accommodates_integer(1493399581314)); - /// assert!(!ValueType::Instant.accommodates_integer(1493399581314000)); - /// assert!(ValueType::Boolean.accommodates_integer(1)); - /// assert!(!ValueType::Boolean.accommodates_integer(-1)); - /// assert!(!ValueType::Boolean.accommodates_integer(10)); - /// assert!(!ValueType::String.accommodates_integer(10)); - /// ``` fn accommodates_integer(&self, int: i64) -> bool { use ValueType::*; match *self { @@ -140,3 +127,23 @@ impl SQLValueTypeSet for ValueTypeSet { !acc.is_empty() } } + +#[cfg(test)] +mod tests { + use core_traits::{ + ValueType, + }; + use sql_types::{ + SQLValueType, + }; + + #[test] + fn test_accommodates_integer() { + assert!(!ValueType::Instant.accommodates_integer(1493399581314)); + assert!(!ValueType::Instant.accommodates_integer(1493399581314000)); + assert!(ValueType::Boolean.accommodates_integer(1)); + assert!(!ValueType::Boolean.accommodates_integer(-1)); + assert!(!ValueType::Boolean.accommodates_integer(10)); + assert!(!ValueType::String.accommodates_integer(10)); + } +}