Even even more range cleanup

This commit is contained in:
Steven Fackler 2014-01-01 22:22:10 -08:00
parent f537a6125e
commit 5e7bfe514a
4 changed files with 13 additions and 22 deletions

1
lib.rs
View File

@ -62,6 +62,7 @@ fn main() {
#[warn(missing_doc)];
#[feature(macro_rules, struct_variant, globs)];
#[macro_escape];
extern mod extra;
extern mod openssl = "github.com/sfackler/rust-openssl";

32
test.rs
View File

@ -366,32 +366,20 @@ fn test_tm_params() {
macro_rules! test_range(
($name:expr, $t:ty, $low:expr, $low_str:expr, $high:expr, $high_str:expr) => ({
let tests = [(Some(Range::new(None, None)), ~"'(,)'"),
(Some(Range::new(Some(RangeBound::new($low, Inclusive)),
None)),
"'[" + $low_str + ",)'"),
(Some(Range::new(Some(RangeBound::new($low, Exclusive)),
None)),
"'(" + $low_str + ",)'"),
(Some(Range::new(None,
Some(RangeBound::new($high, Inclusive)))),
"'(," + $high_str + "]'"),
(Some(Range::new(None,
Some(RangeBound::new($high, Exclusive)))),
"'(," + $high_str + ")'"),
(Some(Range::new(Some(RangeBound::new($low, Inclusive)),
Some(RangeBound::new($high, Inclusive)))),
let tests = [(Some(range!('(', ')')), ~"'(,)'"),
(Some(range!('[' $low, ')')), "'[" + $low_str + ",)'"),
(Some(range!('(' $low, ')')), "'(" + $low_str + ",)'"),
(Some(range!('(', $high ']')), "'(," + $high_str + "]'"),
(Some(range!('(', $high ')')), "'(," + $high_str + ")'"),
(Some(range!('[' $low, $high ']')),
"'[" + $low_str + "," + $high_str + "]'"),
(Some(Range::new(Some(RangeBound::new($low, Inclusive)),
Some(RangeBound::new($high, Exclusive)))),
(Some(range!('[' $low, $high ')')),
"'[" + $low_str + "," + $high_str + ")'"),
(Some(Range::new(Some(RangeBound::new($low, Exclusive)),
Some(RangeBound::new($high, Inclusive)))),
(Some(range!('(' $low, $high ']')),
"'(" + $low_str + "," + $high_str + "]'"),
(Some(Range::new(Some(RangeBound::new($low, Exclusive)),
Some(RangeBound::new($high, Exclusive)))),
(Some(range!('(' $low, $high ')')),
"'(" + $low_str + "," + $high_str + ")'"),
(Some(Range::empty()), ~"'empty'"),
(Some(range!(empty)), ~"'empty'"),
(None, ~"NULL")];
test_type($name, tests);
})

View File

@ -1,4 +1,5 @@
//! Traits dealing with Postgres data types
#[macro_escape];
extern mod extra;

View File

@ -1,4 +1,5 @@
//! Types dealing with ranges of values
#[macro_escape];
extern mod extra;