Skip to content

Commit 922eb47

Browse files
committed
test: Use #[deriving(Hash)] in a couple tests
1 parent 848cbb4 commit 922eb47

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/test/run-pass/deriving-global.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,21 @@ mod submod {
2727
// function calls, then being in a submodule will (correctly)
2828
// cause errors about unrecognised module `std` (or `extra`)
2929
#[deriving(Eq, Ord, TotalEq, TotalOrd,
30+
Hash,
3031
Clone, DeepClone,
3132
Show, Rand,
3233
Encodable, Decodable)]
3334
enum A { A1(uint), A2(int) }
3435

3536
#[deriving(Eq, Ord, TotalEq, TotalOrd,
37+
Hash,
3638
Clone, DeepClone,
3739
Show, Rand,
3840
Encodable, Decodable)]
3941
struct B { x: uint, y: int }
4042

4143
#[deriving(Eq, Ord, TotalEq, TotalOrd,
44+
Hash,
4245
Clone, DeepClone,
4346
Show, Rand,
4447
Encodable, Decodable)]

src/test/run-pass/deriving-meta-multiple.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
// option. This file may not be copied, modified, or distributed
1111
// except according to those terms.
1212

13-
#[deriving(Eq)]
14-
#[deriving(Clone)]
13+
use std::hash::hash;
14+
15+
#[deriving(Eq, Clone, Hash)]
1516
struct Foo {
1617
bar: uint,
1718
baz: int
@@ -22,4 +23,5 @@ pub fn main() {
2223

2324
a == a; // check for Eq impl w/o testing its correctness
2425
a.clone(); // check for Clone impl w/o testing its correctness
26+
hash(&a); // check for Hash impl w/o testing its correctness
2527
}

src/test/run-pass/deriving-meta.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
// option. This file may not be copied, modified, or distributed
1111
// except according to those terms.
1212

13-
#[deriving(Eq, Clone)]
13+
use std::hash::hash;
14+
15+
#[deriving(Eq, Clone, Hash)]
1416
struct Foo {
1517
bar: uint,
1618
baz: int
@@ -21,4 +23,5 @@ pub fn main() {
2123

2224
a == a; // check for Eq impl w/o testing its correctness
2325
a.clone(); // check for Clone impl w/o testing its correctness
26+
hash(&a); // check for Hash impl w/o testing its correctness
2427
}

0 commit comments

Comments
 (0)