Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 19, 2018
1 parent bf3d40a commit 53e92f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/librustc_data_structures/snapshot_map/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use super::SnapshotMap;

#[test]
fn basic() {
let mut map = SnapshotMap::new();
let mut map = SnapshotMap::default();
map.insert(22, "twenty-two");
let snapshot = map.snapshot();
map.insert(22, "thirty-three");
Expand All @@ -29,7 +29,7 @@ fn basic() {
#[test]
#[should_panic]
fn out_of_order() {
let mut map = SnapshotMap::new();
let mut map = SnapshotMap::default();
map.insert(22, "twenty-two");
let snapshot1 = map.snapshot();
let _snapshot2 = map.snapshot();
Expand All @@ -38,7 +38,7 @@ fn out_of_order() {

#[test]
fn nested_commit_then_rollback() {
let mut map = SnapshotMap::new();
let mut map = SnapshotMap::default();
map.insert(22, "twenty-two");
let snapshot1 = map.snapshot();
let snapshot2 = map.snapshot();
Expand Down
32 changes: 16 additions & 16 deletions src/librustc_data_structures/transitive_relation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ impl<CTX> HashStable<CTX> for Index {

#[test]
fn test_one_step() {
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "b");
relation.add("a", "c");
assert!(relation.contains(&"a", &"c"));
Expand All @@ -500,7 +500,7 @@ fn test_one_step() {

#[test]
fn test_many_steps() {
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "b");
relation.add("a", "c");
relation.add("a", "f");
Expand Down Expand Up @@ -530,7 +530,7 @@ fn mubs_triangle() {
// ^
// |
// b
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "tcx");
relation.add("b", "tcx");
assert_eq!(relation.minimal_upper_bounds(&"a", &"b"), vec![&"tcx"]);
Expand All @@ -551,7 +551,7 @@ fn mubs_best_choice1() {
// need the second pare down call to get the right result (after
// intersection, we have [1, 2], but 2 -> 1).

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("0", "1");
relation.add("0", "2");

Expand All @@ -578,7 +578,7 @@ fn mubs_best_choice2() {
// Like the precedecing test, but in this case intersection is [2,
// 1], and hence we rely on the first pare down call.

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("0", "1");
relation.add("0", "2");

Expand All @@ -597,7 +597,7 @@ fn mubs_best_choice2() {
fn mubs_no_best_choice() {
// in this case, the intersection yields [1, 2], and the "pare
// down" calls find nothing to remove.
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("0", "1");
relation.add("0", "2");

Expand All @@ -614,7 +614,7 @@ fn mubs_best_choice_scc() {
// in this case, 1 and 2 form a cycle; we pick arbitrarily (but
// consistently).

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("0", "1");
relation.add("0", "2");

Expand All @@ -636,7 +636,7 @@ fn pdub_crisscross() {
// /\ |
// b -> b1 ---+

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "a1");
relation.add("a", "b1");
relation.add("b", "a1");
Expand All @@ -659,7 +659,7 @@ fn pdub_crisscross_more() {
// /\ /\ |
// b -> b1 -> b2 ---------+

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "a1");
relation.add("a", "b1");
relation.add("b", "a1");
Expand Down Expand Up @@ -692,7 +692,7 @@ fn pdub_lub() {
// |
// b -> b1 ---+

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "a1");
relation.add("b", "b1");
relation.add("a1", "x");
Expand All @@ -715,7 +715,7 @@ fn mubs_intermediate_node_on_one_side_only() {
// b

// "digraph { a -> c -> d; b -> d; }",
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "c");
relation.add("c", "d");
relation.add("b", "d");
Expand All @@ -734,7 +734,7 @@ fn mubs_scc_1() {
// b

// "digraph { a -> c -> d; d -> c; a -> d; b -> d; }",
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "c");
relation.add("c", "d");
relation.add("d", "c");
Expand All @@ -754,7 +754,7 @@ fn mubs_scc_2() {
// +--- b

// "digraph { a -> c -> d; d -> c; b -> d; b -> c; }",
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "c");
relation.add("c", "d");
relation.add("d", "c");
Expand All @@ -774,7 +774,7 @@ fn mubs_scc_3() {
// b ---+

// "digraph { a -> c -> d -> e -> c; b -> d; b -> e; }",
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "c");
relation.add("c", "d");
relation.add("d", "e");
Expand All @@ -796,7 +796,7 @@ fn mubs_scc_4() {
// b ---+

// "digraph { a -> c -> d -> e -> c; a -> d; b -> e; }"
let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
relation.add("a", "c");
relation.add("c", "d");
relation.add("d", "e");
Expand Down Expand Up @@ -834,7 +834,7 @@ fn parent() {
(1, /*->*/ 3),
];

let mut relation = TransitiveRelation::new();
let mut relation = TransitiveRelation::default();
for (a, b) in pairs {
relation.add(a, b);
}
Expand Down

0 comments on commit 53e92f4

Please sign in to comment.