Move the test suite to the "as" form for casts. XFAIL a few tests for LLVM.
This commit is contained in:
parent
ec5efd2577
commit
4b97b4e79d
@ -468,6 +468,10 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
|
||||
task-comm-5.rs \
|
||||
threads.rs \
|
||||
type-sizes.rs \
|
||||
u8-incr.rs \
|
||||
u8-incr-decr.rs \
|
||||
u32-decr.rs \
|
||||
uint.rs \
|
||||
unit.rs \
|
||||
use-import-export.rs \
|
||||
user.rs \
|
||||
|
@ -5,12 +5,12 @@
|
||||
fn main() {
|
||||
let str s = "hello";
|
||||
let int x = 0;
|
||||
check (s.(x) == u8(0x68));
|
||||
check (s.(x) == (0x68 as u8));
|
||||
|
||||
// NB: at the moment a string always has a trailing NULL,
|
||||
// so the largest index value on the string above is 5, not
|
||||
// 4. Possibly change this.
|
||||
|
||||
// Bounds-check failure.
|
||||
check (s.(x + 6) == u8(0x0));
|
||||
check (s.(x + 6) == (0x0 as u8));
|
||||
}
|
||||
|
@ -2,15 +2,15 @@
|
||||
|
||||
|
||||
fn main() {
|
||||
let int i = int('Q');
|
||||
let int i = 'Q' as int;
|
||||
check (i == 0x51);
|
||||
let u32 u = u32(i);
|
||||
check (u == u32(0x51));
|
||||
check (u == u32('Q'));
|
||||
check (i8(i) == i8('Q'));
|
||||
check (i8(u8(i)) == i8(u8('Q')));
|
||||
check (char(0x51) == 'Q');
|
||||
let u32 u = i as u32;
|
||||
check (u == (0x51 as u32));
|
||||
check (u == ('Q' as u32));
|
||||
check ((i as u8) == ('Q' as u8));
|
||||
check (((i as u8) as i8) == (('Q' as u8) as i8));
|
||||
check ((0x51 as char) == 'Q');
|
||||
|
||||
check (true == bool(1));
|
||||
check (u32(0) == u32(false));
|
||||
check (true == (1 as bool));
|
||||
check ((0 as u32) == (false as u32));
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ obj handle[T](T data) {
|
||||
|
||||
fn main() {
|
||||
type rgb = tup(u8,u8,u8);
|
||||
let handle[rgb] h = handle[rgb](tup(u8(1), u8(2), u8(3)));
|
||||
let handle[rgb] h = handle[rgb](tup(1 as u8, 2 as u8, 3 as u8));
|
||||
log "constructed object";
|
||||
log h.get()._0;
|
||||
log h.get()._1;
|
||||
log h.get()._2;
|
||||
check (h.get()._0 == u8(1));
|
||||
check (h.get()._1 == u8(2));
|
||||
check (h.get()._2 == u8(3));
|
||||
check (h.get()._0 == (1 as u8));
|
||||
check (h.get()._1 == (2 as u8));
|
||||
check (h.get()._2 == (3 as u8));
|
||||
}
|
||||
|
@ -12,23 +12,23 @@ fn main() {
|
||||
let int i = 0;
|
||||
for (u8 c in s) {
|
||||
if (i == 0) {
|
||||
check (c == u8('h'));
|
||||
check (c == ('h' as u8));
|
||||
}
|
||||
if (i == 1) {
|
||||
check (c == u8('e'));
|
||||
check (c == ('e' as u8));
|
||||
}
|
||||
if (i == 2) {
|
||||
check (c == u8('l'));
|
||||
check (c == ('l' as u8));
|
||||
}
|
||||
if (i == 3) {
|
||||
check (c == u8('l'));
|
||||
check (c == ('l' as u8));
|
||||
}
|
||||
if (i == 4) {
|
||||
check (c == u8('o'));
|
||||
check (c == ('o' as u8));
|
||||
}
|
||||
// ...
|
||||
if (i == 12) {
|
||||
check (c == u8(0));
|
||||
check (c == (0 as u8));
|
||||
}
|
||||
i += 1;
|
||||
log i;
|
||||
|
@ -13,5 +13,5 @@ fn main() {
|
||||
grow(v);
|
||||
auto len = std._vec.len[int](v);
|
||||
log len;
|
||||
check (len == uint(3));
|
||||
check (len == (3 as uint));
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ fn main() {
|
||||
ret data.(i);
|
||||
}
|
||||
}
|
||||
auto b = buf(vec(u8(1), u8(2), u8(3)));
|
||||
auto b = buf(vec(1 as u8, 2 as u8, 3 as u8));
|
||||
log b.get(1);
|
||||
check (b.get(1) == u8(2));
|
||||
}
|
||||
check (b.get(1) == (2 as u8));
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ fn main() {
|
||||
let str s = "hello";
|
||||
s += "world";
|
||||
log s;
|
||||
check(s.(9) == u8('d'));
|
||||
check(s.(9) == ('d' as u8));
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ fn main() {
|
||||
let str b = "world";
|
||||
let str s = a + b;
|
||||
log s;
|
||||
check(s.(9) == u8('d'));
|
||||
check(s.(9) == ('d' as u8));
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ fn main() {
|
||||
auto s = "hello";
|
||||
let u8 c = s.(4);
|
||||
log c;
|
||||
check (c == u8(0x6f));
|
||||
check (c == (0x6f as u8));
|
||||
}
|
||||
|
@ -4,15 +4,15 @@ import size_of = std.sys.rustrt.size_of;
|
||||
use std;
|
||||
|
||||
fn main() {
|
||||
check (size_of[u8]() == uint(1));
|
||||
check (size_of[u32]() == uint(4));
|
||||
check (size_of[char]() == uint(4));
|
||||
check (size_of[i8]() == uint(1));
|
||||
check (size_of[i32]() == uint(4));
|
||||
check (size_of[tup(u8,i8)]() == uint(2));
|
||||
check (size_of[tup(u8,i8,u8)]() == uint(3));
|
||||
check (size_of[u8]() == (1 as uint));
|
||||
check (size_of[u32]() == (4 as uint));
|
||||
check (size_of[char]() == (4 as uint));
|
||||
check (size_of[i8]() == (1 as uint));
|
||||
check (size_of[i32]() == (4 as uint));
|
||||
check (size_of[tup(u8,i8)]() == (2 as uint));
|
||||
check (size_of[tup(u8,i8,u8)]() == (3 as uint));
|
||||
// Alignment causes padding before the char and the u32.
|
||||
check (size_of[tup(u8,i8,tup(char,u8),u32)]() == uint(16));
|
||||
check (size_of[tup(u8,i8,tup(char,u8),u32)]() == (16 as uint));
|
||||
check (size_of[int]() == size_of[uint]());
|
||||
check (size_of[tup(int,())]() == size_of[int]());
|
||||
check (size_of[tup(int,(),())]() == size_of[int]());
|
||||
|
@ -1,8 +1,8 @@
|
||||
// -*- rust -*-
|
||||
|
||||
fn main() {
|
||||
let u32 word = u32(200000);
|
||||
word = word - u32(1);
|
||||
check(word == u32(199999));
|
||||
let u32 word = (200000 as u32);
|
||||
word = word - (1 as u32);
|
||||
check(word == (199999 as u32));
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
// in the rest of the generated code so they're easily grep-able.
|
||||
|
||||
fn main() {
|
||||
let u8 x = u8(19); // 0x13
|
||||
let u8 y = u8(35); // 0x23
|
||||
x = x + u8(7); // 0x7
|
||||
y = y - u8(9); // 0x9
|
||||
let u8 x = 19 as u8; // 0x13
|
||||
let u8 y = 35 as u8; // 0x23
|
||||
x = x + (7 as u8); // 0x7
|
||||
y = y - (9 as u8); // 0x9
|
||||
check(x == y);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
// -*- rust -*-
|
||||
|
||||
fn main() {
|
||||
let u8 x = u8(12);
|
||||
let u8 y = u8(12);
|
||||
x = x + u8(1);
|
||||
x = x - u8(1);
|
||||
let u8 x = 12 as u8;
|
||||
let u8 y = 12 as u8;
|
||||
x = x + (1 as u8);
|
||||
x = x - (1 as u8);
|
||||
check(x == y);
|
||||
//x = u8(14);
|
||||
//x = x + u8(1);
|
||||
//x = 14 as u8;
|
||||
//x = x + 1 as u8;
|
||||
}
|
||||
|
||||
|
@ -2,5 +2,5 @@
|
||||
|
||||
|
||||
fn main() {
|
||||
let uint x = uint(10);
|
||||
let uint x = 10 as uint;
|
||||
}
|
||||
|
@ -5,10 +5,10 @@ use std (name = "std",
|
||||
uuid = _, ver = _);
|
||||
|
||||
fn main() {
|
||||
auto s = std._str.alloc(uint(10));
|
||||
auto s = std._str.alloc(10 as uint);
|
||||
s += "hello ";
|
||||
log s;
|
||||
s += "there";
|
||||
log s;
|
||||
auto z = std._vec.alloc[int](uint(10));
|
||||
auto z = std._vec.alloc[int](10 as uint);
|
||||
}
|
||||
|
@ -5,14 +5,14 @@ fn main() {
|
||||
let char y_diaeresis = 'ÿ'; // 0xff
|
||||
let char pi = 'Π'; // 0x3a0
|
||||
|
||||
check (int(yen) == 0xa5);
|
||||
check (int(c_cedilla) == 0xe7);
|
||||
check (int(thorn) == 0xfe);
|
||||
check (int(y_diaeresis) == 0xff);
|
||||
check (int(pi) == 0x3a0);
|
||||
check ((yen as int) == 0xa5);
|
||||
check ((c_cedilla as int) == 0xe7);
|
||||
check ((thorn as int) == 0xfe);
|
||||
check ((y_diaeresis as int) == 0xff);
|
||||
check ((pi as int) == 0x3a0);
|
||||
|
||||
check (int(pi) == int('\u03a0'));
|
||||
check (int('\x0a') == int('\n'));
|
||||
check ((pi as int) == ('\u03a0' as int));
|
||||
check (('\x0a' as int) == ('\n' as int));
|
||||
|
||||
let str bhutan = "འབྲུག་ཡུལ།";
|
||||
let str japan = "日本";
|
||||
@ -27,7 +27,7 @@ fn main() {
|
||||
let str austria_e = "\u00d6sterreich";
|
||||
|
||||
let char oo = 'Ö';
|
||||
check (int(oo) == 0xd6);
|
||||
check ((oo as int) == 0xd6);
|
||||
|
||||
fn check_str_eq(str a, str b) {
|
||||
let int i = 0;
|
||||
@ -45,4 +45,4 @@ fn main() {
|
||||
check_str_eq(japan, japan_e);
|
||||
check_str_eq(uzbekistan, uzbekistan_e);
|
||||
check_str_eq(austria, austria_e);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
use std;
|
||||
|
||||
fn slice[T](vec[T] e) {
|
||||
let vec[T] result = std._vec.alloc[T](uint(1));
|
||||
let vec[T] result = std._vec.alloc[T](1 as uint);
|
||||
log "alloced";
|
||||
result += e;
|
||||
log "appended";
|
||||
|
@ -1,11 +1,11 @@
|
||||
use std;
|
||||
|
||||
fn test_init_elt() {
|
||||
let vec[uint] v = std._vec.init_elt[uint](uint(5), uint(3));
|
||||
check (std._vec.len[uint](v) == uint(3));
|
||||
check (v.(0) == uint(5));
|
||||
check (v.(1) == uint(5));
|
||||
check (v.(2) == uint(5));
|
||||
let vec[uint] v = std._vec.init_elt[uint](5 as uint, 3 as uint);
|
||||
check (std._vec.len[uint](v) == (3 as uint));
|
||||
check (v.(0) == (5 as uint));
|
||||
check (v.(1) == (5 as uint));
|
||||
check (v.(2) == (5 as uint));
|
||||
}
|
||||
|
||||
fn id(uint x) -> uint {
|
||||
@ -13,19 +13,19 @@ fn id(uint x) -> uint {
|
||||
}
|
||||
fn test_init_fn() {
|
||||
let fn(uint)->uint op = id;
|
||||
let vec[uint] v = std._vec.init_fn[uint](op, uint(5));
|
||||
check (std._vec.len[uint](v) == uint(5));
|
||||
check (v.(0) == uint(0));
|
||||
check (v.(1) == uint(1));
|
||||
check (v.(2) == uint(2));
|
||||
check (v.(3) == uint(3));
|
||||
check (v.(4) == uint(4));
|
||||
let vec[uint] v = std._vec.init_fn[uint](op, (5 as uint));
|
||||
check (std._vec.len[uint](v) == (5 as uint));
|
||||
check (v.(0) == (0 as uint));
|
||||
check (v.(1) == (1 as uint));
|
||||
check (v.(2) == (2 as uint));
|
||||
check (v.(3) == (3 as uint));
|
||||
check (v.(4) == (4 as uint));
|
||||
}
|
||||
|
||||
fn test_slice() {
|
||||
let vec[int] v = vec(1,2,3,4,5);
|
||||
auto v2 = std._vec.slice[int](v, 2, 4);
|
||||
check (std._vec.len[int](v2) == uint(2));
|
||||
check (std._vec.len[int](v2) == (2 as uint));
|
||||
check (v2.(0) == 3);
|
||||
check (v2.(1) == 4);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user