Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test BTree a bit more #631

Merged
merged 3 commits into from
Feb 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2019-02-15
nightly-2019-02-24
15 changes: 14 additions & 1 deletion tests/run-pass/btreemap.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::{BTreeMap, BTreeSet};

#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub enum Foo {
A(&'static str),
Expand All @@ -6,11 +8,22 @@ pub enum Foo {
}

pub fn main() {
let mut b = std::collections::BTreeSet::new();
let mut b = BTreeSet::new();
b.insert(Foo::A("\'"));
b.insert(Foo::A("/="));
b.insert(Foo::A("#"));
b.insert(Foo::A("0o"));
assert!(b.remove(&Foo::A("/=")));
assert!(!b.remove(&Foo::A("/=")));

// Also test a lower-alignment type, where the NodeHeader overlaps with
// the keys.
let mut b = BTreeSet::new();
b.insert(1024);
b.insert(7);

let mut b = BTreeMap::new();
b.insert("bar", 1024);
b.insert("baz", 7);
for _val in b.iter_mut() {}
}