test: More run-pass test fixes
This commit is contained in:
parent
7a065f2434
commit
6084032270
@ -13,7 +13,7 @@ struct cat {
|
||||
}
|
||||
|
||||
impl cat : ToStr {
|
||||
pure fn to_str() -> ~str { self.name }
|
||||
pure fn to_str() -> ~str { copy self.name }
|
||||
}
|
||||
|
||||
priv impl cat {
|
||||
|
@ -12,5 +12,5 @@ type header_map = HashMap<~str, @DVec<@~str>>;
|
||||
|
||||
// the unused ty param is necessary so this gets monomorphized
|
||||
fn request<T: Copy>(req: header_map) {
|
||||
let _x = *(*req.get(~"METHOD"))[0u];
|
||||
let _x = *(copy *req.get(~"METHOD"))[0u];
|
||||
}
|
||||
|
@ -6,5 +6,5 @@ trait to_strz {
|
||||
}
|
||||
|
||||
impl ~str: to_strz {
|
||||
fn to_strz() -> ~str { self }
|
||||
fn to_strz() -> ~str { copy self }
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ pub struct MyInt {
|
||||
}
|
||||
|
||||
pub impl MyInt : Add<MyInt, MyInt> {
|
||||
pure fn add(other: &MyInt) -> MyInt { mi(self.val + other.val) }
|
||||
pure fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) }
|
||||
}
|
||||
|
||||
pub impl MyInt : Sub<MyInt, MyInt> {
|
||||
|
@ -1,6 +1,8 @@
|
||||
fn main() {
|
||||
let x = ~{mut a: ~10, b: ~20};
|
||||
match x {
|
||||
~{ref a, ref b} => { assert **a == 10; (*x).a = ~30; assert **a == 30; }
|
||||
~{a: ref a, b: ref b} => {
|
||||
assert **a == 10; (*x).a = ~30; assert **a == 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ fn main() {
|
||||
match getopts(args, opts) {
|
||||
result::Ok(ref m) =>
|
||||
assert !opt_present(m, "b"),
|
||||
result::Err(f) => fail fail_str(f)
|
||||
result::Err(ref f) => fail fail_str(*f)
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ fn a_val(&&x: ~int, +y: ~int) -> int {
|
||||
|
||||
fn main() {
|
||||
let z = ~22;
|
||||
a_val(z, z);
|
||||
a_val(copy z, copy z);
|
||||
}
|
||||
|
@ -17,5 +17,5 @@ fn nyan(kitty: cat, _kitty_info: kitty_info) {
|
||||
|
||||
fn main() {
|
||||
let mut kitty = cat();
|
||||
nyan(kitty, {kitty: kitty});
|
||||
nyan(copy kitty, {kitty: copy kitty});
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ fn lookup(table: ~json::Object, key: ~str, default: ~str) -> ~str
|
||||
{
|
||||
match table.find(&key)
|
||||
{
|
||||
option::Some(std::json::String(s)) =>
|
||||
option::Some(std::json::String(copy s)) =>
|
||||
{
|
||||
s
|
||||
copy s
|
||||
}
|
||||
option::Some(value) =>
|
||||
{
|
||||
@ -33,9 +33,9 @@ fn add_interface(store: int, managed_ip: ~str, data: std::json::Json) -> (~str,
|
||||
{
|
||||
match &data
|
||||
{
|
||||
&std::json::Object(interface) =>
|
||||
&std::json::Object(copy interface) =>
|
||||
{
|
||||
let name = lookup(interface, ~"ifDescr", ~"");
|
||||
let name = lookup(copy interface, ~"ifDescr", ~"");
|
||||
let label = fmt!("%s-%s", managed_ip, name);
|
||||
|
||||
(label, bool_value(false))
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn test_stack_assign() {
|
||||
let s: ~str = ~"a";
|
||||
log(debug, s);
|
||||
log(debug, copy s);
|
||||
let t: ~str = ~"a";
|
||||
assert (s == t);
|
||||
let u: ~str = ~"b";
|
||||
@ -39,7 +39,7 @@ fn test_append() {
|
||||
|
||||
let mut s = ~"a";
|
||||
s += ~"b";
|
||||
log(debug, s);
|
||||
log(debug, copy s);
|
||||
assert (s == ~"ab");
|
||||
|
||||
let mut s = ~"c";
|
||||
|
@ -21,7 +21,7 @@ fn main() {
|
||||
// Check that no false positives are found in loops.
|
||||
let mut q = ~40, p = 10;
|
||||
loop {
|
||||
let i = q;
|
||||
let i = copy q;
|
||||
p += *i;
|
||||
if p > 100 { break; }
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
fn foo() -> fn@() -> int {
|
||||
let k = ~22;
|
||||
let _u = {a: k};
|
||||
let _u = {a: copy k};
|
||||
return fn@(move k) -> int { 22 };
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,6 @@
|
||||
fn main() {
|
||||
fn invoke(f: fn@()) { f(); }
|
||||
let k = ~22;
|
||||
let _u = {a: k};
|
||||
let _u = {a: copy k};
|
||||
invoke(|| log(error, k) )
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ fn runtest2(f: fn~(), frame_backoff: u32, last_stk: *u8) -> u32 {
|
||||
// We switched stacks, go back and try to hit the dynamic linker
|
||||
frame_backoff
|
||||
} else {
|
||||
let frame_backoff = runtest2(f, frame_backoff, curr_stk);
|
||||
let frame_backoff = runtest2(copy f, frame_backoff, curr_stk);
|
||||
if frame_backoff > 1u32 {
|
||||
frame_backoff - 1u32
|
||||
} else if frame_backoff == 1u32 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
enum myvec<X> = ~[X];
|
||||
|
||||
fn myvec_deref<X: Copy>(mv: myvec<X>) -> ~[X] { return *mv; }
|
||||
fn myvec_deref<X: Copy>(mv: myvec<X>) -> ~[X] { return copy *mv; }
|
||||
|
||||
fn myvec_elt<X: Copy>(mv: myvec<X>) -> X { return mv[0]; }
|
||||
|
||||
|
@ -7,7 +7,7 @@ struct Point {
|
||||
}
|
||||
|
||||
impl Point : ops::Add<Point,Point> {
|
||||
pure fn add(other: &Point) -> Point {
|
||||
pure fn add(&self, other: &Point) -> Point {
|
||||
Point {x: self.x + (*other).x, y: self.y + (*other).y}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,6 @@
|
||||
// Issue #50.
|
||||
fn main() {
|
||||
let x = {foo: ~"hello", bar: ~"world"};
|
||||
log(debug, x.foo);
|
||||
log(debug, x.bar);
|
||||
log(debug, copy x.foo);
|
||||
log(debug, copy x.bar);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ fn find_pos<T:Eq>(n: T, h: ~[T]) -> Option<uint> {
|
||||
|
||||
fn bail_deep(x: ~[~[bool]]) {
|
||||
let mut seen = false;
|
||||
for iter(x) |x| {
|
||||
for iter(x) |x| {
|
||||
for iter(copy x) |x| {
|
||||
for iter(copy x) |x| {
|
||||
assert !seen;
|
||||
if x { seen = true; return; }
|
||||
}
|
||||
|
@ -16,12 +16,12 @@ fn make_generic_record<A: Copy, B: Copy>(a: A, b: B) -> pair<A,B> {
|
||||
|
||||
fn test05_start(&&f: fn~(&&v: float, &&v: ~str) -> pair<float, ~str>) {
|
||||
let p = f(22.22f, ~"Hi");
|
||||
log(debug, p);
|
||||
log(debug, copy p);
|
||||
assert p.a == 22.22f;
|
||||
assert p.b == ~"Hi";
|
||||
|
||||
let q = f(44.44f, ~"Ho");
|
||||
log(debug, q);
|
||||
log(debug, copy q);
|
||||
assert q.a == 44.44f;
|
||||
assert q.b == ~"Ho";
|
||||
}
|
||||
|
@ -25,6 +25,6 @@ fn main() {
|
||||
let p_: path_ = { global: true, idents: ~[~"hi"], types: ~[t] };
|
||||
let p: path = { data: p_, span: sp };
|
||||
let x = { sp: sp, path: p };
|
||||
log(error, x.path);
|
||||
log(error, x);
|
||||
log(error, copy x.path);
|
||||
log(error, copy x);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ fn main() {
|
||||
|
||||
{
|
||||
match io::file_writer(&path, [io::Create, io::Truncate]) {
|
||||
Err(e) => fail e,
|
||||
Err(copy e) => fail e,
|
||||
Ok(f) => {
|
||||
for uint::range(0, 1000) |_i| {
|
||||
f.write_u8(0);
|
||||
|
@ -6,7 +6,7 @@ extern mod std;
|
||||
fn test1() {
|
||||
let mut s: ~str = ~"hello";
|
||||
s += ~"world";
|
||||
log(debug, s);
|
||||
log(debug, copy s);
|
||||
assert (s[9] == 'd' as u8);
|
||||
}
|
||||
|
||||
@ -16,8 +16,8 @@ fn test2() {
|
||||
let ff: ~str = ~"abc";
|
||||
let a: ~str = ff + ~"ABC" + ff;
|
||||
let b: ~str = ~"ABC" + ff + ~"ABC";
|
||||
log(debug, a);
|
||||
log(debug, b);
|
||||
log(debug, copy a);
|
||||
log(debug, copy b);
|
||||
assert (a == ~"abcABCabc");
|
||||
assert (b == ~"ABCabcABC");
|
||||
}
|
||||
|
@ -6,6 +6,6 @@ fn main() {
|
||||
let a: ~str = ~"hello";
|
||||
let b: ~str = ~"world";
|
||||
let s: ~str = a + b;
|
||||
log(debug, s);
|
||||
log(debug, copy s);
|
||||
assert (s[9] == 'd' as u8);
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
extern mod std;
|
||||
|
||||
fn test(actual: ~str, expected: ~str) {
|
||||
log(debug, actual);
|
||||
log(debug, expected);
|
||||
log(debug, copy actual);
|
||||
log(debug, copy expected);
|
||||
assert (actual == expected);
|
||||
}
|
||||
|
||||
@ -249,4 +249,4 @@ fn more_floats() {
|
||||
assert ~"99" == fmt!("%.0f", 98.5);
|
||||
assert ~"7.0000" == fmt!("%.4f", 6.999999999);
|
||||
assert ~"3.141590000" == fmt!("%.9f", 3.14159);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ trait MyNum : Add<self,self>, Sub<self,self>, Mul<self,self>, Eq { }
|
||||
struct MyInt { val: int }
|
||||
|
||||
impl MyInt : Add<MyInt, MyInt> {
|
||||
pure fn add(other: &MyInt) -> MyInt { mi(self.val + other.val) }
|
||||
pure fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) }
|
||||
}
|
||||
|
||||
impl MyInt : Sub<MyInt, MyInt> {
|
||||
|
@ -2,9 +2,9 @@ fn main() {
|
||||
let i = ~mut 1;
|
||||
// Should be a copy
|
||||
let mut j;
|
||||
j = i;
|
||||
j = copy i;
|
||||
*i = 2;
|
||||
*j = 3;
|
||||
assert *i == 2;
|
||||
assert *j == 3;
|
||||
}
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ fn main() unsafe {
|
||||
let i = ~@1;
|
||||
let j = ~@2;
|
||||
let rc1 = refcount(*i);
|
||||
let j = i;
|
||||
let j = copy i;
|
||||
let rc2 = refcount(*i);
|
||||
error!("rc1: %u rc2: %u", rc1, rc2);
|
||||
assert rc1 + 1u == rc2;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn main() {
|
||||
let a = ~[~mut 10];
|
||||
let b = a;
|
||||
let b = copy a;
|
||||
|
||||
assert *a[0] == 10;
|
||||
assert *b[0] == 10;
|
||||
@ -10,4 +10,4 @@ fn main() {
|
||||
|
||||
assert *a[0] == 20;
|
||||
assert *b[0] == 10;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
fn main() {
|
||||
let a = ~[1, 2, 3, 4, 5];
|
||||
let mut b = ~[a, a];
|
||||
let mut b = ~[copy a, copy a];
|
||||
b = b + b; // FIXME(#3387)---can't write b += b
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user