Skip to content

Commit 0db2b19

Browse files
committed
Add a test case for the preceding changes.
This would have failed on 32-to-64-bit cross-compiles.
1 parent 5f536ef commit 0db2b19

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use std::sys;
12+
13+
pub fn main() {
14+
enum E { V = 0x1717171717171717 }
15+
static C: E = V;
16+
let expected: u64 = if sys::size_of::<uint>() < 8 {
17+
0x17171717
18+
} else {
19+
0x1717171717171717
20+
};
21+
assert_eq!(expected, V as u64);
22+
assert_eq!(expected, C as u64);
23+
assert_eq!(fmt!("%?", V), ~"V");
24+
assert_eq!(fmt!("%?", C), ~"V");
25+
}

0 commit comments

Comments
 (0)