diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-06 22:39:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-06 22:39:09 +0200 |
| commit | 654854fdb56ca204bab6b399bf59a8d753e2c13c (patch) | |
| tree | 5dd54e15d68f2e2d1d0c6ea6c84f92774f18b88d /src/libcore/tests | |
| parent | 8b36867093fb774bcbd9f787cbc470a5f44c1310 (diff) | |
| parent | c1bc8f11cb36cade87422b91a0bdec1fe8b5af41 (diff) | |
| download | rust-654854fdb56ca204bab6b399bf59a8d753e2c13c.tar.gz rust-654854fdb56ca204bab6b399bf59a8d753e2c13c.zip | |
Rollup merge of #61376 - czipperz:bound-cloned, r=sfackler
Add Bound::cloned() Suggested by #61356
Diffstat (limited to 'src/libcore/tests')
| -rw-r--r-- | src/libcore/tests/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/tests/ops.rs | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 5050842e409..928bdd7a760 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -1,3 +1,4 @@ +#![feature(bound_cloned)] #![feature(box_syntax)] #![feature(cell_update)] #![feature(core_private_bignum)] diff --git a/src/libcore/tests/ops.rs b/src/libcore/tests/ops.rs index 78cf07119e7..48755ae4c16 100644 --- a/src/libcore/tests/ops.rs +++ b/src/libcore/tests/ops.rs @@ -1,4 +1,4 @@ -use core::ops::{Range, RangeFull, RangeFrom, RangeTo, RangeInclusive}; +use core::ops::{Bound, Range, RangeFull, RangeFrom, RangeTo, RangeInclusive}; // Test the Range structs without the syntactic sugar. @@ -82,3 +82,18 @@ fn test_range_is_empty() { assert!( (NAN ..= EPSILON).is_empty()); assert!( (NAN ..= NAN).is_empty()); } + +#[test] +fn test_bound_cloned_unbounded() { + assert_eq!(Bound::<&u32>::Unbounded.cloned(), Bound::Unbounded); +} + +#[test] +fn test_bound_cloned_included() { + assert_eq!(Bound::Included(&3).cloned(), Bound::Included(3)); +} + +#[test] +fn test_bound_cloned_excluded() { + assert_eq!(Bound::Excluded(&3).cloned(), Bound::Excluded(3)); +} |
