diff options
Diffstat (limited to 'src/test')
548 files changed, 1838 insertions, 2190 deletions
diff --git a/src/test/bench/99bob-iter.rs b/src/test/bench/99bob-iter.rs index cf1989ce294..aa79590a246 100644 --- a/src/test/bench/99bob-iter.rs +++ b/src/test/bench/99bob-iter.rs @@ -32,7 +32,7 @@ fn sub(t: str, n: int) -> str { _ { ns = int::to_str(n, 10u) + " bottles"; } } while i < str::byte_len(t) { - if t.(i) == '#' as u8 { b += ns; } else { str::push_byte(b, t.(i)); } + if t[i] == '#' as u8 { b += ns; } else { str::push_byte(b, t[i]); } i += 1u; } ret b; diff --git a/src/test/bench/99bob-pattern.rs b/src/test/bench/99bob-pattern.rs index 4bbea0c34bd..fdfce9dfae5 100644 --- a/src/test/bench/99bob-pattern.rs +++ b/src/test/bench/99bob-pattern.rs @@ -56,4 +56,4 @@ fn main() { let b: bottle = multiple(99); let running: bool = true; while running { show(b); log ""; running = more(b); b = next(b); } -} \ No newline at end of file +} diff --git a/src/test/bench/99bob-simple.rs b/src/test/bench/99bob-simple.rs index 205ab67ff9a..2db6321d257 100644 --- a/src/test/bench/99bob-simple.rs +++ b/src/test/bench/99bob-simple.rs @@ -32,7 +32,7 @@ fn sub(t: str, n: int) -> str { _ { ns = int::to_str(n, 10u) + " bottles"; } } while i < str::byte_len(t) { - if t.(i) == '#' as u8 { b += ns; } else { str::push_byte(b, t.(i)); } + if t[i] == '#' as u8 { b += ns; } else { str::push_byte(b, t[i]); } i += 1u; } ret b; @@ -45,4 +45,4 @@ fn main() { while n > 0 { log sub(b1(), n); log sub(b2(), n - 1); log ""; n -= 1; } log b7(); log sub(b8(), 99); -} \ No newline at end of file +} diff --git a/src/test/bench/99bob-tail.rs b/src/test/bench/99bob-tail.rs index c68d77fe324..af5e22f48ea 100644 --- a/src/test/bench/99bob-tail.rs +++ b/src/test/bench/99bob-tail.rs @@ -36,4 +36,4 @@ fn main() { log ""; } multiple(99); -} \ No newline at end of file +} diff --git a/src/test/bench/shootout-ackermann.rs b/src/test/bench/shootout-ackermann.rs index 91e524d0d31..46b8cc443bf 100644 --- a/src/test/bench/shootout-ackermann.rs +++ b/src/test/bench/shootout-ackermann.rs @@ -22,4 +22,4 @@ fn main() { // assert (ack(4,1) == 65533); -} \ No newline at end of file +} diff --git a/src/test/bench/shootout-binarytrees.rs b/src/test/bench/shootout-binarytrees.rs index 0fd77456e2a..d6a44e6eb82 100644 --- a/src/test/bench/shootout-binarytrees.rs +++ b/src/test/bench/shootout-binarytrees.rs @@ -28,8 +28,8 @@ fn main() { } else { max_depth = n; } let stretch_depth = max_depth + 1; let stretch_tree = bottom_up_tree(0, stretch_depth); - log #fmt("stretch tree of depth %d\t check: %d", stretch_depth, - item_check(stretch_tree)); + log #fmt["stretch tree of depth %d\t check: %d", stretch_depth, + item_check(stretch_tree)]; let long_lived_tree = bottom_up_tree(0, max_depth); let depth = min_depth; while depth <= max_depth { @@ -43,10 +43,10 @@ fn main() { chk += item_check(temp_tree); i += 1; } - log #fmt("%d\t trees of depth %d\t check: %d", iterations * 2, depth, - chk); + log #fmt["%d\t trees of depth %d\t check: %d", iterations * 2, depth, + chk]; depth += 2; } - log #fmt("long lived trees of depth %d\t check: %d", max_depth, - item_check(long_lived_tree)); -} \ No newline at end of file + log #fmt["long lived trees of depth %d\t check: %d", max_depth, + item_check(long_lived_tree)]; +} diff --git a/src/test/bench/shootout-fannkuchredux.rs b/src/test/bench/shootout-fannkuchredux.rs index d4bdbc93b35..8e7b2cbe269 100644 --- a/src/test/bench/shootout-fannkuchredux.rs +++ b/src/test/bench/shootout-fannkuchredux.rs @@ -20,21 +20,21 @@ fn fannkuch(n: int) -> int { r = n; while r > 0 { i = 0; - while r != 1 { count.(r - 1) = r; r -= 1; } - while i < n { perm.(i) = perm1.(i); i += 1; } + while r != 1 { count[r - 1] = r; r -= 1; } + while i < n { perm[i] = perm1[i]; i += 1; } // Count flips and update max and checksum f = 0; - k = perm.(0); + k = perm[0]; while k != 0 { i = 0; while 2 * i < k { - let t = perm.(i); - perm.(i) = perm.(k - i); - perm.(k - i) = t; + let t = perm[i]; + perm[i] = perm[k - i]; + perm[k - i] = t; i += 1; } - k = perm.(0); + k = perm[0]; f += 1; } if f > flips { flips = f; } @@ -44,12 +44,12 @@ fn fannkuch(n: int) -> int { let go = true; while go { if r == n { log checksum; ret flips; } - let p0 = perm1.(0); + let p0 = perm1[0]; i = 0; - while i < r { let j = i + 1; perm1.(i) = perm1.(j); i = j; } - perm1.(r) = p0; - count.(r) -= 1; - if count.(r) > 0 { go = false; } else { r += 1; } + while i < r { let j = i + 1; perm1[i] = perm1[j]; i = j; } + perm1[r] = p0; + count[r] -= 1; + if count[r] > 0 { go = false; } else { r += 1; } } nperm += 1; } @@ -58,5 +58,5 @@ fn fannkuch(n: int) -> int { fn main(args: [str]) { let n = 7; - log #fmt("Pfannkuchen(%d) = %d", n, fannkuch(n)); + log #fmt["Pfannkuchen(%d) = %d", n, fannkuch(n)]; } diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs index 25a3756346a..80e0108867d 100644 --- a/src/test/bench/shootout-fasta.rs +++ b/src/test/bench/shootout-fasta.rs @@ -25,20 +25,20 @@ type aminoacids = {ch: char, prob: u32}; fn make_cumulative(aa: &[aminoacids]) -> [aminoacids] { let cp: u32 = 0u32; - let ans: [aminoacids] = ~[]; - for a: aminoacids in aa { cp += a.prob; ans += ~[{ch: a.ch, prob: cp}]; } + let ans: [aminoacids] = []; + for a: aminoacids in aa { cp += a.prob; ans += [{ch: a.ch, prob: cp}]; } ret ans; } fn select_random(r: u32, genelist: &[aminoacids]) -> char { - if r < genelist.(0).prob { ret genelist.(0).ch; } + if r < genelist[0].prob { ret genelist[0].ch; } fn bisect(v: &[aminoacids], lo: uint, hi: uint, target: u32) -> char { if hi > lo + 1u { let mid: uint = lo + (hi - lo) / 2u; - if target < v.(mid).prob { + if target < v[mid].prob { be bisect(v, lo, mid, target); } else { be bisect(v, mid, hi, target); } - } else { ret v.(hi).ch; } + } else { ret v[hi].ch; } } ret bisect(genelist, 0u, vec::len::<aminoacids>(genelist) - 1u, r); } @@ -59,7 +59,7 @@ fn make_repeat_fasta(id: str, desc: str, s: str, n: int) { let op: str = ""; let sl: uint = str::byte_len(s); for each i: uint in uint::range(0u, n as uint) { - str::push_byte(op, s.(i % sl)); + str::push_byte(op, s[i % sl]); if str::byte_len(op) >= LINE_LENGTH() { log op; op = ""; } } if str::byte_len(op) > 0u { log op; } @@ -69,16 +69,14 @@ fn acid(ch: char, prob: u32) -> aminoacids { ret {ch: ch, prob: prob}; } fn main(args: [str]) { let iub: [aminoacids] = - make_cumulative( - ~[acid('a', 27u32), acid('c', 12u32), acid('g', 12u32), - acid('t', 27u32), acid('B', 2u32), acid('D', 2u32), - acid('H', 2u32), acid('K', 2u32), acid('M', 2u32), - acid('N', 2u32), acid('R', 2u32), acid('S', 2u32), - acid('V', 2u32), acid('W', 2u32), acid('Y', 2u32)]); + make_cumulative([acid('a', 27u32), acid('c', 12u32), acid('g', 12u32), + acid('t', 27u32), acid('B', 2u32), acid('D', 2u32), + acid('H', 2u32), acid('K', 2u32), acid('M', 2u32), + acid('N', 2u32), acid('R', 2u32), acid('S', 2u32), + acid('V', 2u32), acid('W', 2u32), acid('Y', 2u32)]); let homosapiens: [aminoacids] = - make_cumulative( - ~[acid('a', 30u32), acid('c', 20u32), acid('g', 20u32), - acid('t', 30u32)]); + make_cumulative([acid('a', 30u32), acid('c', 20u32), acid('g', 20u32), + acid('t', 30u32)]); let alu: str = "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" + "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" + diff --git a/src/test/bench/shootout-fibo.rs b/src/test/bench/shootout-fibo.rs index f0a2009b213..a4b5f2588d4 100644 --- a/src/test/bench/shootout-fibo.rs +++ b/src/test/bench/shootout-fibo.rs @@ -16,4 +16,4 @@ fn main() { assert (fib(15) == 610); log fib(8); log fib(15); -} \ No newline at end of file +} diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 7657d058d02..5e888041981 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -12,7 +12,7 @@ fn main() { // during 'make check' under valgrind // 5000000 // 50000000 - let inputs: [int] = ~[50000, 500000]; + let inputs: [int] = [50000, 500000]; let bodies: [Body::props] = NBodySystem::MakeNBodySystem(); @@ -34,7 +34,7 @@ mod NBodySystem { fn MakeNBodySystem() -> [Body::props] { // these each return a Body::props let bodies: [Body::props] = - ~[Body::sun(), Body::jupiter(), Body::saturn(), Body::uranus(), + [Body::sun(), Body::jupiter(), Body::saturn(), Body::uranus(), Body::neptune()]; let px: float = 0.0; @@ -43,15 +43,15 @@ mod NBodySystem { let i: int = 0; while i < 5 { - px += bodies.(i).vx * bodies.(i).mass; - py += bodies.(i).vy * bodies.(i).mass; - pz += bodies.(i).vz * bodies.(i).mass; + px += bodies[i].vx * bodies[i].mass; + py += bodies[i].vy * bodies[i].mass; + pz += bodies[i].vz * bodies[i].mass; i += 1; } // side-effecting - Body::offsetMomentum(bodies.(0), px, py, pz); + Body::offsetMomentum(bodies[0], px, py, pz); ret bodies; } @@ -61,13 +61,13 @@ mod NBodySystem { let i: int = 0; while i < 5 { let j: int = i + 1; - while j < 5 { advance_one(bodies.(i), bodies.(j), dt); j += 1; } + while j < 5 { advance_one(bodies[i], bodies[j], dt); j += 1; } i += 1; } i = 0; - while i < 5 { move(bodies.(i), dt); i += 1; } + while i < 5 { move(bodies[i], dt); i += 1; } } fn advance_one(bi: &Body::props, bj: &Body::props, dt: float) { @@ -105,19 +105,18 @@ mod NBodySystem { let i: int = 0; while i < 5 { e += - 0.5 * bodies.(i).mass * - (bodies.(i).vx * bodies.(i).vx + - bodies.(i).vy * bodies.(i).vy + - bodies.(i).vz * bodies.(i).vz); + 0.5 * bodies[i].mass * + (bodies[i].vx * bodies[i].vx + bodies[i].vy * bodies[i].vy + + bodies[i].vz * bodies[i].vz); let j: int = i + 1; while j < 5 { - dx = bodies.(i).x - bodies.(j).x; - dy = bodies.(i).y - bodies.(j).y; - dz = bodies.(i).z - bodies.(j).z; + dx = bodies[i].x - bodies[j].x; + dy = bodies[i].y - bodies[j].y; + dz = bodies[i].z - bodies[j].z; distance = llvm::sqrt(dx * dx + dy * dy + dz * dz); - e -= bodies.(i).mass * bodies.(j).mass / distance; + e -= bodies[i].mass * bodies[j].mass / distance; j += 1; } @@ -133,7 +132,7 @@ mod Body { const PI: float = 3.141592653589793; const SOLAR_MASS: float = 39.478417604357432; - // was 4 * PI * PI originally + // was 4 * PI * PI originally const DAYS_PER_YEAR: float = 365.24; type props = diff --git a/src/test/bench/shootout-pfib.rs b/src/test/bench/shootout-pfib.rs index 67cbf77968e..60b54cbe33d 100644 --- a/src/test/bench/shootout-pfib.rs +++ b/src/test/bench/shootout-pfib.rs @@ -30,7 +30,7 @@ fn fib(n: int) -> int { fn pfib(c: _chan<int>, n: int) { if n == 0 { send(c, 0); - } else if (n <= 2) { + } else if n <= 2 { send(c, 1); } else { let p = mk_port::<int>(); @@ -50,7 +50,7 @@ fn fib(n: int) -> int { type config = {stress: bool}; fn parse_opts(argv: [str]) -> config { - let opts = ~[getopts::optflag("stress")]; + let opts = [getopts::optflag("stress")]; let opt_args = vec::slice(argv, 1u, vec::len(argv)); @@ -67,7 +67,7 @@ fn stress_task(id: int) { let n = 15; assert (fib(n) == fib(n)); i += 1; - log_err #fmt("%d: Completed %d iterations", id, i); + log_err #fmt["%d: Completed %d iterations", id, i]; } } @@ -91,7 +91,7 @@ fn main(argv: [str]) { if opts.stress { stress(2); } else { - let max = uint::parse_buf(str::bytes(argv.(1)), 10u) as int; + let max = uint::parse_buf(str::bytes(argv[1]), 10u) as int; let num_trials = 10; @@ -106,8 +106,8 @@ fn main(argv: [str]) { let elapsed = stop - start; - out.write_line(#fmt("%d\t%d\t%s", n, fibn, - u64::str(elapsed))); + out.write_line(#fmt["%d\t%d\t%s", n, fibn, + u64::str(elapsed)]); } } } diff --git a/src/test/bench/task-perf-spawnalot.rs b/src/test/bench/task-perf-spawnalot.rs index 48e1b4d8087..150853e2328 100644 --- a/src/test/bench/task-perf-spawnalot.rs +++ b/src/test/bench/task-perf-spawnalot.rs @@ -6,25 +6,17 @@ import std::str; fn f(n: uint) { let i = 0u; - while i < n { - let thunk = g; - task::join_id(task::spawn(thunk)); - i += 1u; - } + while i < n { let thunk = g; task::join_id(task::spawn(thunk)); i += 1u; } } -fn g() {} +fn g() { } fn main(args: [str]) { - let n = if vec::len(args) < 2u { - 10u - } else { - uint::parse_buf(str::bytes(args.(1)), 10u) - }; + let n = + if vec::len(args) < 2u { + 10u + } else { uint::parse_buf(str::bytes(args[1]), 10u) }; let i = 0u; - while i < n { - task::spawn(bind f(n)); - i += 1u; - } + while i < n { task::spawn(bind f(n)); i += 1u; } } diff --git a/src/test/bench/task-perf-word-count.rs b/src/test/bench/task-perf-word-count.rs index 54bfae13c23..7d0effb4a7f 100644 --- a/src/test/bench/task-perf-word-count.rs +++ b/src/test/bench/task-perf-word-count.rs @@ -42,14 +42,7 @@ fn reduce(word: str, get: map_reduce::getter) { let count = 0; - while true { - alt get() { - some(_) { - count += 1; - } - none. { break } - } - } + while true { alt get() { some(_) { count += 1; } none. { break } } } } mod map_reduce { @@ -59,13 +52,13 @@ mod map_reduce { export reducer; export map_reduce; - type putter = fn(str, int) ; + type putter = fn(str, int); - type mapper = fn(str, putter) ; + type mapper = fn(str, putter); - type getter = fn() -> option<int> ; + type getter = fn() -> option<int>; - type reducer = fn(str, getter) ; + type reducer = fn(str, getter); tag ctrl_proto { find_reducer([u8], _chan<_chan<reduce_proto>>); @@ -75,9 +68,9 @@ mod map_reduce { tag reduce_proto { emit_val(int); done; ref; release; } fn start_mappers(ctrl: _chan<ctrl_proto>, inputs: &[str]) -> [task_id] { - let tasks = ~[]; + let tasks = []; for i: str in inputs { - tasks += ~[task::spawn(bind map_task(ctrl, i))]; + tasks += [task::spawn(bind map_task(ctrl, i))]; } ret tasks; } @@ -108,7 +101,7 @@ mod map_reduce { map(input, bind emit(intermediates, ctrl, _, _)); - for each kv: @{key: str, val: _chan<reduce_proto>} in + for each kv: @{key: str, val: _chan<reduce_proto>} in intermediates.items() { send(kv.val, release); } @@ -178,8 +171,7 @@ mod map_reduce { none. { // log_err "creating new reducer for " + k; let p = mk_port(); - tasks += - ~[task::spawn(bind reduce_task(k, p.mk_chan()))]; + tasks += [task::spawn(bind reduce_task(k, p.mk_chan()))]; c = p.recv(); reducers.insert(k, c); } @@ -202,7 +194,7 @@ fn main(argv: [str]) { if vec::len(argv) < 2u { let out = io::stdout(); - out.write_line(#fmt("Usage: %s <filename> ...", argv.(0))); + out.write_line(#fmt["Usage: %s <filename> ...", argv[0]]); // TODO: run something just to make sure the code hasn't // broken yet. This is the unit test mode of this program. diff --git a/src/test/compile-fail/alias-mismatch.rs b/src/test/compile-fail/alias-mismatch.rs index c25c7229e22..068e8c65ff5 100644 --- a/src/test/compile-fail/alias-mismatch.rs +++ b/src/test/compile-fail/alias-mismatch.rs @@ -5,5 +5,5 @@ import std::vec::map; fn main() { fn f(i: uint) -> bool { true } - let a = map(f, ~[5u]); -} \ No newline at end of file + let a = map(f, [5u]); +} diff --git a/src/test/compile-fail/aliasness-mismatch.rs b/src/test/compile-fail/aliasness-mismatch.rs index a376508e8b4..8be70d8e29f 100644 --- a/src/test/compile-fail/aliasness-mismatch.rs +++ b/src/test/compile-fail/aliasness-mismatch.rs @@ -3,6 +3,6 @@ fn f(x: &int) { log_err x; } fn h(x: int) { log_err x; } -fn main() { let g: fn(int) = f; g(10); g = h; g(10); } +fn main() { let g: fn(int) = f; g(10); g = h; g(10); } diff --git a/src/test/compile-fail/alt-join.rs b/src/test/compile-fail/alt-join.rs index 613e1e12382..246d186b06c 100644 --- a/src/test/compile-fail/alt-join.rs +++ b/src/test/compile-fail/alt-join.rs @@ -5,11 +5,8 @@ fn my_fail() -> ! { fail; } fn main() { - alt (true) { - false { my_fail(); } - true {} - } + alt true { false { my_fail(); } true { } } log x; - let x:int; -} \ No newline at end of file + let x: int; +} diff --git a/src/test/compile-fail/and-init.rs b/src/test/compile-fail/and-init.rs index 26296dc6faa..75e63ab2cc6 100644 --- a/src/test/compile-fail/and-init.rs +++ b/src/test/compile-fail/and-init.rs @@ -5,4 +5,4 @@ fn main() { log false && { i = 5; true }; log i; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/arg-count-mismatch.rs b/src/test/compile-fail/arg-count-mismatch.rs index 89be0585c34..62aad13d150 100644 --- a/src/test/compile-fail/arg-count-mismatch.rs +++ b/src/test/compile-fail/arg-count-mismatch.rs @@ -2,4 +2,4 @@ fn f(x: int) { } -fn main() { let i: (); i = f(); } \ No newline at end of file +fn main() { let i: (); i = f(); } diff --git a/src/test/compile-fail/arg-type-mismatch.rs b/src/test/compile-fail/arg-type-mismatch.rs index 3fe2e95c294..8934a12b27a 100644 --- a/src/test/compile-fail/arg-type-mismatch.rs +++ b/src/test/compile-fail/arg-type-mismatch.rs @@ -3,4 +3,4 @@ fn f(x: int) { } -fn main() { let i: (); i = f(()); } \ No newline at end of file +fn main() { let i: (); i = f(()); } diff --git a/src/test/compile-fail/assign-alias.rs b/src/test/compile-fail/assign-alias.rs index 66041f08a7a..b291b6d47b6 100644 --- a/src/test/compile-fail/assign-alias.rs +++ b/src/test/compile-fail/assign-alias.rs @@ -2,4 +2,4 @@ fn f(i: &int) { i += 2; } -fn main() { f(1); } \ No newline at end of file +fn main() { f(1); } diff --git a/src/test/compile-fail/auto-deref-bind.rs b/src/test/compile-fail/auto-deref-bind.rs index 9d9b0613bd7..b218ddd122a 100644 --- a/src/test/compile-fail/auto-deref-bind.rs +++ b/src/test/compile-fail/auto-deref-bind.rs @@ -1,4 +1,4 @@ // error-pattern: mismatched types fn add1(i: int) -> int { ret i + 1; } -fn main() { let f = @add1; let g = bind f(5); } \ No newline at end of file +fn main() { let f = @add1; let g = bind f(5); } diff --git a/src/test/compile-fail/bad-bang-ann-2.rs b/src/test/compile-fail/bad-bang-ann-2.rs index 15ba26b0dc0..011358ac10c 100644 --- a/src/test/compile-fail/bad-bang-ann-2.rs +++ b/src/test/compile-fail/bad-bang-ann-2.rs @@ -4,4 +4,4 @@ fn bad_bang(i: uint) -> ! { log 3; } -fn main() { bad_bang(5u); } \ No newline at end of file +fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bad-bang-ann-3.rs b/src/test/compile-fail/bad-bang-ann-3.rs index 7077a2e7986..2ba862ff57f 100644 --- a/src/test/compile-fail/bad-bang-ann-3.rs +++ b/src/test/compile-fail/bad-bang-ann-3.rs @@ -4,4 +4,4 @@ fn bad_bang(i: uint) -> ! { ret 7u; } -fn main() { bad_bang(5u); } \ No newline at end of file +fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bad-bang-ann.rs b/src/test/compile-fail/bad-bang-ann.rs index 20aed480bfc..e67013998a1 100644 --- a/src/test/compile-fail/bad-bang-ann.rs +++ b/src/test/compile-fail/bad-bang-ann.rs @@ -4,4 +4,4 @@ fn bad_bang(i: uint) -> ! { if i < 0u { } else { fail; } } -fn main() { bad_bang(5u); } \ No newline at end of file +fn main() { bad_bang(5u); } diff --git a/src/test/compile-fail/bad-env-capture.rs b/src/test/compile-fail/bad-env-capture.rs index 2848d185739..8e8441e55ac 100644 --- a/src/test/compile-fail/bad-env-capture.rs +++ b/src/test/compile-fail/bad-env-capture.rs @@ -3,4 +3,4 @@ fn foo() { let x: int; fn bar() { log x; } } -fn main() { foo(); } \ No newline at end of file +fn main() { foo(); } diff --git a/src/test/compile-fail/bad-env-capture2.rs b/src/test/compile-fail/bad-env-capture2.rs index 47e9a4e0ed9..40a0a39e7c6 100644 --- a/src/test/compile-fail/bad-env-capture2.rs +++ b/src/test/compile-fail/bad-env-capture2.rs @@ -2,4 +2,4 @@ fn foo(x: int) { fn bar() { log x; } } -fn main() { foo(2); } \ No newline at end of file +fn main() { foo(2); } diff --git a/src/test/compile-fail/bad-env-capture3.rs b/src/test/compile-fail/bad-env-capture3.rs index 43d9a15665c..1ff3602ee88 100644 --- a/src/test/compile-fail/bad-env-capture3.rs +++ b/src/test/compile-fail/bad-env-capture3.rs @@ -5,4 +5,4 @@ obj foo(x: int) { } } -fn main() { foo(2); } \ No newline at end of file +fn main() { foo(2); } diff --git a/src/test/compile-fail/bad-main.rs b/src/test/compile-fail/bad-main.rs index 40879fae555..725f88129b9 100644 --- a/src/test/compile-fail/bad-main.rs +++ b/src/test/compile-fail/bad-main.rs @@ -1,3 +1,3 @@ // error-pattern:wrong type in main function -fn main(x: int) { } \ No newline at end of file +fn main(x: int) { } diff --git a/src/test/compile-fail/bad-module.rs b/src/test/compile-fail/bad-module.rs index bfb796916a3..c5b67b9401b 100644 --- a/src/test/compile-fail/bad-module.rs +++ b/src/test/compile-fail/bad-module.rs @@ -1,4 +1,4 @@ // error-pattern: unresolved import: vec import vec; -fn main() { let foo = vec::len([]); } \ No newline at end of file +fn main() { let foo = vec::len([]); } diff --git a/src/test/compile-fail/bad-record-pat-2.rs b/src/test/compile-fail/bad-record-pat-2.rs index 125b608e4ed..54ae70a8661 100644 --- a/src/test/compile-fail/bad-record-pat-2.rs +++ b/src/test/compile-fail/bad-record-pat-2.rs @@ -1,3 +1,3 @@ // error-pattern:did not expect a record with a field q -fn main() { alt {x: 1, y: 2} { {x: x, q: q} { } } } \ No newline at end of file +fn main() { alt {x: 1, y: 2} { {x: x, q: q} { } } } diff --git a/src/test/compile-fail/bad-record-pat.rs b/src/test/compile-fail/bad-record-pat.rs index e8bb2426cd9..1b12d274ce8 100644 --- a/src/test/compile-fail/bad-record-pat.rs +++ b/src/test/compile-fail/bad-record-pat.rs @@ -1,3 +1,3 @@ // error-pattern:expected a record with 2 fields, found one with 1 -fn main() { alt {x: 1, y: 2} { {x: x} { } } } \ No newline at end of file +fn main() { alt {x: 1, y: 2} { {x: x} { } } } diff --git a/src/test/compile-fail/bang-tailexpr.rs b/src/test/compile-fail/bang-tailexpr.rs index 87afc1bd401..d13fca4486c 100644 --- a/src/test/compile-fail/bang-tailexpr.rs +++ b/src/test/compile-fail/bang-tailexpr.rs @@ -1,3 +1,3 @@ // error-pattern: some control paths may return fn f() -> ! { 3 } -fn main(){} +fn main() { } diff --git a/src/test/compile-fail/binop-add-tup-assign.rs b/src/test/compile-fail/binop-add-tup-assign.rs index 6470ae353a8..86515aeea6a 100644 --- a/src/test/compile-fail/binop-add-tup-assign.rs +++ b/src/test/compile-fail/binop-add-tup-assign.rs @@ -1,3 +1,3 @@ // error-pattern:+ cannot be applied to type `{x: bool}` -fn main() { let x = {x: true}; x += {x: false}; } \ No newline at end of file +fn main() { let x = {x: true}; x += {x: false}; } diff --git a/src/test/compile-fail/binop-add-tup.rs b/src/test/compile-fail/binop-add-tup.rs index 96dc63fef01..fadb35503e2 100644 --- a/src/test/compile-fail/binop-add-tup.rs +++ b/src/test/compile-fail/binop-add-tup.rs @@ -1,3 +1,3 @@ // error-pattern:+ cannot be applied to type `{x: bool}` -fn main() { let x = {x: true} + {x: false}; } \ No newline at end of file +fn main() { let x = {x: true} + {x: false}; } diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/compile-fail/binop-bitxor-str.rs index 0f1e2202419..65e0996fa62 100644 --- a/src/test/compile-fail/binop-bitxor-str.rs +++ b/src/test/compile-fail/binop-bitxor-str.rs @@ -1,3 +1,3 @@ // error-pattern:^ cannot be applied to type `str` -fn main() { let x = "a" ^ "b"; } \ No newline at end of file +fn main() { let x = "a" ^ "b"; } diff --git a/src/test/compile-fail/binop-logic-float.rs b/src/test/compile-fail/binop-logic-float.rs index 900c290b07e..7b7b165d49b 100644 --- a/src/test/compile-fail/binop-logic-float.rs +++ b/src/test/compile-fail/binop-logic-float.rs @@ -1,3 +1,3 @@ // error-pattern:|| cannot be applied to type `f32` -fn main() { let x = 1.0_f32 || 2.0_f32; } \ No newline at end of file +fn main() { let x = 1.0_f32 || 2.0_f32; } diff --git a/src/test/compile-fail/binop-logic-int.rs b/src/test/compile-fail/binop-logic-int.rs index ffe05f1649c..ef8643bd7b4 100644 --- a/src/test/compile-fail/binop-logic-int.rs +++ b/src/test/compile-fail/binop-logic-int.rs @@ -1,3 +1,3 @@ // error-pattern:&& cannot be applied to type `int` -fn main() { let x = 1 && 2; } \ No newline at end of file +fn main() { let x = 1 && 2; } diff --git a/src/test/compile-fail/binop-mul-bool.rs b/src/test/compile-fail/binop-mul-bool.rs index 78e7cbe23b5..7c912f58d1e 100644 --- a/src/test/compile-fail/binop-mul-bool.rs +++ b/src/test/compile-fail/binop-mul-bool.rs @@ -1,3 +1,3 @@ // error-pattern:* cannot be applied to type `bool` -fn main() { let x = true * false; } \ No newline at end of file +fn main() { let x = true * false; } diff --git a/src/test/compile-fail/binop-sub-obj.rs b/src/test/compile-fail/binop-sub-obj.rs index f5010dbbe05..630cd288a49 100644 --- a/src/test/compile-fail/binop-sub-obj.rs +++ b/src/test/compile-fail/binop-sub-obj.rs @@ -1,3 +1,3 @@ // error-pattern:- cannot be applied to type `obj -fn main() { let x = obj () { } - obj () { }; } \ No newline at end of file +fn main() { let x = obj () { } - obj () { }; } diff --git a/src/test/compile-fail/binop-typeck.rs b/src/test/compile-fail/binop-typeck.rs index caa844516fb..9cb6dea5360 100644 --- a/src/test/compile-fail/binop-typeck.rs +++ b/src/test/compile-fail/binop-typeck.rs @@ -1,4 +1,4 @@ // error-pattern:mismatched types // issue #500 -fn main() { let x = true; let y = 1; let z = x + y; } \ No newline at end of file +fn main() { let x = true; let y = 1; let z = x + y; } diff --git a/src/test/compile-fail/block-coerce-no.rs b/src/test/compile-fail/block-coerce-no.rs index 42b1504562a..bb3e53028c2 100644 --- a/src/test/compile-fail/block-coerce-no.rs +++ b/src/test/compile-fail/block-coerce-no.rs @@ -3,11 +3,11 @@ // Make sure that fn-to-block coercion isn't incorrectly lifted over // other tycons. -fn coerce(b: &block() ) -> fn() { - fn lol(f: &fn(&block() ) -> fn() , g: &block() ) -> fn() { ret f(g); } - fn fn_id(f: &fn() ) -> fn() { ret f } +fn coerce(b: &block()) -> fn() { + fn lol(f: &fn(&block()) -> fn(), g: &block()) -> fn() { ret f(g); } + fn fn_id(f: &fn()) -> fn() { ret f } ret lol(fn_id, b); } -fn main() { let i = 8; let f = coerce(block () { log_err i; }); f(); } \ No newline at end of file +fn main() { let i = 8; let f = coerce(block () { log_err i; }); f(); } diff --git a/src/test/compile-fail/block-copy.rs b/src/test/compile-fail/block-copy.rs index f0e510e87a7..6a6c708cf88 100644 --- a/src/test/compile-fail/block-copy.rs +++ b/src/test/compile-fail/block-copy.rs @@ -1,4 +1,4 @@ // error-pattern: non-copyable -fn lol(f: &block() ) -> block() { ret f; } -fn main() { let i = 8; let f = lol(block () { log_err i; }); f(); } \ No newline at end of file +fn lol(f: &block()) -> block() { ret f; } +fn main() { let i = 8; let f = lol(block () { log_err i; }); f(); } diff --git a/src/test/compile-fail/block-uninit.rs b/src/test/compile-fail/block-uninit.rs index 4fa112762e8..9028d5fa435 100644 --- a/src/test/compile-fail/block-uninit.rs +++ b/src/test/compile-fail/block-uninit.rs @@ -1,4 +1,4 @@ // error-pattern: Unsatisfied precondition constraint -fn force(f: &block() ) { f(); } -fn main() { let x: int; force(block () { log_err x; }); } \ No newline at end of file +fn force(f: &block()) { f(); } +fn main() { let x: int; force(block () { log_err x; }); } diff --git a/src/test/compile-fail/break-outside-loop.rs b/src/test/compile-fail/break-outside-loop.rs index adf6413ed62..3783dc83dd0 100644 --- a/src/test/compile-fail/break-outside-loop.rs +++ b/src/test/compile-fail/break-outside-loop.rs @@ -4,4 +4,4 @@ fn main() { let rs: {t: str} = {t: pth}; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/break-uninit.rs b/src/test/compile-fail/break-uninit.rs index d1c7a90f7f2..9a82a95ade2 100644 --- a/src/test/compile-fail/break-uninit.rs +++ b/src/test/compile-fail/break-uninit.rs @@ -11,4 +11,4 @@ fn foo() -> int { ret 17; } -fn main() { log foo(); } \ No newline at end of file +fn main() { log foo(); } diff --git a/src/test/compile-fail/break-uninit2.rs b/src/test/compile-fail/break-uninit2.rs index 9fb89c5c648..d1fda52fae6 100644 --- a/src/test/compile-fail/break-uninit2.rs +++ b/src/test/compile-fail/break-uninit2.rs @@ -11,4 +11,4 @@ fn foo() -> int { ret 17; } -fn main() { log foo(); } \ No newline at end of file +fn main() { log foo(); } diff --git a/src/test/compile-fail/capture1.rs b/src/test/compile-fail/capture1.rs index 1e8e48aea02..877884bf7f9 100644 --- a/src/test/compile-fail/capture1.rs +++ b/src/test/compile-fail/capture1.rs @@ -5,4 +5,4 @@ fn main() { let bar: int = 5; fn foo() -> int { ret bar; } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/constructor-as-cast.rs b/src/test/compile-fail/constructor-as-cast.rs index 2bee78316f2..85d8c7850cf 100644 --- a/src/test/compile-fail/constructor-as-cast.rs +++ b/src/test/compile-fail/constructor-as-cast.rs @@ -1,10 +1,10 @@ // error-pattern: unresolved name: base type base = obj { - fn foo() ; + fn foo(); }; obj derived() { fn foo() { } fn bar() { } } -fn main() { let d: derived = derived(); let b: base = base(d); } \ No newline at end of file +fn main() { let d: derived = derived(); let b: base = base(d); } diff --git a/src/test/compile-fail/copy-a-resource.rs b/src/test/compile-fail/copy-a-resource.rs index aabacdde27f..9e5e6f81666 100644 --- a/src/test/compile-fail/copy-a-resource.rs +++ b/src/test/compile-fail/copy-a-resource.rs @@ -2,4 +2,4 @@ resource foo(i: int) { } -fn main() { let x <- foo(10); let y = x; } \ No newline at end of file +fn main() { let x <- foo(10); let y = x; } diff --git a/src/test/compile-fail/cross-crate-glob-collision.rs b/src/test/compile-fail/cross-crate-glob-collision.rs index 3771851cfae..490f8ae9b21 100644 --- a/src/test/compile-fail/cross-crate-glob-collision.rs +++ b/src/test/compile-fail/cross-crate-glob-collision.rs @@ -10,4 +10,4 @@ mod alternate_supplier { fn member() { } } -fn main() { member() } \ No newline at end of file +fn main() { member() } diff --git a/src/test/compile-fail/direct-obj-fn-call.rs b/src/test/compile-fail/direct-obj-fn-call.rs index 557b6af1696..01ec855bf7c 100644 --- a/src/test/compile-fail/direct-obj-fn-call.rs +++ b/src/test/compile-fail/direct-obj-fn-call.rs @@ -4,4 +4,4 @@ obj x() { fn hello() { log "hello"; } } -fn main() { x.hello(); } \ No newline at end of file +fn main() { x.hello(); } diff --git a/src/test/compile-fail/do-while-constraints.rs b/src/test/compile-fail/do-while-constraints.rs index cfea71fc7ef..f7d03b89354 100644 --- a/src/test/compile-fail/do-while-constraints.rs +++ b/src/test/compile-fail/do-while-constraints.rs @@ -7,4 +7,4 @@ fn main() { log y; do { do { do { x <- y; } while true } while true } while true } while true -} \ No newline at end of file +} diff --git a/src/test/compile-fail/do-while-pred-constraints.rs b/src/test/compile-fail/do-while-pred-constraints.rs index 31d3e82796e..90fcd26ea9f 100644 --- a/src/test/compile-fail/do-while-pred-constraints.rs +++ b/src/test/compile-fail/do-while-pred-constraints.rs @@ -1,24 +1,14 @@ // error-pattern: Unsatisfied precondition constraint (for example, even(y -fn print_even(y: int) : even(y) { - log y; -} +fn print_even(y: int) : even(y) { log y; } -pred even(y: int) -> bool { - true -} +pred even(y: int) -> bool { true } fn main() { - let y: int = 42; - check even(y); - do { - print_even(y); - do { - do { - do { - y += 1; - } while (true); - } while (true); - } while (true); - } while (true); + let y: int = 42; + check (even(y)); + do { + print_even(y); + do { do { do { y += 1; } while true } while true } while true + } while true } diff --git a/src/test/compile-fail/dup-link-name.rs b/src/test/compile-fail/dup-link-name.rs index 346588392ee..c7f0a12d061 100644 --- a/src/test/compile-fail/dup-link-name.rs +++ b/src/test/compile-fail/dup-link-name.rs @@ -2,4 +2,4 @@ #[link(name = "test", name)]; -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/export-fully-qualified.rs b/src/test/compile-fail/export-fully-qualified.rs index 7413777ee2b..30075a1cadb 100644 --- a/src/test/compile-fail/export-fully-qualified.rs +++ b/src/test/compile-fail/export-fully-qualified.rs @@ -13,4 +13,4 @@ mod foo { fn baz() { } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/export-import.rs b/src/test/compile-fail/export-import.rs index 2608f523220..f5ed4c4f3a7 100644 --- a/src/test/compile-fail/export-import.rs +++ b/src/test/compile-fail/export-import.rs @@ -11,4 +11,4 @@ mod m { } -fn main() { unexported(); } \ No newline at end of file +fn main() { unexported(); } diff --git a/src/test/compile-fail/export-no-tag-variants.rs b/src/test/compile-fail/export-no-tag-variants.rs index a824212ab08..2d10cb49270 100644 --- a/src/test/compile-fail/export-no-tag-variants.rs +++ b/src/test/compile-fail/export-no-tag-variants.rs @@ -9,4 +9,4 @@ mod foo { tag t { t1; } } -fn main() { let x = foo::t1; } \ No newline at end of file +fn main() { let x = foo::t1; } diff --git a/src/test/compile-fail/export-tag-variant.rs b/src/test/compile-fail/export-tag-variant.rs index a31ae5615fb..33496480c02 100644 --- a/src/test/compile-fail/export-tag-variant.rs +++ b/src/test/compile-fail/export-tag-variant.rs @@ -8,4 +8,4 @@ mod foo { tag y { y1; } } -fn main() { let z = foo::y1; } \ No newline at end of file +fn main() { let z = foo::y1; } diff --git a/src/test/compile-fail/export.rs b/src/test/compile-fail/export.rs index 57967838640..55d33160d34 100644 --- a/src/test/compile-fail/export.rs +++ b/src/test/compile-fail/export.rs @@ -5,4 +5,4 @@ mod foo { fn z(y: int) { log y; } } -fn main() { foo::z(10); } \ No newline at end of file +fn main() { foo::z(10); } diff --git a/src/test/compile-fail/export2.rs b/src/test/compile-fail/export2.rs index 47b80014a1c..28919efdd49 100644 --- a/src/test/compile-fail/export2.rs +++ b/src/test/compile-fail/export2.rs @@ -14,4 +14,4 @@ mod bar { fn y() { } } -fn main() { foo::x(); } \ No newline at end of file +fn main() { foo::x(); } diff --git a/src/test/compile-fail/ext-nonexistent.rs b/src/test/compile-fail/ext-nonexistent.rs index f4cb0021be3..ec63c1f07d0 100644 --- a/src/test/compile-fail/ext-nonexistent.rs +++ b/src/test/compile-fail/ext-nonexistent.rs @@ -1,2 +1,2 @@ // error-pattern:macro undefined -fn main() { #iamnotanextensionthatexists(""); } \ No newline at end of file +fn main() { #iamnotanextensionthatexists[""]; } diff --git a/src/test/compile-fail/extend-non-object.rs b/src/test/compile-fail/extend-non-object.rs index 4a957f5fc73..0857ac990c0 100644 --- a/src/test/compile-fail/extend-non-object.rs +++ b/src/test/compile-fail/extend-non-object.rs @@ -10,4 +10,4 @@ fn main() { with x }; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/extenv-no-args.rs b/src/test/compile-fail/extenv-no-args.rs index 5b0be3c9871..ec73f0a7a45 100644 --- a/src/test/compile-fail/extenv-no-args.rs +++ b/src/test/compile-fail/extenv-no-args.rs @@ -1,5 +1,3 @@ // error-pattern:malformed #env call -fn main() { - #env(); -} +fn main() { #env[]; } diff --git a/src/test/compile-fail/extenv-not-string-literal.rs b/src/test/compile-fail/extenv-not-string-literal.rs index 8ab4953c8fa..57d50b2e54d 100644 --- a/src/test/compile-fail/extenv-not-string-literal.rs +++ b/src/test/compile-fail/extenv-not-string-literal.rs @@ -1,3 +1,3 @@ // error-pattern:requires a string -fn main() { #env(10); } \ No newline at end of file +fn main() { #env[10]; } diff --git a/src/test/compile-fail/extenv-too-many-args.rs b/src/test/compile-fail/extenv-too-many-args.rs index 65200e5c116..945546fd6cb 100644 --- a/src/test/compile-fail/extenv-too-many-args.rs +++ b/src/test/compile-fail/extenv-too-many-args.rs @@ -1,3 +1,3 @@ // error-pattern:malformed #env call -fn main() { #env("one", "two"); } \ No newline at end of file +fn main() { #env["one", "two"]; } diff --git a/src/test/compile-fail/extfmt-missing-type.rs b/src/test/compile-fail/extfmt-missing-type.rs index 23deb75e9e7..9e1cbc557d4 100644 --- a/src/test/compile-fail/extfmt-missing-type.rs +++ b/src/test/compile-fail/extfmt-missing-type.rs @@ -1,3 +1,3 @@ // error-pattern:missing type -fn main() { #fmt("%+"); } \ No newline at end of file +fn main() { #fmt["%+"]; } diff --git a/src/test/compile-fail/extfmt-no-args.rs b/src/test/compile-fail/extfmt-no-args.rs index 8bc3f23f2f0..7c13ef99dc5 100644 --- a/src/test/compile-fail/extfmt-no-args.rs +++ b/src/test/compile-fail/extfmt-no-args.rs @@ -1,5 +1,3 @@ // error-pattern:format string -fn main() { - #fmt(); -} \ No newline at end of file +fn main() { #fmt[]; } diff --git a/src/test/compile-fail/extfmt-non-literal.rs b/src/test/compile-fail/extfmt-non-literal.rs index 7b1b4db7378..445455f33d8 100644 --- a/src/test/compile-fail/extfmt-non-literal.rs +++ b/src/test/compile-fail/extfmt-non-literal.rs @@ -4,5 +4,5 @@ fn main() { // #fmt's first argument must be a literal. Hopefully this // restriction can be eased eventually to just require a // compile-time constant. - let x = #fmt("a" + "b"); -} \ No newline at end of file + let x = #fmt["a" + "b"]; +} diff --git a/src/test/compile-fail/extfmt-non-literal2.rs b/src/test/compile-fail/extfmt-non-literal2.rs index 5bb730c8aa6..8a2d7c4bbed 100644 --- a/src/test/compile-fail/extfmt-non-literal2.rs +++ b/src/test/compile-fail/extfmt-non-literal2.rs @@ -4,5 +4,5 @@ fn main() { // #fmt's first argument must be a literal. Hopefully this // restriction can be eased eventually to just require a // compile-time constant. - let x = #fmt(20); -} \ No newline at end of file + let x = #fmt[20]; +} diff --git a/src/test/compile-fail/extfmt-not-enough-args.rs b/src/test/compile-fail/extfmt-not-enough-args.rs index 9e3012bbc49..849a836060d 100644 --- a/src/test/compile-fail/extfmt-not-enough-args.rs +++ b/src/test/compile-fail/extfmt-not-enough-args.rs @@ -2,4 +2,4 @@ use std; -fn main() { let s = #fmt("%s%s%s", "test", "test"); } \ No newline at end of file +fn main() { let s = #fmt["%s%s%s", "test", "test"]; } diff --git a/src/test/compile-fail/extfmt-too-many-args.rs b/src/test/compile-fail/extfmt-too-many-args.rs index 617a1091173..4c91da227e1 100644 --- a/src/test/compile-fail/extfmt-too-many-args.rs +++ b/src/test/compile-fail/extfmt-too-many-args.rs @@ -2,4 +2,4 @@ use std; -fn main() { let s = #fmt("%s", "test", "test"); } \ No newline at end of file +fn main() { let s = #fmt["%s", "test", "test"]; } diff --git a/src/test/compile-fail/extfmt-unknown-type.rs b/src/test/compile-fail/extfmt-unknown-type.rs index 8c272a182a5..3a35a1d727b 100644 --- a/src/test/compile-fail/extfmt-unknown-type.rs +++ b/src/test/compile-fail/extfmt-unknown-type.rs @@ -1,3 +1,3 @@ // error-pattern:unknown type -fn main() { #fmt("%w"); } \ No newline at end of file +fn main() { #fmt["%w"]; } diff --git a/src/test/compile-fail/extfmt-unsigned-plus.rs b/src/test/compile-fail/extfmt-unsigned-plus.rs index 7715305e829..4ac41efb312 100644 --- a/src/test/compile-fail/extfmt-unsigned-plus.rs +++ b/src/test/compile-fail/extfmt-unsigned-plus.rs @@ -2,5 +2,5 @@ fn main() { // Can't use a sign on unsigned conversions - #fmt("%+u", 10u); -} \ No newline at end of file + #fmt["%+u", 10u]; +} diff --git a/src/test/compile-fail/extfmt-unsigned-space.rs b/src/test/compile-fail/extfmt-unsigned-space.rs index 0a99a4b6c5e..6393548eb3d 100644 --- a/src/test/compile-fail/extfmt-unsigned-space.rs +++ b/src/test/compile-fail/extfmt-unsigned-space.rs @@ -2,5 +2,5 @@ fn main() { // Can't use a space on unsigned conversions - #fmt("% u", 10u); -} \ No newline at end of file + #fmt["% u", 10u]; +} diff --git a/src/test/compile-fail/extfmt-unterminated-conv.rs b/src/test/compile-fail/extfmt-unterminated-conv.rs index 44a321f578d..3b7d0ce1767 100644 --- a/src/test/compile-fail/extfmt-unterminated-conv.rs +++ b/src/test/compile-fail/extfmt-unterminated-conv.rs @@ -1,3 +1,3 @@ // error-pattern:unterminated conversion -fn main() { #fmt("%"); } \ No newline at end of file +fn main() { #fmt["%"]; } diff --git a/src/test/compile-fail/fail-expr.rs b/src/test/compile-fail/fail-expr.rs index 13d91ce5cb2..72ae83062eb 100644 --- a/src/test/compile-fail/fail-expr.rs +++ b/src/test/compile-fail/fail-expr.rs @@ -1,3 +1,3 @@ // error-pattern:mismatched types -fn main() { fail 5; } \ No newline at end of file +fn main() { fail 5; } diff --git a/src/test/compile-fail/fail-type-err.rs b/src/test/compile-fail/fail-type-err.rs index e65ad1af413..8ea86d80a7b 100644 --- a/src/test/compile-fail/fail-type-err.rs +++ b/src/test/compile-fail/fail-type-err.rs @@ -1,2 +1,2 @@ // error-pattern:expected str but found [int] -fn main() { fail ~[0]; } \ No newline at end of file +fn main() { fail [0]; } diff --git a/src/test/compile-fail/fn-bad-block-type.rs b/src/test/compile-fail/fn-bad-block-type.rs index ba82efcf750..2349bfe90dc 100644 --- a/src/test/compile-fail/fn-bad-block-type.rs +++ b/src/test/compile-fail/fn-bad-block-type.rs @@ -2,4 +2,4 @@ fn f() -> int { true } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/fn-compare-mismatch.rs b/src/test/compile-fail/fn-compare-mismatch.rs index a2bb326c548..87287edca71 100644 --- a/src/test/compile-fail/fn-compare-mismatch.rs +++ b/src/test/compile-fail/fn-compare-mismatch.rs @@ -4,4 +4,4 @@ fn main() { fn f() { } fn g(i: int) { } let x = f == g; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/fn-constraint.rs b/src/test/compile-fail/fn-constraint.rs index 0be8d79a399..9ace741d836 100644 --- a/src/test/compile-fail/fn-constraint.rs +++ b/src/test/compile-fail/fn-constraint.rs @@ -6,4 +6,4 @@ fn main() { let a: uint = 4u; let b: uint = 1u; log_err safe_slice("kitties", a, b); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/fn-expr-type-state.rs b/src/test/compile-fail/fn-expr-type-state.rs index 02650b45d88..935542e85e7 100644 --- a/src/test/compile-fail/fn-expr-type-state.rs +++ b/src/test/compile-fail/fn-expr-type-state.rs @@ -4,4 +4,4 @@ fn main() { // Typestate should work even in a lambda. we should reject this program. let f = fn () -> int { let i: int; ret i; }; log_err f(); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/fn-expr-typestate-2.rs b/src/test/compile-fail/fn-expr-typestate-2.rs index 299b11cb743..d4f49f96466 100644 --- a/src/test/compile-fail/fn-expr-typestate-2.rs +++ b/src/test/compile-fail/fn-expr-typestate-2.rs @@ -1,3 +1,3 @@ // error-pattern:Unsatisfied precondition -fn main() { let j = fn () -> int { let i: int; ret i; }(); log_err j; } \ No newline at end of file +fn main() { let j = fn () -> int { let i: int; ret i; }(); log_err j; } diff --git a/src/test/compile-fail/for-each-over-bs.rs b/src/test/compile-fail/for-each-over-bs.rs index d34c91cd271..0d184978769 100644 --- a/src/test/compile-fail/for-each-over-bs.rs +++ b/src/test/compile-fail/for-each-over-bs.rs @@ -1,2 +1,2 @@ // error-pattern:sequence in for each loop not a call -fn main() { for each p in 1 {} } +fn main() { for each p in 1 { } } diff --git a/src/test/compile-fail/forgot-ret.rs b/src/test/compile-fail/forgot-ret.rs index 1cdc55ffd87..5d91e3212df 100644 --- a/src/test/compile-fail/forgot-ret.rs +++ b/src/test/compile-fail/forgot-ret.rs @@ -5,4 +5,4 @@ fn god_exists(a: int) -> bool { be god_exists(a); } fn f(a: int) -> int { if god_exists(a) { ret 5; } } -fn main() { f(12); } \ No newline at end of file +fn main() { f(12); } diff --git a/src/test/compile-fail/fru-extra-field.rs b/src/test/compile-fail/fru-extra-field.rs index 6957da34956..7d070c47f46 100644 --- a/src/test/compile-fail/fru-extra-field.rs +++ b/src/test/compile-fail/fru-extra-field.rs @@ -8,4 +8,4 @@ fn main() { let origin: point = {x: 0, y: 0}; let origin3d: point = {z: 0 with origin}; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/fru-typestate.rs b/src/test/compile-fail/fru-typestate.rs index ce5102cbf65..447f6f44dc5 100644 --- a/src/test/compile-fail/fru-typestate.rs +++ b/src/test/compile-fail/fru-typestate.rs @@ -9,4 +9,4 @@ fn main() { let right: point = {x: 10 with origin}; origin = {x: 0, y: 0}; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/if-branch-types.rs b/src/test/compile-fail/if-branch-types.rs index 345d2509970..bfb7a277492 100644 --- a/src/test/compile-fail/if-branch-types.rs +++ b/src/test/compile-fail/if-branch-types.rs @@ -1,3 +1,3 @@ // error-pattern:mismatched types -fn main() { let x = if true { 10 } else { 10u }; } \ No newline at end of file +fn main() { let x = if true { 10 } else { 10u }; } diff --git a/src/test/compile-fail/if-check-precond-fail.rs b/src/test/compile-fail/if-check-precond-fail.rs index af7658b4f94..9ce0d6f8ef5 100644 --- a/src/test/compile-fail/if-check-precond-fail.rs +++ b/src/test/compile-fail/if-check-precond-fail.rs @@ -2,11 +2,11 @@ pred even(x: uint) -> bool { if x < 2u { ret false; - } else if (x == 2u) { ret true; } else { ret even(x - 2u); } + } else if x == 2u { ret true; } else { ret even(x - 2u); } } fn print_even(x: uint) : even(x) { log x; } fn foo(x: uint) { if check even(x) { fail; } else { print_even(x); } } -fn main() { foo(3u); } \ No newline at end of file +fn main() { foo(3u); } diff --git a/src/test/compile-fail/if-typeck.rs b/src/test/compile-fail/if-typeck.rs index c88a1c8c9e6..d8c262bd6b3 100644 --- a/src/test/compile-fail/if-typeck.rs +++ b/src/test/compile-fail/if-typeck.rs @@ -7,4 +7,4 @@ fn main() { // f is not a bool if f { } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/import-from-dup.rs b/src/test/compile-fail/import-from-dup.rs index 729622c8b5a..73e14bfc753 100644 --- a/src/test/compile-fail/import-from-dup.rs +++ b/src/test/compile-fail/import-from-dup.rs @@ -4,11 +4,11 @@ import m1::{f}; import m2::{f}; mod m1 { - fn f() {} + fn f() { } } mod m2 { - fn f() {} + fn f() { } } -fn main() {} \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/import-from-missing.rs b/src/test/compile-fail/import-from-missing.rs index 1e0b3869053..bcd9ee7da43 100644 --- a/src/test/compile-fail/import-from-missing.rs +++ b/src/test/compile-fail/import-from-missing.rs @@ -2,10 +2,7 @@ import spam::{ham, eggs}; mod spam { - fn ham() {} + fn ham() { } } -fn main() { - ham(); - eggs(); -} \ No newline at end of file +fn main() { ham(); eggs(); } diff --git a/src/test/compile-fail/import-glob-0.rs b/src/test/compile-fail/import-glob-0.rs index 8d74000ef0b..d0cbcf57ad3 100644 --- a/src/test/compile-fail/import-glob-0.rs +++ b/src/test/compile-fail/import-glob-0.rs @@ -19,4 +19,4 @@ fn main() { f2(); f999(); // 'export' currently doesn't work? f4(); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/import-glob-circular.rs b/src/test/compile-fail/import-glob-circular.rs index 1a937d617c6..c9595777c27 100644 --- a/src/test/compile-fail/import-glob-circular.rs +++ b/src/test/compile-fail/import-glob-circular.rs @@ -22,4 +22,4 @@ mod test { import circ1::*; fn test() { f1066(); } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/import-glob-export.rs b/src/test/compile-fail/import-glob-export.rs index 57f154e104f..3965ad5fc4d 100644 --- a/src/test/compile-fail/import-glob-export.rs +++ b/src/test/compile-fail/import-glob-export.rs @@ -9,4 +9,4 @@ mod m1 { fn f2() { } } -fn main() { f2(); } \ No newline at end of file +fn main() { f2(); } diff --git a/src/test/compile-fail/import-glob-multiple.rs b/src/test/compile-fail/import-glob-multiple.rs index 1abe786ab6b..55a8878381d 100644 --- a/src/test/compile-fail/import-glob-multiple.rs +++ b/src/test/compile-fail/import-glob-multiple.rs @@ -17,4 +17,4 @@ mod mod2 { -fn main() { common2(); } \ No newline at end of file +fn main() { common2(); } diff --git a/src/test/compile-fail/import-loop-2.rs b/src/test/compile-fail/import-loop-2.rs index a21950898fa..4040f8333f9 100644 --- a/src/test/compile-fail/import-loop-2.rs +++ b/src/test/compile-fail/import-loop-2.rs @@ -10,4 +10,4 @@ mod b { export x; fn main() { let y = x; } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/import-loop.rs b/src/test/compile-fail/import-loop.rs index 6e790829ec8..6aa88db603d 100644 --- a/src/test/compile-fail/import-loop.rs +++ b/src/test/compile-fail/import-loop.rs @@ -7,4 +7,4 @@ mod y { export x; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/import5.rs b/src/test/compile-fail/import5.rs index 4910bb5065e..71f17b0c34a 100644 --- a/src/test/compile-fail/import5.rs +++ b/src/test/compile-fail/import5.rs @@ -12,4 +12,4 @@ mod m3 { import m2::foo; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/impure-pred.rs b/src/test/compile-fail/impure-pred.rs index cf775f8d6f1..05433ba17ed 100644 --- a/src/test/compile-fail/impure-pred.rs +++ b/src/test/compile-fail/impure-pred.rs @@ -9,4 +9,4 @@ fn main() { let x = 0; check (f(x)); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/infinite-vec-type-recursion.rs b/src/test/compile-fail/infinite-vec-type-recursion.rs index c41c9fb3881..709c5b628ee 100644 --- a/src/test/compile-fail/infinite-vec-type-recursion.rs +++ b/src/test/compile-fail/infinite-vec-type-recursion.rs @@ -3,4 +3,4 @@ type x = [x]; -fn main() { let b: x = ~[]; } +fn main() { let b: x = []; } diff --git a/src/test/compile-fail/lambda-mutate-nested.rs b/src/test/compile-fail/lambda-mutate-nested.rs index 6da8e3b252e..409b0e59950 100644 --- a/src/test/compile-fail/lambda-mutate-nested.rs +++ b/src/test/compile-fail/lambda-mutate-nested.rs @@ -3,10 +3,7 @@ // mutate upvars from a lambda. fn main() { let i = 0; - let ctr = lambda() -> int { - block() { i = i + 1; }(); - ret i; - }; + let ctr = lambda () -> int { block () { i = i + 1; }(); ret i; }; log_err ctr(); log_err ctr(); log_err ctr(); diff --git a/src/test/compile-fail/lambda-mutate.rs b/src/test/compile-fail/lambda-mutate.rs index 24f4c75a853..cb891aad374 100644 --- a/src/test/compile-fail/lambda-mutate.rs +++ b/src/test/compile-fail/lambda-mutate.rs @@ -2,10 +2,7 @@ // Make sure we can't write to upvars from lambdas fn main() { let i = 0; - let ctr = lambda() -> int { - i = i + 1; - ret i; - }; + let ctr = lambda () -> int { i = i + 1; ret i; }; log_err ctr(); log_err ctr(); log_err ctr(); diff --git a/src/test/compile-fail/let-destruct-refutable.rs b/src/test/compile-fail/let-destruct-refutable.rs index 0217fb9cb40..d1796da9037 100644 --- a/src/test/compile-fail/let-destruct-refutable.rs +++ b/src/test/compile-fail/let-destruct-refutable.rs @@ -1,11 +1,8 @@ // error-pattern:refutable pattern -tag xx { - xx(int); - yy; -} +tag xx { xx(int); yy; } fn main() { - let @{x:xx(x), y} = @{x: xx(10), y: 20}; - assert x + y == 30; + let @{x: xx(x), y: y} = @{x: xx(10), y: 20}; + assert (x + y == 30); } diff --git a/src/test/compile-fail/macro-2.rs b/src/test/compile-fail/macro-2.rs index a11dd1f95f9..a802301756c 100644 --- a/src/test/compile-fail/macro-2.rs +++ b/src/test/compile-fail/macro-2.rs @@ -1,6 +1,10 @@ //error-pattern:is an expr, expected an identifier fn main() { - #macro([#mylambda(x, body), {fn f(x: int) -> int {ret body}; f}]); + #macro[[#mylambda[x, body], + { + fn f(x: int) -> int { ret body } + f + }]]; - assert(#mylambda(y*1, y*2)(8) == 16); -} \ No newline at end of file + assert (#mylambda[y * 1, y * 2](8) == 16); +} diff --git a/src/test/compile-fail/macro.rs b/src/test/compile-fail/macro.rs index a3f2df4f187..5943e575a48 100644 --- a/src/test/compile-fail/macro.rs +++ b/src/test/compile-fail/macro.rs @@ -1,7 +1,8 @@ //error-pattern:no clauses match fn main() { - #macro([#trivial(), 1*2*4*2*1]); + #macro[[#trivial[], 1 * 2 * 4 * 2 * 1]]; - assert(#trivial(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) == 16); + assert (#trivial[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] == + 16); } diff --git a/src/test/compile-fail/main-wrong-type-2.rs b/src/test/compile-fail/main-wrong-type-2.rs index 3e1e1fa1eef..e3d5ca40d08 100644 --- a/src/test/compile-fail/main-wrong-type-2.rs +++ b/src/test/compile-fail/main-wrong-type-2.rs @@ -1,2 +1,2 @@ // error-pattern:wrong type in main function: found fn() -> char -fn main() -> char { } \ No newline at end of file +fn main() -> char { } diff --git a/src/test/compile-fail/main-wrong-type.rs b/src/test/compile-fail/main-wrong-type.rs index 33d5c305204..2be4af77008 100644 --- a/src/test/compile-fail/main-wrong-type.rs +++ b/src/test/compile-fail/main-wrong-type.rs @@ -1,2 +1,2 @@ // error-pattern:wrong type in main function: found fn( -fn main(foo: {x: int, y: int}) { } \ No newline at end of file +fn main(foo: {x: int, y: int}) { } diff --git a/src/test/compile-fail/minus-string.rs b/src/test/compile-fail/minus-string.rs index def6124960e..e30a2dbe7df 100644 --- a/src/test/compile-fail/minus-string.rs +++ b/src/test/compile-fail/minus-string.rs @@ -1,5 +1,3 @@ // error-pattern:applying unary minus to non-numeric type str -fn main() { - -"foo"; -} \ No newline at end of file +fn main() { -"foo"; } diff --git a/src/test/compile-fail/missing-main.rs b/src/test/compile-fail/missing-main.rs index 1c59427fa9c..e531cbdc6cc 100644 --- a/src/test/compile-fail/missing-main.rs +++ b/src/test/compile-fail/missing-main.rs @@ -1,2 +1,2 @@ // error-pattern:main function not found -fn mian() { } \ No newline at end of file +fn mian() { } diff --git a/src/test/compile-fail/missing-return2.rs b/src/test/compile-fail/missing-return2.rs index af1612b1323..0fc48fd950a 100644 --- a/src/test/compile-fail/missing-return2.rs +++ b/src/test/compile-fail/missing-return2.rs @@ -7,4 +7,4 @@ fn f() -> int { alt true { true { } } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/move-arg.rs b/src/test/compile-fail/move-arg.rs index cd348231d91..9b60e5dae9a 100644 --- a/src/test/compile-fail/move-arg.rs +++ b/src/test/compile-fail/move-arg.rs @@ -1,10 +1,4 @@ // error-pattern: Unsatisfied precondition constraint -fn test(foo: -int) { - assert (foo == 10); -} +fn test(foo: -int) { assert (foo == 10); } -fn main() { - let x = 10; - test(x); - log x; -} \ No newline at end of file +fn main() { let x = 10; test(x); log x; } diff --git a/src/test/compile-fail/native-type-mismatch.rs b/src/test/compile-fail/native-type-mismatch.rs index daa2c9fa96b..ddb6375e36d 100644 --- a/src/test/compile-fail/native-type-mismatch.rs +++ b/src/test/compile-fail/native-type-mismatch.rs @@ -4,4 +4,4 @@ use std; fn main() { let f: std::os::libc::FILE = std::io::rustrt::rust_get_stdin(); std::os::libc::fopen(f, f); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/nested-ty-params.rs b/src/test/compile-fail/nested-ty-params.rs index 413ea883618..7a249c657fd 100644 --- a/src/test/compile-fail/nested-ty-params.rs +++ b/src/test/compile-fail/nested-ty-params.rs @@ -1,6 +1,6 @@ // error-pattern:Attempt to use a type argument out of scope fn hd<U>(v: &[U]) -> U { - fn hd1(w: &[U]) -> U { ret w.(0); } + fn hd1(w: &[U]) -> U { ret w[0]; } ret hd1(v); } diff --git a/src/test/compile-fail/no-constraint-prop.rs b/src/test/compile-fail/no-constraint-prop.rs index 2f98c4917b0..65e21baf78b 100644 --- a/src/test/compile-fail/no-constraint-prop.rs +++ b/src/test/compile-fail/no-constraint-prop.rs @@ -17,4 +17,4 @@ fn main() { // prestate. let d <- a; log safe_slice("kitties", b, d); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/no-self-dispatch.rs b/src/test/compile-fail/no-self-dispatch.rs index b23092b6409..876c668e8c6 100644 --- a/src/test/compile-fail/no-self-dispatch.rs +++ b/src/test/compile-fail/no-self-dispatch.rs @@ -3,4 +3,4 @@ obj oT() { fn get() -> int { ret 3; } fn foo() { let c = get(); } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/not-a-pred-2.rs b/src/test/compile-fail/not-a-pred-2.rs index 63aad9b37df..852db46e9df 100644 --- a/src/test/compile-fail/not-a-pred-2.rs +++ b/src/test/compile-fail/not-a-pred-2.rs @@ -7,4 +7,5 @@ fn main() { 2); // should fail to typecheck, as (a == b) // is not a manifest call -} \ No newline at end of file + +} diff --git a/src/test/compile-fail/not-a-pred-3.rs b/src/test/compile-fail/not-a-pred-3.rs index 5ec15e9c653..3ca98a5c1ce 100644 --- a/src/test/compile-fail/not-a-pred-3.rs +++ b/src/test/compile-fail/not-a-pred-3.rs @@ -10,4 +10,4 @@ fn main() { let z = f(); // should fail to typecheck, as z.g isn't an explicit name check (z.g(42)); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/not-a-pred-check.rs b/src/test/compile-fail/not-a-pred-check.rs index 20a0b5a7070..8ba91d0e26e 100644 --- a/src/test/compile-fail/not-a-pred-check.rs +++ b/src/test/compile-fail/not-a-pred-check.rs @@ -7,4 +7,4 @@ fn main() { let x = 0; check (f(x)); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/not-a-pred.rs b/src/test/compile-fail/not-a-pred.rs index 3e76ef9601c..80e227ffb16 100644 --- a/src/test/compile-fail/not-a-pred.rs +++ b/src/test/compile-fail/not-a-pred.rs @@ -1,8 +1,8 @@ // -*- rust -*- // error-pattern: Non-predicate in constraint: lt -fn f(a: int, b: int) : lt(a,b) { } +fn f(a: int, b: int) : lt(a, b) { } obj lt(a: int, b: int) { } -fn main() { let a: int = 10; let b: int = 23; check (lt(a, b)); f(a, b); } \ No newline at end of file +fn main() { let a: int = 10; let b: int = 23; check (lt(a, b)); f(a, b); } diff --git a/src/test/compile-fail/not-pred-args.rs b/src/test/compile-fail/not-pred-args.rs index e73cd18dac7..6ba399ba00c 100644 --- a/src/test/compile-fail/not-pred-args.rs +++ b/src/test/compile-fail/not-pred-args.rs @@ -8,4 +8,4 @@ fn main() { // should fail to typecheck, as pred args must be slot variables // or literals check (f(42 * 17)); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/occurs-check-2.rs b/src/test/compile-fail/occurs-check-2.rs index 20a4cf314c4..6c600158d21 100644 --- a/src/test/compile-fail/occurs-check-2.rs +++ b/src/test/compile-fail/occurs-check-2.rs @@ -1,6 +1,2 @@ // error-pattern: Type inference failed because I could not find -fn main() { - let f; - f = @f; - f(); -} \ No newline at end of file +fn main() { let f; f = @f; f(); } diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/compile-fail/occurs-check.rs index 16b2f94045e..aba5b5c5928 100644 --- a/src/test/compile-fail/occurs-check.rs +++ b/src/test/compile-fail/occurs-check.rs @@ -1,5 +1,2 @@ // error-pattern: Type inference failed because I could not find -fn main() { - let f; - f = @f; -} +fn main() { let f; f = @f; } diff --git a/src/test/compile-fail/or-init.rs b/src/test/compile-fail/or-init.rs index 8c952b0d93f..8103864c154 100644 --- a/src/test/compile-fail/or-init.rs +++ b/src/test/compile-fail/or-init.rs @@ -5,4 +5,4 @@ fn main() { log false || { i = 5; true }; log i; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/or-patter-mismatch.rs b/src/test/compile-fail/or-patter-mismatch.rs index d7525d7b627..dc71c2c1e42 100644 --- a/src/test/compile-fail/or-patter-mismatch.rs +++ b/src/test/compile-fail/or-patter-mismatch.rs @@ -2,4 +2,4 @@ tag blah { a(int, int, uint); b(int, int); } -fn main() { alt a(1, 1, 2u) { a(_, x, y) | b(x, y) { } } } \ No newline at end of file +fn main() { alt a(1, 1, 2u) { a(_, x, y) | b(x, y) { } } } diff --git a/src/test/compile-fail/output-type-mismatch.rs b/src/test/compile-fail/output-type-mismatch.rs index 38ee7b5a6be..c4ec5bef8c6 100644 --- a/src/test/compile-fail/output-type-mismatch.rs +++ b/src/test/compile-fail/output-type-mismatch.rs @@ -2,4 +2,4 @@ fn f() { } -fn main() { let i: int; i = f(); } \ No newline at end of file +fn main() { let i: int; i = f(); } diff --git a/src/test/compile-fail/pred-assign.rs b/src/test/compile-fail/pred-assign.rs index 0e5ddf23a47..10c6f1443ec 100644 --- a/src/test/compile-fail/pred-assign.rs +++ b/src/test/compile-fail/pred-assign.rs @@ -2,7 +2,7 @@ // error-pattern: Unsatisfied precondition constraint (for example, lt(a, b) -fn f(a: int, b: int) : lt(a,b) { } +fn f(a: int, b: int) : lt(a, b) { } pred lt(a: int, b: int) -> bool { ret a < b; } @@ -13,4 +13,4 @@ fn main() { check (lt(a, b)); a = 24; f(a, b); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/pred-not-bool.rs b/src/test/compile-fail/pred-not-bool.rs index 024ff5216f9..50344120a98 100644 --- a/src/test/compile-fail/pred-not-bool.rs +++ b/src/test/compile-fail/pred-not-bool.rs @@ -7,4 +7,4 @@ pred bad(a: int) -> int { ret 37; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/pred-on-wrong-slots.rs b/src/test/compile-fail/pred-on-wrong-slots.rs index de0faef653b..9e6c86c0737 100644 --- a/src/test/compile-fail/pred-on-wrong-slots.rs +++ b/src/test/compile-fail/pred-on-wrong-slots.rs @@ -2,7 +2,7 @@ // error-pattern: lt(a, c) -fn f(a: int, b: int) : lt(a,b) { } +fn f(a: int, b: int) : lt(a, b) { } pred lt(a: int, b: int) -> bool { ret a < b; } @@ -14,4 +14,4 @@ fn main() { check (lt(b, c)); f(a, b); f(a, c); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/pred-swap.rs b/src/test/compile-fail/pred-swap.rs index 9e96b74ad69..8fe7b19acf5 100644 --- a/src/test/compile-fail/pred-swap.rs +++ b/src/test/compile-fail/pred-swap.rs @@ -2,7 +2,7 @@ // error-pattern: Unsatisfied precondition constraint (for example, lt(a, b) -fn f(a: int, b: int) : lt(a,b) { } +fn f(a: int, b: int) : lt(a, b) { } pred lt(a: int, b: int) -> bool { ret a < b; } @@ -13,4 +13,4 @@ fn main() { check (lt(a, b)); b <-> a; f(a, b); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/rec-extend.rs b/src/test/compile-fail/rec-extend.rs index 773f06fb205..35f884fbff9 100644 --- a/src/test/compile-fail/rec-extend.rs +++ b/src/test/compile-fail/rec-extend.rs @@ -5,4 +5,4 @@ fn main() { let a = {foo: 0}; let b = {foo: true with a}; -} \ No newline at end of file +} diff --git a/src/test/compile-fail/rec-missing-fields.rs b/src/test/compile-fail/rec-missing-fields.rs index 50bf16c9a20..50bcf32dd7f 100644 --- a/src/test/compile-fail/rec-missing-fields.rs +++ b/src/test/compile-fail/rec-missing-fields.rs @@ -6,4 +6,4 @@ type point = {x: int, y: int}; -fn main() { let p: point = {x: 10}; log p.y; } \ No newline at end of file +fn main() { let p: point = {x: 10}; log p.y; } diff --git a/src/test/compile-fail/ret-non-nil.rs b/src/test/compile-fail/ret-non-nil.rs index 7c483ed4194..71db7e4192f 100644 --- a/src/test/compile-fail/ret-non-nil.rs +++ b/src/test/compile-fail/ret-non-nil.rs @@ -4,4 +4,4 @@ fn f() { ret; } fn g() -> int { ret; } -fn main() { f(); g(); } \ No newline at end of file +fn main() { f(); g(); } diff --git a/src/test/compile-fail/return-uninit.rs b/src/test/compile-fail/return-uninit.rs index 34b7a6b5af0..1978ec5f420 100644 --- a/src/test/compile-fail/return-uninit.rs +++ b/src/test/compile-fail/return-uninit.rs @@ -2,4 +2,4 @@ fn f() -> int { let x: int; ret x; } -fn main() { f(); } \ No newline at end of file +fn main() { f(); } diff --git a/src/test/compile-fail/self-call-non-obj.rs b/src/test/compile-fail/self-call-non-obj.rs index 6fd8bee270b..6261fda60ac 100644 --- a/src/test/compile-fail/self-call-non-obj.rs +++ b/src/test/compile-fail/self-call-non-obj.rs @@ -7,4 +7,4 @@ fn main() { self.foo(); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/slot-as-pred.rs b/src/test/compile-fail/slot-as-pred.rs index 0220a16f087..820ebd655f5 100644 --- a/src/test/compile-fail/slot-as-pred.rs +++ b/src/test/compile-fail/slot-as-pred.rs @@ -1,7 +1,7 @@ // -*- rust -*- // error-pattern: unresolved name: lt -fn f(a: int, b: int) : lt(a,b) { } +fn f(a: int, b: int) : lt(a, b) { } fn main() { let lt: int; @@ -9,4 +9,4 @@ fn main() { let b: int = 23; check (lt(a, b)); f(a, b); -} \ No newline at end of file +} diff --git a/src/test/compile-fail/spawn-non-nil-fn.rs b/src/test/compile-fail/spawn-non-nil-fn.rs index dfc5471f4de..4d3d13373dc 100644 --- a/src/test/compile-fail/spawn-non-nil-fn.rs +++ b/src/test/compile-fail/spawn-non-nil-fn.rs @@ -5,4 +5,4 @@ import std::task; fn f(x: int) -> int { ret x; } -fn main() { task::_spawn(bind f(10)); } \ No newline at end of file +fn main() { task::_spawn(bind f(10)); } diff --git a/src/test/compile-fail/swap-no-lval.rs b/src/test/compile-fail/swap-no-lval.rs index a45f524fe09..2bb54464157 100644 --- a/src/test/compile-fail/swap-no-lval.rs +++ b/src/test/compile-fail/swap-no-lval.rs @@ -1,3 +1,3 @@ // error-pattern: assignment to non-lvalue -fn main() { 5 <-> 3; } \ No newline at end of file +fn main() { 5 <-> 3; } diff --git a/src/test/compile-fail/swap-uninit.rs b/src/test/compile-fail/swap-uninit.rs index e06d539702b..27fdc611379 100644 --- a/src/test/compile-fail/swap-uninit.rs +++ b/src/test/compile-fail/swap-uninit.rs @@ -1,3 +1,3 @@ // error-pattern:Unsatisfied precondition -fn main() { let x = 3; let y; x <-> y; } \ No newline at end of file +fn main() { let x = 3; let y; x <-> y; } diff --git a/src/test/compile-fail/tail-typeck.rs b/src/test/compile-fail/tail-typeck.rs index 7dd315b929b..c121458f233 100644 --- a/src/test/compile-fail/tail-typeck.rs +++ b/src/test/compile-fail/tail-typeck.rs @@ -4,4 +4,4 @@ fn f() -> int { be g(); } fn g() -> uint { ret 0u; } -fn main() { let y = f(); } \ No newline at end of file +fn main() { let y = f(); } diff --git a/src/test/compile-fail/type-arg-out-of-scope.rs b/src/test/compile-fail/type-arg-out-of-scope.rs index a3ae6619b3e..19be0933c48 100644 --- a/src/test/compile-fail/type-arg-out-of-scope.rs +++ b/src/test/compile-fail/type-arg-out-of-scope.rs @@ -1,5 +1,5 @@ // error-pattern:Attempt to use a type argument out of scope fn foo<T>(x: &T) { - fn bar(f: fn(&T) -> T ) { } + fn bar(f: fn(&T) -> T) { } } fn main() { foo(1); } diff --git a/src/test/compile-fail/type-mismatch-multiple.rs b/src/test/compile-fail/type-mismatch-multiple.rs index 9a7a4b588a7..363af271986 100644 --- a/src/test/compile-fail/type-mismatch-multiple.rs +++ b/src/test/compile-fail/type-mismatch-multiple.rs @@ -2,4 +2,4 @@ // error-pattern:mismatched types: expected bool // error-pattern:mismatched types: expected int -fn main() { let a: bool = 1; let b: int = true; } \ No newline at end of file +fn main() { let a: bool = 1; let b: int = true; } diff --git a/src/test/compile-fail/type-mismatch.rs b/src/test/compile-fail/type-mismatch.rs index a0e257dcd8f..d2ddf61b0bc 100644 --- a/src/test/compile-fail/type-mismatch.rs +++ b/src/test/compile-fail/type-mismatch.rs @@ -1,4 +1,4 @@ // error-pattern:expected bool but found int // issue #516 -fn main() { let x = true; let y = 1; let z = x + y; } \ No newline at end of file +fn main() { let x = true; let y = 1; let z = x + y; } diff --git a/src/test/compile-fail/type-recursive.rs b/src/test/compile-fail/type-recursive.rs index d7ba8faa288..c38c6f5d244 100644 --- a/src/test/compile-fail/type-recursive.rs +++ b/src/test/compile-fail/type-recursive.rs @@ -1,4 +1,4 @@ // error-pattern:illegal recursive type type t1 = {foo: int, foolish: t1}; -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/type-shadow.rs b/src/test/compile-fail/type-shadow.rs index 52022cf67fc..9f26de765be 100644 --- a/src/test/compile-fail/type-shadow.rs +++ b/src/test/compile-fail/type-shadow.rs @@ -9,4 +9,4 @@ fn main() { type X = str; let y: Y = "hello"; } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/unreachable-arm.rs b/src/test/compile-fail/unreachable-arm.rs index eaf5d75702f..ee637fed666 100644 --- a/src/test/compile-fail/unreachable-arm.rs +++ b/src/test/compile-fail/unreachable-arm.rs @@ -2,4 +2,4 @@ tag foo { a(@foo, int); b(uint); } -fn main() { alt b(1u) { b(_) | a(@_, 1) { } a(_, 1) { } } } \ No newline at end of file +fn main() { alt b(1u) { b(_) | a(@_, 1) { } a(_, 1) { } } } diff --git a/src/test/compile-fail/unsafe-alias-2.rs b/src/test/compile-fail/unsafe-alias-2.rs index 3917dd3f883..ad7296ef1b4 100644 --- a/src/test/compile-fail/unsafe-alias-2.rs +++ b/src/test/compile-fail/unsafe-alias-2.rs @@ -5,4 +5,4 @@ fn whoknows(x: @mutable int) { *x = 10; } fn main() { let box = @mutable 1; alt *box { x { whoknows(box); log_err x; } } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/unsafe-alias.rs b/src/test/compile-fail/unsafe-alias.rs index 46fb135b951..80eaa661d1d 100644 --- a/src/test/compile-fail/unsafe-alias.rs +++ b/src/test/compile-fail/unsafe-alias.rs @@ -1,7 +1,7 @@ // error-pattern:may alias with argument -fn foo(x: &int, f: fn() ) { log x; } +fn foo(x: &int, f: fn()) { log x; } fn whoknows(x: @mutable int) { *x = 10; } -fn main() { let box = @mutable 1; foo(*box, bind whoknows(box)); } \ No newline at end of file +fn main() { let box = @mutable 1; foo(*box, bind whoknows(box)); } diff --git a/src/test/compile-fail/unsafe-alt.rs b/src/test/compile-fail/unsafe-alt.rs index 2e0605fa055..fb42b188a7c 100644 --- a/src/test/compile-fail/unsafe-alt.rs +++ b/src/test/compile-fail/unsafe-alt.rs @@ -5,4 +5,4 @@ tag foo { left(int); right(bool); } fn main() { let x = left(10); alt x { left(i) { x = right(false); log i; } _ { } } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/unsafe-for.rs b/src/test/compile-fail/unsafe-for.rs index 43e8b9cb7c2..22d5396c1cb 100644 --- a/src/test/compile-fail/unsafe-for.rs +++ b/src/test/compile-fail/unsafe-for.rs @@ -1,6 +1,6 @@ // error-pattern:invalidate alias x fn main() { - let v: [mutable int] = ~[mutable 1, 2, 3]; - for x: int in v { v.(0) = 10; log x; } + let v: [mutable int] = [mutable 1, 2, 3]; + for x: int in v { v[0] = 10; log x; } } diff --git a/src/test/compile-fail/unsafe-mutable-alias.rs b/src/test/compile-fail/unsafe-mutable-alias.rs index f438d021a25..2f2a395778e 100644 --- a/src/test/compile-fail/unsafe-mutable-alias.rs +++ b/src/test/compile-fail/unsafe-mutable-alias.rs @@ -2,4 +2,4 @@ fn f(a: &int, b: &mutable int) -> int { b += 1; ret a + b; } -fn main() { let i = 4; log f(i, i); } \ No newline at end of file +fn main() { let i = 4; log f(i, i); } diff --git a/src/test/compile-fail/use-after-move.rs b/src/test/compile-fail/use-after-move.rs index ff20307fece..3fb1827441e 100644 --- a/src/test/compile-fail/use-after-move.rs +++ b/src/test/compile-fail/use-after-move.rs @@ -1,2 +1,2 @@ // error-pattern: Unsatisfied precondition constraint (for example, init(x -fn main() { let x = @5; let y <- x; log *x; } \ No newline at end of file +fn main() { let x = @5; let y <- x; log *x; } diff --git a/src/test/compile-fail/use-after-send.rs b/src/test/compile-fail/use-after-send.rs index 212fa50a506..965c262237d 100644 --- a/src/test/compile-fail/use-after-send.rs +++ b/src/test/compile-fail/use-after-send.rs @@ -1,9 +1,5 @@ // error-pattern: Unsatisfied precondition constraint -fn send<~T>(ch : _chan<T>, data : -T) { - log ch; - log data; - fail; -} +fn send<~T>(ch: _chan<T>, data: -T) { log ch; log data; fail; } type _chan<T> = int; // Tests that "log message;" is flagged as using @@ -13,6 +9,4 @@ fn test00_start(ch: _chan<int>, message: int, count: int) { log message; } -fn main() { - fail; -} \ No newline at end of file +fn main() { fail; } diff --git a/src/test/compile-fail/use-meta-dup.rs b/src/test/compile-fail/use-meta-dup.rs index 5e44999b595..04d67263c36 100644 --- a/src/test/compile-fail/use-meta-dup.rs +++ b/src/test/compile-fail/use-meta-dup.rs @@ -2,4 +2,4 @@ use std(name = "std", name = "nonstd"); -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/use-meta-mismatch.rs b/src/test/compile-fail/use-meta-mismatch.rs index a2adca83cd4..fef50525a1e 100644 --- a/src/test/compile-fail/use-meta-mismatch.rs +++ b/src/test/compile-fail/use-meta-mismatch.rs @@ -2,4 +2,4 @@ use std(complex(meta(item))); -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/use-uninit-2.rs b/src/test/compile-fail/use-uninit-2.rs index d46c340a9df..4d35567ea4f 100644 --- a/src/test/compile-fail/use-uninit-2.rs +++ b/src/test/compile-fail/use-uninit-2.rs @@ -2,4 +2,4 @@ fn foo(x: int) { log x; } -fn main() { let x: int; if 1 > 2 { x = 10; } foo(x); } \ No newline at end of file +fn main() { let x: int; if 1 > 2 { x = 10; } foo(x); } diff --git a/src/test/compile-fail/use-uninit-3.rs b/src/test/compile-fail/use-uninit-3.rs index cf680f0c184..5b7c619f36f 100644 --- a/src/test/compile-fail/use-uninit-3.rs +++ b/src/test/compile-fail/use-uninit-3.rs @@ -2,4 +2,4 @@ fn foo(x: int) { log x; } -fn main() { let x: int; if 1 > 2 { log "whoops"; } else { x = 10; } foo(x); } \ No newline at end of file +fn main() { let x: int; if 1 > 2 { log "whoops"; } else { x = 10; } foo(x); } diff --git a/src/test/compile-fail/use-uninit.rs b/src/test/compile-fail/use-uninit.rs index b787947fe7b..75e60bdbce3 100644 --- a/src/test/compile-fail/use-uninit.rs +++ b/src/test/compile-fail/use-uninit.rs @@ -2,4 +2,4 @@ fn foo(x: int) { log x; } -fn main() { let x: int; foo(x); } \ No newline at end of file +fn main() { let x: int; foo(x); } diff --git a/src/test/compile-fail/vec-field.rs b/src/test/compile-fail/vec-field.rs index 10a222f5cd0..1ec888670c4 100644 --- a/src/test/compile-fail/vec-field.rs +++ b/src/test/compile-fail/vec-field.rs @@ -2,7 +2,7 @@ // issue #367 fn f() { - let v = ~[1]; + let v = [1]; log v.some_field_name; //type error } diff --git a/src/test/compile-fail/vector-no-ann.rs b/src/test/compile-fail/vector-no-ann.rs index 087fa20d076..80463e3ead3 100644 --- a/src/test/compile-fail/vector-no-ann.rs +++ b/src/test/compile-fail/vector-no-ann.rs @@ -1,2 +1,2 @@ // error-pattern:cannot determine a type -fn main() { let foo = []; } \ No newline at end of file +fn main() { let foo = []; } diff --git a/src/test/compile-fail/while-bypass.rs b/src/test/compile-fail/while-bypass.rs index 7fa5ccb37a5..e70090dd59e 100644 --- a/src/test/compile-fail/while-bypass.rs +++ b/src/test/compile-fail/while-bypass.rs @@ -2,4 +2,4 @@ fn f() -> int { let x: int; while true { x = 10; } ret x; } -fn main() { f(); } \ No newline at end of file +fn main() { f(); } diff --git a/src/test/compile-fail/while-expr.rs b/src/test/compile-fail/while-expr.rs index 8da769a29fd..5ff3adf34c3 100644 --- a/src/test/compile-fail/while-expr.rs +++ b/src/test/compile-fail/while-expr.rs @@ -1,3 +1,3 @@ // error-pattern: precondition constraint -fn main() { let x: bool; while x { } } \ No newline at end of file +fn main() { let x: bool; while x { } } diff --git a/src/test/compile-fail/while-loop-constraints.rs b/src/test/compile-fail/while-loop-constraints.rs index 9d936f62fdb..557ff099cbf 100644 --- a/src/test/compile-fail/while-loop-constraints.rs +++ b/src/test/compile-fail/while-loop-constraints.rs @@ -4,4 +4,4 @@ fn main() { let y: int = 42; let x: int; while true { log y; while true { while true { while true { x <- y; } } } } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/while-loop-pred-constraints.rs b/src/test/compile-fail/while-loop-pred-constraints.rs index 43e662d643c..5920d25230f 100644 --- a/src/test/compile-fail/while-loop-pred-constraints.rs +++ b/src/test/compile-fail/while-loop-pred-constraints.rs @@ -13,4 +13,4 @@ fn main() { print_even(y); while true { while true { while true { y += x; } } } } -} \ No newline at end of file +} diff --git a/src/test/compile-fail/writing-through-read-alias.rs b/src/test/compile-fail/writing-through-read-alias.rs index bc3f9037da9..2cfcb31ccbc 100644 --- a/src/test/compile-fail/writing-through-read-alias.rs +++ b/src/test/compile-fail/writing-through-read-alias.rs @@ -6,4 +6,4 @@ type point = {x: int, y: int, z: int}; fn f(p: &point) { p.x = 13; } -fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); } \ No newline at end of file +fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); } diff --git a/src/test/compile-fail/writing-through-uninit-vec.rs b/src/test/compile-fail/writing-through-uninit-vec.rs index 7397773d940..0462824c276 100644 --- a/src/test/compile-fail/writing-through-uninit-vec.rs +++ b/src/test/compile-fail/writing-through-uninit-vec.rs @@ -1,5 +1,5 @@ // error-pattern: Unsatisfied precondition constraint -fn test() { let w: [int]; w.(5) = 0; } +fn test() { let w: [int]; w[5] = 0; } fn main() { test(); } diff --git a/src/test/compile-fail/writing-to-immutable-obj.rs b/src/test/compile-fail/writing-to-immutable-obj.rs index 484afd91a3e..cc35f545120 100644 --- a/src/test/compile-fail/writing-to-immutable-obj.rs +++ b/src/test/compile-fail/writing-to-immutable-obj.rs @@ -2,4 +2,4 @@ obj objy(x: int) { fn foo() { x = 5; } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compile-fail/writing-to-immutable-rec.rs b/src/test/compile-fail/writing-to-immutable-rec.rs index c40c6934f5c..ad0ceed8ee3 100644 --- a/src/test/compile-fail/writing-to-immutable-rec.rs +++ b/src/test/compile-fail/writing-to-immutable-rec.rs @@ -1,2 +1,2 @@ // error-pattern: assignment to immutable field -fn main() { let r: {x: int} = {x: 1}; r.x = 6; } \ No newline at end of file +fn main() { let r: {x: int} = {x: 1}; r.x = 6; } diff --git a/src/test/compile-fail/writing-to-immutable-vec.rs b/src/test/compile-fail/writing-to-immutable-vec.rs index d800288dd92..6f0f7c53504 100644 --- a/src/test/compile-fail/writing-to-immutable-vec.rs +++ b/src/test/compile-fail/writing-to-immutable-vec.rs @@ -1,2 +1,2 @@ // error-pattern:assignment to immutable vec content -fn main() { let v: [int] = ~[1, 2, 3]; v.(1) = 4; } +fn main() { let v: [int] = [1, 2, 3]; v[1] = 4; } diff --git a/src/test/compile-fail/wrong-ret-type.rs b/src/test/compile-fail/wrong-ret-type.rs index b4435086cdd..82293a8f706 100644 --- a/src/test/compile-fail/wrong-ret-type.rs +++ b/src/test/compile-fail/wrong-ret-type.rs @@ -1,3 +1,3 @@ // error-pattern: mismatched types fn mk_int() -> uint { let i: int = 3; ret i; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/compiletest/common.rs b/src/test/compiletest/common.rs index 85b7be9b00f..ab0415fd7c1 100644 --- a/src/test/compiletest/common.rs +++ b/src/test/compiletest/common.rs @@ -1,38 +1,32 @@ import std::option; -tag mode { - mode_compile_fail; - mode_run_fail; - mode_run_pass; - mode_pretty; -} +tag mode { mode_compile_fail; mode_run_fail; mode_run_pass; mode_pretty; } -type config = { +type config = // The library paths required for running the compiler - compile_lib_path: str, // The library paths required for running compiled programs - run_lib_path: str, // The rustc executable - rustc_path: str, // The directory containing the tests to run - src_base: str, // The directory where programs should be built - build_base: str, // The name of the stage being built (stage1, etc) - stage_id: str, // The test mode, compile-fail, run-fail, run-pass - mode: mode, // Run ignored tests - run_ignored: bool, // Only run tests that match this filter - filter: option::t<str>, // A command line to prefix program execution with, // for running under valgrind - runtool: option::t<str>, // Flags to pass to the compiler - rustcflags: option::t<str>, // Explain what's going on - verbose: bool -}; + {compile_lib_path: str, + run_lib_path: str, + rustc_path: str, + src_base: str, + build_base: str, + stage_id: str, + mode: mode, + run_ignored: bool, + filter: option::t<str>, + runtool: option::t<str>, + rustcflags: option::t<str>, + verbose: bool}; type cx = {config: config, procsrv: procsrv::handle}; diff --git a/src/test/compiletest/compiletest.rs b/src/test/compiletest/compiletest.rs index 9bbc30de519..d045875e295 100644 --- a/src/test/compiletest/compiletest.rs +++ b/src/test/compiletest/compiletest.rs @@ -31,12 +31,12 @@ fn main(args: [str]) { fn parse_config(args: &[str]) -> config { let opts = - ~[getopts::reqopt("compile-lib-path"), - getopts::reqopt("run-lib-path"), getopts::reqopt("rustc-path"), - getopts::reqopt("src-base"), getopts::reqopt("build-base"), - getopts::reqopt("stage-id"), getopts::reqopt("mode"), - getopts::optflag("ignored"), getopts::optopt("runtool"), - getopts::optopt("rustcflags"), getopts::optflag("verbose")]; + [getopts::reqopt("compile-lib-path"), getopts::reqopt("run-lib-path"), + getopts::reqopt("rustc-path"), getopts::reqopt("src-base"), + getopts::reqopt("build-base"), getopts::reqopt("stage-id"), + getopts::reqopt("mode"), getopts::optflag("ignored"), + getopts::optopt("runtool"), getopts::optopt("rustcflags"), + getopts::optflag("verbose")]; check (vec::is_not_empty(args)); let args_ = vec::tail(args); @@ -56,7 +56,7 @@ fn parse_config(args: &[str]) -> config { run_ignored: getopts::opt_present(match, "ignored"), filter: if vec::len(match.free) > 0u { - option::some(match.free.(0)) + option::some(match.free[0]) } else { option::none }, runtool: getopts::opt_maybe_str(match, "runtool"), rustcflags: getopts::opt_maybe_str(match, "rustcflags"), @@ -65,20 +65,20 @@ fn parse_config(args: &[str]) -> config { fn log_config(config: &config) { let c = config; - logv(c, #fmt("configuration:")); - logv(c, #fmt("compile_lib_path: %s", config.compile_lib_path)); - logv(c, #fmt("run_lib_path: %s", config.run_lib_path)); - logv(c, #fmt("rustc_path: %s", config.rustc_path)); - logv(c, #fmt("src_base: %s", config.src_base)); - logv(c, #fmt("build_base: %s", config.build_base)); - logv(c, #fmt("stage_id: %s", config.stage_id)); - logv(c, #fmt("mode: %s", mode_str(config.mode))); - logv(c, #fmt("run_ignored: %b", config.run_ignored)); - logv(c, #fmt("filter: %s", opt_str(config.filter))); - logv(c, #fmt("runtool: %s", opt_str(config.runtool))); - logv(c, #fmt("rustcflags: %s", opt_str(config.rustcflags))); - logv(c, #fmt("verbose: %b", config.verbose)); - logv(c, #fmt("\n")); + logv(c, #fmt["configuration:"]); + logv(c, #fmt["compile_lib_path: %s", config.compile_lib_path]); + logv(c, #fmt["run_lib_path: %s", config.run_lib_path]); + logv(c, #fmt["rustc_path: %s", config.rustc_path]); + logv(c, #fmt["src_base: %s", config.src_base]); + logv(c, #fmt["build_base: %s", config.build_base]); + logv(c, #fmt["stage_id: %s", config.stage_id]); + logv(c, #fmt["mode: %s", mode_str(config.mode)]); + logv(c, #fmt["run_ignored: %b", config.run_ignored]); + logv(c, #fmt["filter: %s", opt_str(config.filter)]); + logv(c, #fmt["runtool: %s", opt_str(config.runtool)]); + logv(c, #fmt["rustcflags: %s", opt_str(config.rustcflags)]); + logv(c, #fmt["verbose: %b", config.verbose]); + logv(c, #fmt["\n"]); } fn opt_str(maybestr: option::t<str>) -> str { @@ -121,16 +121,16 @@ fn test_opts(config: &config) -> test::test_opts { } type tests_and_conv_fn = - {tests: [test::test_desc], to_task: fn(&fn() ) -> test::joinable }; + {tests: [test::test_desc], to_task: fn(&fn()) -> test::joinable}; fn make_tests(cx: &cx) -> tests_and_conv_fn { - log #fmt("making tests from %s", cx.config.src_base); + log #fmt["making tests from %s", cx.config.src_base]; let configport = mk_port::<[u8]>(); - let tests = ~[]; + let tests = []; for file: str in fs::list_dir(cx.config.src_base) { - log #fmt("inspecting file %s", file); + log #fmt["inspecting file %s", file]; if is_test(cx.config, file) { - tests += ~[make_test(cx, file, configport)]; + tests += [make_test(cx, file, configport)]; } } ret {tests: tests, to_task: bind closure_to_task(cx, configport, _)}; @@ -138,11 +138,9 @@ fn make_tests(cx: &cx) -> tests_and_conv_fn { fn is_test(config: &config, testfile: &str) -> bool { // Pretty-printer does not work with .rc files yet - let valid_extensions = alt config.mode { - mode_pretty. { ~[".rs"] } - _ { ~[".rc", ".rs"] } - }; - let invalid_prefixes = ~[".", "#", "~"]; + let valid_extensions = + alt config.mode { mode_pretty. { [".rs"] } _ { [".rc", ".rs"] } }; + let invalid_prefixes = [".", "#", "~"]; let name = fs::basename(testfile); let valid = false; @@ -166,7 +164,7 @@ fn make_test(cx: &cx, testfile: &str, configport: &_port<[u8]>) -> } fn make_test_name(config: &config, testfile: &str) -> str { - #fmt("[%s] %s", mode_str(config.mode), testfile) + #fmt["[%s] %s", mode_str(config.mode), testfile] } /* @@ -188,8 +186,8 @@ up. Then we'll spawn that data into another task and return the task. Really convoluted. Need to think up of a better definition for tests. */ -fn make_test_closure(testfile: &str, configchan: _chan<[u8]>) -> test::test_fn -{ +fn make_test_closure(testfile: &str, configchan: _chan<[u8]>) -> + test::test_fn { bind send_config(testfile, configchan) } @@ -207,25 +205,19 @@ break up the config record and pass everything individually to the spawned function. */ -fn closure_to_task(cx: cx, configport: _port<[u8]>, testfn: &fn() ) - -> test::joinable -{ +fn closure_to_task(cx: cx, configport: _port<[u8]>, testfn: &fn()) -> + test::joinable { testfn(); let testfile = configport.recv(); - let testthunk = bind run_test_task(cx.config.compile_lib_path, - cx.config.run_lib_path, - cx.config.rustc_path, - cx.config.src_base, - cx.config.build_base, - cx.config.stage_id, - mode_str(cx.config.mode), - cx.config.run_ignored, - opt_str(cx.config.filter), - opt_str(cx.config.runtool), - opt_str(cx.config.rustcflags), - cx.config.verbose, - cx.procsrv.chan, - testfile); + let testthunk = + bind run_test_task(cx.config.compile_lib_path, cx.config.run_lib_path, + cx.config.rustc_path, cx.config.src_base, + cx.config.build_base, cx.config.stage_id, + mode_str(cx.config.mode), cx.config.run_ignored, + opt_str(cx.config.filter), + opt_str(cx.config.runtool), + opt_str(cx.config.rustcflags), cx.config.verbose, + cx.procsrv.chan, testfile); ret task::spawn_joinable(testthunk); } diff --git a/src/test/compiletest/procsrv.rs b/src/test/compiletest/procsrv.rs index d434562cf3c..6e464038b18 100644 --- a/src/test/compiletest/procsrv.rs +++ b/src/test/compiletest/procsrv.rs @@ -30,24 +30,20 @@ type reqchan = chan<request>; type handle = {task: option::t<task_id>, chan: reqchan}; -tag request { - exec([u8], [u8], [[u8]], chan<response>); - stop; -} +tag request { exec([u8], [u8], [[u8]], chan<response>); stop; } type response = {pid: int, infd: int, outfd: int, errfd: int}; fn mk() -> handle { let setupport = port(); - let task = task::spawn(bind fn(setupchan: chan<chan<request>>) { - let reqport = port(); - let reqchan = chan(reqport); - send(setupchan, reqchan); - worker(reqport); - } (chan(setupport))); - ret {task: option::some(task), - chan: recv(setupport) - }; + let task = + task::spawn(bind fn (setupchan: chan<chan<request>>) { + let reqport = port(); + let reqchan = chan(reqport); + send(setupchan, reqchan); + worker(reqport); + }(chan(setupport))); + ret {task: option::some(task), chan: recv(setupport)}; } fn from_chan(ch: &reqchan) -> handle { {task: option::none, chan: ch} } @@ -57,15 +53,13 @@ fn close(handle: &handle) { task::join_id(option::get(handle.task)); } -fn run(handle: &handle, lib_path: &str, - prog: &str, args: &[str], input: &option::t<str>) -> -{status: int, out: str, err: str} { +fn run(handle: &handle, lib_path: &str, prog: &str, args: &[str], + input: &option::t<str>) -> {status: int, out: str, err: str} { let p = port(); let ch = chan(p); - send(handle.chan, exec(str::bytes(lib_path), - str::bytes(prog), - clone_vecstr(args), - ch)); + send(handle.chan, + exec(str::bytes(lib_path), str::bytes(prog), clone_vecstr(args), + ch)); let resp = recv(p); writeclose(resp.infd, input); @@ -77,8 +71,7 @@ fn run(handle: &handle, lib_path: &str, fn writeclose(fd: int, s: &option::t<str>) { if option::is_some(s) { - let writer = io::new_writer( - io::fd_buf_writer(fd, option::none)); + let writer = io::new_writer(io::fd_buf_writer(fd, option::none)); writer.write_str(option::get(s)); } @@ -88,8 +81,7 @@ fn writeclose(fd: int, s: &option::t<str>) { fn readclose(fd: int) -> str { // Copied from run::program_output let file = os::fd_FILE(fd); - let reader = io::new_reader( - io::FILE_buf_reader(file, option::none)); + let reader = io::new_reader(io::FILE_buf_reader(file, option::none)); let buf = ""; while !reader.eof() { let bytes = reader.read_bytes(4096u); @@ -112,35 +104,32 @@ fn worker(p: port<request>) { // the receiver's poniters outlive the sender's. Here we clone // everything and let the originals go out of scope before sending // a response. - execparms = { - // FIXME (785): The 'discriminant' of an alt expression has - // the same scope as the alt expression itself, so we have to - // put the entire alt in another block to make sure the exec - // message goes out of scope. Seems like the scoping rules for - // the alt discriminant are wrong. - alt recv(p) { - exec(lib_path, prog, args, respchan) { - { - lib_path: str::unsafe_from_bytes(lib_path), - prog: str::unsafe_from_bytes(prog), - args: clone_vecu8str(args), - respchan: respchan + execparms = + { + + // FIXME (785): The 'discriminant' of an alt expression has + // the same scope as the alt expression itself, so we have to + // put the entire alt in another block to make sure the exec + // message goes out of scope. Seems like the scoping rules for + // the alt discriminant are wrong. + alt recv(p) { + exec(lib_path, prog, args, respchan) { + {lib_path: str::unsafe_from_bytes(lib_path), + prog: str::unsafe_from_bytes(prog), + args: clone_vecu8str(args), + respchan: respchan} + } + stop. { ret } } - } - stop. { ret } - } - }; + }; // This is copied from run::start_program let pipe_in = os::pipe(); let pipe_out = os::pipe(); let pipe_err = os::pipe(); let spawnproc = - bind run::spawn_process(execparms.prog, - execparms.args, - pipe_in.in, - pipe_out.out, - pipe_err.out); + bind run::spawn_process(execparms.prog, execparms.args, + pipe_in.in, pipe_out.out, pipe_err.out); let pid = with_lib_path(execparms.lib_path, spawnproc); os::libc::close(pipe_in.in); @@ -161,7 +150,7 @@ fn worker(p: port<request>) { } } -fn with_lib_path<T>(path: &str, f: fn() -> T ) -> T { +fn with_lib_path<T>(path: &str, f: fn() -> T) -> T { let maybe_oldpath = getenv(util::lib_path_env_var()); append_lib_path(path); let res = f(); @@ -179,17 +168,15 @@ fn append_lib_path(path: &str) { export_lib_path(util::make_new_path(path)); } fn export_lib_path(path: &str) { setenv(util::lib_path_env_var(), path); } fn clone_vecstr(v: &[str]) -> [[u8]] { - let r = ~[]; - for t: str in vec::slice(v, 0u, vec::len(v)) { - r += ~[str::bytes(t)]; - } + let r = []; + for t: str in vec::slice(v, 0u, vec::len(v)) { r += [str::bytes(t)]; } ret r; } fn clone_vecu8str(v: &[[u8]]) -> [str] { - let r = ~[]; + let r = []; for t in vec::slice(v, 0u, vec::len(v)) { - r += ~[str::unsafe_from_bytes(t)]; + r += [str::unsafe_from_bytes(t)]; } ret r; } diff --git a/src/test/compiletest/runtest.rs b/src/test/compiletest/runtest.rs index c56ec6970ef..c3572e20cba 100644 --- a/src/test/compiletest/runtest.rs +++ b/src/test/compiletest/runtest.rs @@ -20,11 +20,11 @@ export run; fn run(cx: &cx, _testfile: -[u8]) { let testfile = str::unsafe_from_bytes(_testfile); - if (cx.config.verbose) { + if cx.config.verbose { // We're going to be dumping a lot of info. Start on a new line. io::stdout().write_str("\n\n"); } - log #fmt("running %s", testfile); + log #fmt["running %s", testfile]; let props = load_props(testfile); alt cx.config.mode { mode_compile_fail. { run_cfail_test(cx, props, testfile); } @@ -38,8 +38,7 @@ fn run_cfail_test(cx: &cx, props: &test_props, testfile: &str) { let procres = compile_test(cx, props, testfile); if procres.status == 0 { - fatal_procres("compile-fail test compiled successfully!", - procres); + fatal_procres("compile-fail test compiled successfully!", procres); } check_error_patterns(props, testfile, procres); @@ -48,14 +47,12 @@ fn run_cfail_test(cx: &cx, props: &test_props, testfile: &str) { fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) { let procres = compile_test(cx, props, testfile); - if procres.status != 0 { - fatal_procres("compilation failed!", procres); } + if procres.status != 0 { fatal_procres("compilation failed!", procres); } procres = exec_compiled_test(cx, props, testfile); if procres.status == 0 { - fatal_procres("run-fail test didn't produce an error!", - procres); + fatal_procres("run-fail test didn't produce an error!", procres); } // This is the value valgrind returns on failure @@ -73,8 +70,7 @@ fn run_rfail_test(cx: &cx, props: &test_props, testfile: &str) { fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) { let procres = compile_test(cx, props, testfile); - if procres.status != 0 { - fatal_procres("compilation failed!", procres); } + if procres.status != 0 { fatal_procres("compilation failed!", procres); } procres = exec_compiled_test(cx, props, testfile); @@ -85,46 +81,41 @@ fn run_rpass_test(cx: &cx, props: &test_props, testfile: &str) { fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) { if option::is_some(props.pp_exact) { logv(cx.config, "testing for exact pretty-printing"); - } else { - logv(cx.config, "testing for converging pretty-printing"); - } + } else { logv(cx.config, "testing for converging pretty-printing"); } - let rounds = alt props.pp_exact { - option::some(_) { 1 } - option::none. { 2 } - }; + let rounds = + alt props.pp_exact { option::some(_) { 1 } option::none. { 2 } }; - let srcs = ~[io::read_whole_file_str(testfile)]; + let srcs = [io::read_whole_file_str(testfile)]; let round = 0; while round < rounds { - logv(cx.config, #fmt("pretty-printing round %d", round)); - let procres = print_source(cx, testfile, srcs.(round)); + logv(cx.config, #fmt["pretty-printing round %d", round]); + let procres = print_source(cx, testfile, srcs[round]); if procres.status != 0 { - fatal_procres(#fmt("pretty-printing failed in round %d", round), + fatal_procres(#fmt["pretty-printing failed in round %d", round], procres); } - srcs += ~[procres.stdout]; + srcs += [procres.stdout]; round += 1; } - let expected = alt props.pp_exact { - option::some(file) { - let filepath = fs::connect(fs::dirname(testfile), file); - io::read_whole_file_str(filepath) - } - option::none. { - srcs.(vec::len(srcs) - 2u) - } - }; - let actual = srcs.(vec::len(srcs) - 1u); + let expected = + alt props.pp_exact { + option::some(file) { + let filepath = fs::connect(fs::dirname(testfile), file); + io::read_whole_file_str(filepath) + } + option::none. { srcs[vec::len(srcs) - 2u] } + }; + let actual = srcs[vec::len(srcs) - 1u]; if option::is_some(props.pp_exact) { // Now we have to care about line endings let cr = "\r"; - check str::is_not_empty(cr); + check (str::is_not_empty(cr)); actual = str::replace(actual, cr, ""); expected = str::replace(expected, cr, ""); } @@ -135,8 +126,7 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) { let procres = typecheck_source(cx, testfile, actual); if procres.status != 0 { - fatal_procres("pretty-printed source does not typecheck", - procres); + fatal_procres("pretty-printed source does not typecheck", procres); } ret; @@ -148,14 +138,15 @@ fn run_pretty_test(cx: &cx, props: &test_props, testfile: &str) { fn make_pp_args(config: &config, testfile: &str) -> procargs { let prog = config.rustc_path; - let args = ~["-", "--pretty", "normal"]; + let args = ["-", "--pretty", "normal"]; ret {prog: prog, args: args}; } fn compare_source(expected: &str, actual: &str) { if expected != actual { error("pretty-printed source does match expected source"); - let msg = #fmt("\n\ + let msg = + #fmt["\n\ expected:\n\ ------------------------------------------\n\ %s\n\ @@ -165,7 +156,7 @@ actual:\n\ %s\n\ ------------------------------------------\n\ \n", - expected, actual); + expected, actual]; io::stdout().write_str(msg); fail; } @@ -178,7 +169,7 @@ actual:\n\ fn make_typecheck_args(config: &config, testfile: &str) -> procargs { let prog = config.rustc_path; - let args = ~["-", "--no-trans", "--lib"]; + let args = ["-", "--no-trans", "--lib"]; ret {prog: prog, args: args}; } } @@ -190,28 +181,28 @@ fn check_error_patterns(props: &test_props, testfile: &str, } let next_err_idx = 0u; - let next_err_pat = props.error_patterns.(next_err_idx); + let next_err_pat = props.error_patterns[next_err_idx]; for line: str in str::split(procres.stdout, '\n' as u8) { if str::find(line, next_err_pat) > 0 { - log #fmt("found error pattern %s", next_err_pat); + log #fmt["found error pattern %s", next_err_pat]; next_err_idx += 1u; if next_err_idx == vec::len(props.error_patterns) { log "found all error patterns"; ret; } - next_err_pat = props.error_patterns.(next_err_idx); + next_err_pat = props.error_patterns[next_err_idx]; } } let missing_patterns = vec::slice(props.error_patterns, next_err_idx, - vec::len(props.error_patterns)); + vec::len(props.error_patterns)); if vec::len(missing_patterns) == 1u { - fatal_procres(#fmt("error pattern '%s' not found!", - missing_patterns.(0)), procres); + fatal_procres(#fmt["error pattern '%s' not found!", + missing_patterns[0]], procres); } else { for pattern: str in missing_patterns { - error(#fmt("error pattern '%s' not found!", pattern)); + error(#fmt["error pattern '%s' not found!", pattern]); } fatal_procres("multiple error patterns not found", procres); } @@ -226,27 +217,24 @@ fn compile_test(cx: &cx, props: &test_props, testfile: &str) -> procres { cx.config.compile_lib_path, option::none) } -fn exec_compiled_test(cx: &cx, props: &test_props, - testfile: &str) -> procres { +fn exec_compiled_test(cx: &cx, props: &test_props, testfile: &str) -> + procres { compose_and_run(cx, testfile, bind make_run_args(_, props, _), cx.config.run_lib_path, option::none) } fn compose_and_run(cx: &cx, testfile: &str, - make_args: fn(&config, &str) -> procargs , - lib_path: &str, + make_args: fn(&config, &str) -> procargs, lib_path: &str, input: option::t<str>) -> procres { let procargs = make_args(cx.config, testfile); - ret program_output(cx, testfile, lib_path, - procargs.prog, procargs.args, + ret program_output(cx, testfile, lib_path, procargs.prog, procargs.args, input); } -fn make_compile_args(config: &config, - props: &test_props, testfile: &str) -> - procargs { +fn make_compile_args(config: &config, props: &test_props, testfile: &str) -> + procargs { let prog = config.rustc_path; - let args = ~[testfile, "-o", make_exe_name(config, testfile)]; + let args = [testfile, "-o", make_exe_name(config, testfile)]; args += split_maybe_args(config.rustcflags); args += split_maybe_args(props.compile_flags); ret {prog: prog, args: args}; @@ -256,35 +244,29 @@ fn make_exe_name(config: &config, testfile: &str) -> str { output_base_name(config, testfile) + os::exec_suffix() } -fn make_run_args(config: &config, - props: &test_props, testfile: &str) -> procargs { - let toolargs = if !props.no_valgrind { - // If we've got another tool to run under (valgrind), - // then split apart its command - split_maybe_args(config.runtool) - } else { - ~[] - }; +fn make_run_args(config: &config, props: &test_props, testfile: &str) -> + procargs { + let toolargs = + if !props.no_valgrind { - let args = toolargs + ~[make_exe_name(config, testfile)]; - ret {prog: args.(0), args: vec::slice(args, 1u, vec::len(args))}; + // If we've got another tool to run under (valgrind), + // then split apart its command + split_maybe_args(config.runtool) + } else { [] }; + + let args = toolargs + [make_exe_name(config, testfile)]; + ret {prog: args[0], args: vec::slice(args, 1u, vec::len(args))}; } fn split_maybe_args(argstr: &option::t<str>) -> [str] { fn rm_whitespace(v: &[str]) -> [str] { fn flt(s: &str) -> option::t<str> { - if !is_whitespace(s) { - option::some(s) - } else { - option::none - } + if !is_whitespace(s) { option::some(s) } else { option::none } } // FIXME: This should be in std fn is_whitespace(s: str) -> bool { - for c: u8 in s { - if c != (' ' as u8) { ret false; } - } + for c: u8 in s { if c != ' ' as u8 { ret false; } } ret true; } vec::filter_map(flt, v) @@ -292,38 +274,38 @@ fn split_maybe_args(argstr: &option::t<str>) -> [str] { alt argstr { option::some(s) { rm_whitespace(str::split(s, ' ' as u8)) } - option::none. { ~[] } + option::none. { [] } } } fn program_output(cx: &cx, testfile: &str, lib_path: &str, prog: &str, args: &[str], input: option::t<str>) -> procres { let cmdline = - { - let cmdline = make_cmdline(lib_path, prog, args); - logv(cx.config, #fmt("executing %s", cmdline)); - cmdline - }; - let res = procsrv::run(cx.procsrv, lib_path, - prog, args, input); + { + let cmdline = make_cmdline(lib_path, prog, args); + logv(cx.config, #fmt["executing %s", cmdline]); + cmdline + }; + let res = procsrv::run(cx.procsrv, lib_path, prog, args, input); dump_output(cx.config, testfile, res.out, res.err); - ret {status: res.status, stdout: res.out, - stderr: res.err, cmdline: cmdline}; + ret {status: res.status, + stdout: res.out, + stderr: res.err, + cmdline: cmdline}; } fn make_cmdline(libpath: &str, prog: &str, args: &[str]) -> str { - #fmt("%s %s %s", lib_path_cmd_prefix(libpath), prog, - str::connect(args, " ")) + #fmt["%s %s %s", lib_path_cmd_prefix(libpath), prog, + str::connect(args, " ")] } // Build the LD_LIBRARY_PATH variable as it would be seen on the command line // for diagnostic purposes fn lib_path_cmd_prefix(path: &str) -> str { - #fmt("%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)) + #fmt["%s=\"%s\"", util::lib_path_env_var(), util::make_new_path(path)] } -fn dump_output(config: &config, testfile: &str, - out: &str, err: &str) { +fn dump_output(config: &config, testfile: &str, out: &str, err: &str) { dump_output_file(config, testfile, out, "out"); dump_output_file(config, testfile, err, "err"); maybe_dump_to_stdout(config, out, err); @@ -331,22 +313,20 @@ fn dump_output(config: &config, testfile: &str, #[cfg(target_os = "win32")] #[cfg(target_os = "linux")] -fn dump_output_file(config: &config, testfile: &str, - out: &str, extension: &str) { +fn dump_output_file(config: &config, testfile: &str, out: &str, + extension: &str) { let outfile = make_out_name(config, testfile, extension); - let writer = io::file_writer(outfile, - ~[io::create, io::truncate]); + let writer = io::file_writer(outfile, [io::create, io::truncate]); writer.write_str(out); } // FIXME (726): Can't use file_writer on mac #[cfg(target_os = "macos")] -fn dump_output_file(config: &config, testfile: &str, - out: &str, extension: &str) { +fn dump_output_file(config: &config, testfile: &str, out: &str, + extension: &str) { } -fn make_out_name(config: &config, testfile: &str, - extension: &str) -> str { +fn make_out_name(config: &config, testfile: &str, extension: &str) -> str { output_base_name(config, testfile) + "." + extension } @@ -358,16 +338,13 @@ fn output_base_name(config: &config, testfile: &str) -> str { parts = vec::slice(parts, 0u, vec::len(parts) - 1u); str::connect(parts, ".") }; - #fmt("%s%s.%s", base, filename, config.stage_id) + #fmt["%s%s.%s", base, filename, config.stage_id] } -fn maybe_dump_to_stdout(config: &config, - out: &str, err: &str) { +fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { if config.verbose { - let sep1 = #fmt("------%s------------------------------", - "stdout"); - let sep2 = #fmt("------%s------------------------------", - "stderr"); + let sep1 = #fmt["------%s------------------------------", "stdout"]; + let sep2 = #fmt["------%s------------------------------", "stderr"]; let sep3 = "------------------------------------------"; io::stdout().write_line(sep1); io::stdout().write_line(out); @@ -377,13 +354,13 @@ fn maybe_dump_to_stdout(config: &config, } } -fn error(err: &str) { io::stdout().write_line(#fmt("\nerror: %s", err)); } +fn error(err: &str) { io::stdout().write_line(#fmt["\nerror: %s", err]); } fn fatal(err: &str) -> ! { error(err); fail; } fn fatal_procres(err: &str, procres: procres) -> ! { let msg = - #fmt("\n\ + #fmt["\n\ error: %s\n\ command: %s\n\ stdout:\n\ @@ -395,7 +372,7 @@ stderr:\n\ %s\n\ ------------------------------------------\n\ \n", - err, procres.cmdline, procres.stdout, procres.stderr); + err, procres.cmdline, procres.stdout, procres.stderr]; io::stdout().write_str(msg); fail; } diff --git a/src/test/compiletest/util.rs b/src/test/compiletest/util.rs index 5f971777c75..3dcd8699927 100644 --- a/src/test/compiletest/util.rs +++ b/src/test/compiletest/util.rs @@ -9,7 +9,7 @@ fn make_new_path(path: &str) -> str { // Windows just uses PATH as the library search path, so we have to // maintain the current value while adding our own alt getenv(lib_path_env_var()) { - option::some(curr) { #fmt("%s:%s", path, curr) } + option::some(curr) { #fmt["%s:%s", path, curr] } option::none. { path } } } diff --git a/src/test/pretty/block-disambig.rs b/src/test/pretty/block-disambig.rs index f035b9393c2..252eb0270da 100644 --- a/src/test/pretty/block-disambig.rs +++ b/src/test/pretty/block-disambig.rs @@ -1,40 +1,20 @@ // Tests that the pretty printer correctly disambiguates various scenarios // involving block statements by ending them with a semi-colon -fn test1() { - let val = @0; - {}; - *val; -} +fn test1() { let val = @0; { }; *val; } -fn test2() -> int { - let val = @0; - {}; - *val -} +fn test2() -> int { let val = @0; { }; *val } fn test3() { let regs = @{mutable eax: 0}; - alt true { - true { } - }; + alt true { true { } }; (*regs).eax = 1; } -fn test4() -> bool { - let regs = @true; - if true { }; - *regs || false -} +fn test4() -> bool { let regs = @true; if true { }; *regs || false } -fn test5() -> (int, int) { - {}; - (0, 1) -} +fn test5() -> (int, int) { { }; (0, 1) } -fn test6() -> bool { - {}; - (true || false) && true -} +fn test6() -> bool { { }; (true || false) && true } fn test7() -> uint { let regs = @0; @@ -42,24 +22,12 @@ fn test7() -> uint { (*regs < 2) as uint } -fn test8() -> int { - let val = @0; - alt true { true { } }; - *val < 1 ? 0 : 1 -} +fn test8() -> int { let val = @0; alt true { true { } }; *val < 1 ? 0 : 1 } -fn test9() { - let regs = @mutable 0; - alt true { - true { } - }; - *regs += 1; -} +fn test9() { let regs = @mutable 0; alt true { true { } }; *regs += 1; } fn test10() -> int { let regs = @mutable [0]; - alt true { - true { } - }; - (*regs).(0) + alt true { true { } }; + (*regs)[0] } diff --git a/src/test/pretty/empty-lines.rs b/src/test/pretty/empty-lines.rs index 87de5ff64c2..e598e96db24 100644 --- a/src/test/pretty/empty-lines.rs +++ b/src/test/pretty/empty-lines.rs @@ -4,4 +4,4 @@ fn a() -> uint { 1u -} \ No newline at end of file +} diff --git a/src/test/pretty/example2.rs b/src/test/pretty/example2.rs index ea9ff94112a..852b9f316ce 100644 --- a/src/test/pretty/example2.rs +++ b/src/test/pretty/example2.rs @@ -1,7 +1,3 @@ // pp-exact:example2.pp -fn -main -() -{ -} +fn main() { } diff --git a/src/test/pretty/unary-op-disambig.rs b/src/test/pretty/unary-op-disambig.rs index 79cc24a2f20..0f67570e722 100644 --- a/src/test/pretty/unary-op-disambig.rs +++ b/src/test/pretty/unary-op-disambig.rs @@ -2,34 +2,16 @@ fn f() { } -fn block_semi() -> int { - { f() }; - -1 -} - -fn block_nosemi() -> int { - { 0 } - 1 -} - -fn if_semi() -> int { - if true { f() } else { f() }; - -1 -} - -fn if_nosemi() -> int { - if true { 0 } else { 0 } - 1 -} - -fn alt_semi() -> int { - alt true { true { f() } }; - -1 -} - -fn alt_no_semi() -> int { - alt true { true { 0 } } - 1 -} - -fn stmt() { - { f() }; - -1; -} \ No newline at end of file +fn block_semi() -> int { { f() }; -1 } + +fn block_nosemi() -> int { { 0 } - 1 } + +fn if_semi() -> int { if true { f() } else { f() }; -1 } + +fn if_nosemi() -> int { if true { 0 } else { 0 } - 1 } + +fn alt_semi() -> int { alt true { true { f() } }; -1 } + +fn alt_no_semi() -> int { alt true { true { 0 } } - 1 } + +fn stmt() { { f() }; -1; } diff --git a/src/test/pretty/vec-comments.rs b/src/test/pretty/vec-comments.rs index 48de34972b7..2cd5fffdf75 100644 --- a/src/test/pretty/vec-comments.rs +++ b/src/test/pretty/vec-comments.rs @@ -2,30 +2,28 @@ // Testing that comments are correctly interleaved // pp-exact:vec-comments.pp fn main() { - let v1 = ~[ - // Comment - 0, - // Comment - 1, - // Comment - 2 - ]; - let v2 = ~[ - 0, // Comment - 1, // Comment - 2 // Comment - ]; - let v3 = ~[ - /* Comment */ - 0, - /* Comment */ - 1, - /* Comment */ - 2 - ]; - let v4 = ~[ - 0, /* Comment */ - 1, /* Comment */ - 2 /* Comment */ - ]; + let v1 = + [ + // Comment + 0, + // Comment + 1, + // Comment + 2]; + let v2 = + [0, // Comment + 1, // Comment + 2]; // Comment + let v3 = + [ + /* Comment */ + 0, + /* Comment */ + 1, + /* Comment */ + 2]; + let v4 = + [0, /* Comment */ + 1, /* Comment */ + 2]; /* Comment */ } diff --git a/src/test/pretty/vec-type.rs b/src/test/pretty/vec-type.rs index 010ad755f51..60265eebcf7 100644 --- a/src/test/pretty/vec-type.rs +++ b/src/test/pretty/vec-type.rs @@ -2,4 +2,4 @@ fn f1(x: [int]) { } -fn g1() { f1(~[1, 2, 3]); } +fn g1() { f1([1, 2, 3]); } diff --git a/src/test/run-fail/alt-bot-fail.rs b/src/test/run-fail/alt-bot-fail.rs index 7a414b3ca6a..355892d5a13 100644 --- a/src/test/run-fail/alt-bot-fail.rs +++ b/src/test/run-fail/alt-bot-fail.rs @@ -7,9 +7,7 @@ import std::option::*; fn foo(s: str) { } fn main() { - let i = alt some::<int>(3) { - none::<int>. { fail } - some::<int>(_) { fail } - }; + let i = + alt some::<int>(3) { none::<int>. { fail } some::<int>(_) { fail } }; foo(i); } diff --git a/src/test/run-fail/alt-disc-bot.rs b/src/test/run-fail/alt-disc-bot.rs index 8b4d30ef6ac..2ac519e6419 100644 --- a/src/test/run-fail/alt-disc-bot.rs +++ b/src/test/run-fail/alt-disc-bot.rs @@ -1,4 +1,4 @@ // error-pattern:quux fn f() -> ! { fail "quux" } -fn g() -> int { alt f() { true { 1 } false { 0 } }; } +fn g() -> int { alt f() { true { 1 } false { 0 } } } fn main() { g(); } diff --git a/src/test/run-fail/args-fail.rs b/src/test/run-fail/args-fail.rs index 9dc6ecc7413..afdaa553ba6 100644 --- a/src/test/run-fail/args-fail.rs +++ b/src/test/run-fail/args-fail.rs @@ -1,4 +1,4 @@ // error-pattern:meep fn f(a: int, b: int, c: @int) { fail "moop"; } -fn main() { f(1, fail "meep", @42); } \ No newline at end of file +fn main() { f(1, fail "meep", @42); } diff --git a/src/test/run-fail/bug-811.rs b/src/test/run-fail/bug-811.rs index 176b95343eb..aa4d829a100 100644 --- a/src/test/run-fail/bug-811.rs +++ b/src/test/run-fail/bug-811.rs @@ -1,16 +1,11 @@ // error-pattern:quux -fn test00_start(ch: chan_t<int>, message: int) { - send(ch, message); -} +fn test00_start(ch: chan_t<int>, message: int) { send(ch, message); } type task_id = int; type port_id = int; -type chan_t<~T> = { - task : task_id, - port : port_id -}; +type chan_t<~T> = {task: task_id, port: port_id}; -fn send<~T>(ch : chan_t<T>, data : -T) { fail; } +fn send<~T>(ch: chan_t<T>, data: -T) { fail; } fn main() { fail "quux"; } diff --git a/src/test/run-fail/do-while-body-fails.rs b/src/test/run-fail/do-while-body-fails.rs index 1a6cac5fabc..3ab257de397 100644 --- a/src/test/run-fail/do-while-body-fails.rs +++ b/src/test/run-fail/do-while-body-fails.rs @@ -1,4 +1,2 @@ // error-pattern:quux -fn main() { - let x: int = do { fail "quux" } while (true); -} +fn main() { let x: int = do { fail "quux" } while true; } diff --git a/src/test/run-fail/explicit-fail-msg.rs b/src/test/run-fail/explicit-fail-msg.rs index f238d226b34..b45e443759c 100644 --- a/src/test/run-fail/explicit-fail-msg.rs +++ b/src/test/run-fail/explicit-fail-msg.rs @@ -1,3 +1,3 @@ // error-pattern:wooooo // no-valgrind -fn main() { let a = 1; if 1 == 1 { a = 2; } fail "woooo" + "o"; } \ No newline at end of file +fn main() { let a = 1; if 1 == 1 { a = 2; } fail "woooo" + "o"; } diff --git a/src/test/run-fail/explicit-fail.rs b/src/test/run-fail/explicit-fail.rs index a74cf4b36e3..396f12d5caf 100644 --- a/src/test/run-fail/explicit-fail.rs +++ b/src/test/run-fail/explicit-fail.rs @@ -2,4 +2,4 @@ // error-pattern:explicit -fn main() { fail; } \ No newline at end of file +fn main() { fail; } diff --git a/src/test/run-fail/expr-alt-fail-fn.rs b/src/test/run-fail/expr-alt-fail-fn.rs index e9754643ccd..bf6898ed297 100644 --- a/src/test/run-fail/expr-alt-fail-fn.rs +++ b/src/test/run-fail/expr-alt-fail-fn.rs @@ -6,4 +6,4 @@ fn f() -> ! { fail } fn g() -> int { let x = alt true { true { f() } false { 10 } }; ret x; } -fn main() { g(); } \ No newline at end of file +fn main() { g(); } diff --git a/src/test/run-fail/expr-alt-fail.rs b/src/test/run-fail/expr-alt-fail.rs index 50154890bc3..230497135cd 100644 --- a/src/test/run-fail/expr-alt-fail.rs +++ b/src/test/run-fail/expr-alt-fail.rs @@ -2,4 +2,4 @@ // error-pattern:explicit failure -fn main() { let x = alt true { false { 0 } true { fail } }; } \ No newline at end of file +fn main() { let x = alt true { false { 0 } true { fail } }; } diff --git a/src/test/run-fail/expr-fn-fail.rs b/src/test/run-fail/expr-fn-fail.rs index fc716fc1c60..24d0fa4c4aa 100644 --- a/src/test/run-fail/expr-fn-fail.rs +++ b/src/test/run-fail/expr-fn-fail.rs @@ -4,4 +4,4 @@ // error-pattern:explicit failure fn f() -> ! { fail } -fn main() { f(); } \ No newline at end of file +fn main() { f(); } diff --git a/src/test/run-fail/expr-if-fail-fn.rs b/src/test/run-fail/expr-if-fail-fn.rs index 6b7b6d64b45..406302532fa 100644 --- a/src/test/run-fail/expr-if-fail-fn.rs +++ b/src/test/run-fail/expr-if-fail-fn.rs @@ -6,4 +6,4 @@ fn f() -> ! { fail } fn g() -> int { let x = if true { f() } else { 10 }; ret x; } -fn main() { g(); } \ No newline at end of file +fn main() { g(); } diff --git a/src/test/run-fail/expr-if-fail.rs b/src/test/run-fail/expr-if-fail.rs index a738bfc7f1e..24cd815c244 100644 --- a/src/test/run-fail/expr-if-fail.rs +++ b/src/test/run-fail/expr-if-fail.rs @@ -2,4 +2,4 @@ // error-pattern:explicit failure -fn main() { let x = if false { 0 } else if (true) { fail } else { 10 }; } \ No newline at end of file +fn main() { let x = if false { 0 } else if true { fail } else { 10 }; } diff --git a/src/test/run-fail/fail-arg.rs b/src/test/run-fail/fail-arg.rs index ef43fea8694..e657bf7d9a6 100644 --- a/src/test/run-fail/fail-arg.rs +++ b/src/test/run-fail/fail-arg.rs @@ -1,4 +1,4 @@ // error-pattern:woe fn f(a: int) { log a; } -fn main() { f(fail "woe"); } \ No newline at end of file +fn main() { f(fail "woe"); } diff --git a/src/test/run-fail/fail-main.rs b/src/test/run-fail/fail-main.rs index 0ac56613439..a8e51009352 100644 --- a/src/test/run-fail/fail-main.rs +++ b/src/test/run-fail/fail-main.rs @@ -1,4 +1,4 @@ // error-pattern:moop use std; import std::uint; -fn main() { fail "moop"; } \ No newline at end of file +fn main() { fail "moop"; } diff --git a/src/test/run-fail/fail.rs b/src/test/run-fail/fail.rs index a0520c288a4..75e6f7e886e 100644 --- a/src/test/run-fail/fail.rs +++ b/src/test/run-fail/fail.rs @@ -2,4 +2,4 @@ // error-pattern:1 == 2 -fn main() { assert (1 == 2); } \ No newline at end of file +fn main() { assert (1 == 2); } diff --git a/src/test/run-fail/fmt-fail.rs b/src/test/run-fail/fmt-fail.rs index d4eb12292a6..2d3e35b41af 100644 --- a/src/test/run-fail/fmt-fail.rs +++ b/src/test/run-fail/fmt-fail.rs @@ -3,4 +3,4 @@ use std; import std::str; -fn main() { let str_var: str = "meh"; fail #fmt("%s", str_var); } \ No newline at end of file +fn main() { let str_var: str = "meh"; fail #fmt["%s", str_var]; } diff --git a/src/test/run-fail/fn-constraint-claim.rs b/src/test/run-fail/fn-constraint-claim.rs index ca243210647..a5309b61627 100644 --- a/src/test/run-fail/fn-constraint-claim.rs +++ b/src/test/run-fail/fn-constraint-claim.rs @@ -5,9 +5,4 @@ import std::uint::*; fn nop(a: uint, b: uint) : le(a, b) { fail "quux"; } -fn main() { - let a: uint = 5u; - let b: uint = 4u; - claim (le(a, b)); - nop(a, b); -} +fn main() { let a: uint = 5u; let b: uint = 4u; claim (le(a, b)); nop(a, b); } diff --git a/src/test/run-fail/fn-constraint.rs b/src/test/run-fail/fn-constraint.rs index 65bcc413498..3499d44ceff 100644 --- a/src/test/run-fail/fn-constraint.rs +++ b/src/test/run-fail/fn-constraint.rs @@ -8,4 +8,4 @@ fn main() { let b: uint = 1u; check (le(a, b)); log_err safe_slice("kitties", a, b); -} \ No newline at end of file +} diff --git a/src/test/run-fail/if-check-fail.rs b/src/test/run-fail/if-check-fail.rs index 677240d0763..885c92deab8 100644 --- a/src/test/run-fail/if-check-fail.rs +++ b/src/test/run-fail/if-check-fail.rs @@ -2,9 +2,9 @@ pred even(x: uint) -> bool { if x < 2u { ret false; - } else if (x == 2u) { ret true; } else { ret even(x - 2u); } + } else if x == 2u { ret true; } else { ret even(x - 2u); } } fn foo(x: uint) { if check even(x) { log x; } else { fail "Number is odd"; } } -fn main() { foo(3u); } \ No newline at end of file +fn main() { foo(3u); } diff --git a/src/test/run-fail/non-exhaustive-match.rs b/src/test/run-fail/non-exhaustive-match.rs index e62d0692d4f..4afd83c1b97 100644 --- a/src/test/run-fail/non-exhaustive-match.rs +++ b/src/test/run-fail/non-exhaustive-match.rs @@ -6,4 +6,4 @@ // error-pattern:non-exhaustive match failure tag t { a; b; } -fn main() { let x = a; alt x { b. { } } } \ No newline at end of file +fn main() { let x = a; alt x { b. { } } } diff --git a/src/test/run-fail/pred.rs b/src/test/run-fail/pred.rs index 14e46976113..a2f9420825c 100644 --- a/src/test/run-fail/pred.rs +++ b/src/test/run-fail/pred.rs @@ -4,4 +4,4 @@ fn f(a: int, b: int) { } pred lt(a: int, b: int) -> bool { ret a < b; } -fn main() { let a: int = 10; let b: int = 23; check (lt(b, a)); f(b, a); } \ No newline at end of file +fn main() { let a: int = 10; let b: int = 23; check (lt(b, a)); f(b, a); } diff --git a/src/test/run-fail/rhs-type.rs b/src/test/run-fail/rhs-type.rs index 0277d83d393..461b2c65b44 100644 --- a/src/test/run-fail/rhs-type.rs +++ b/src/test/run-fail/rhs-type.rs @@ -1,4 +1,4 @@ // Tests that trans treats the rhs of pth's decl // as a _|_-typed thing, not a str-typed thing // error-pattern:bye -fn main() { let pth = fail "bye"; let rs: {t: str} = {t: pth}; } \ No newline at end of file +fn main() { let pth = fail "bye"; let rs: {t: str} = {t: pth}; } diff --git a/src/test/run-fail/str-overrun.rs b/src/test/run-fail/str-overrun.rs index 1ac862f2405..3d12bce20c9 100644 --- a/src/test/run-fail/str-overrun.rs +++ b/src/test/run-fail/str-overrun.rs @@ -7,12 +7,12 @@ fn main() { let s: str = "hello"; let x: int = 0; - assert (s.(x) == 0x68 as u8); + assert (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. - assert (s.(x + 6) == 0x0 as u8); -} \ No newline at end of file + assert (s[x + 6] == 0x0 as u8); +} diff --git a/src/test/run-fail/vec-overrun.rs b/src/test/run-fail/vec-overrun.rs index 28349f27a50..54329ca63b5 100644 --- a/src/test/run-fail/vec-overrun.rs +++ b/src/test/run-fail/vec-overrun.rs @@ -3,10 +3,10 @@ // error-pattern:bounds check // no-valgrind fn main() { - let v: [int] = ~[10]; + let v: [int] = [10]; let x: int = 0; - assert (v.(x) == 10); + assert (v[x] == 10); // Bounds-check failure. - assert (v.(x + 2) == 20); + assert (v[x + 2] == 20); } diff --git a/src/test/run-fail/vec-underrun.rs b/src/test/run-fail/vec-underrun.rs index 41eb94ca739..87c8295840e 100644 --- a/src/test/run-fail/vec-underrun.rs +++ b/src/test/run-fail/vec-underrun.rs @@ -3,10 +3,10 @@ // error-pattern:bounds check // no-valgrind fn main() { - let v: [int] = ~[10, 20]; + let v: [int] = [10, 20]; let x: int = 0; - assert (v.(x) == 10); + assert (v[x] == 10); // Bounds-check failure. - assert (v.(x - 1) == 20); + assert (v[x - 1] == 20); } diff --git a/src/test/run-pass/alloca-from-derived-tydesc.rs b/src/test/run-pass/alloca-from-derived-tydesc.rs index 00371d3567d..6077bbf6723 100644 --- a/src/test/run-pass/alloca-from-derived-tydesc.rs +++ b/src/test/run-pass/alloca-from-derived-tydesc.rs @@ -2,6 +2,6 @@ tag option<T> { some(T); none; } type r<T> = {mutable v: [option<T>]}; -fn f<T>() -> [T] { ret ~[]; } +fn f<T>() -> [T] { ret []; } -fn main() { let r: r<int> = {mutable v: ~[]}; r.v = f(); } +fn main() { let r: r<int> = {mutable v: []}; r.v = f(); } diff --git a/src/test/run-pass/alt-bot.rs b/src/test/run-pass/alt-bot.rs index a5369804d00..6949d727f59 100644 --- a/src/test/run-pass/alt-bot.rs +++ b/src/test/run-pass/alt-bot.rs @@ -2,9 +2,7 @@ use std; import std::option::*; fn main() { - let i: int = alt some::<int>(3) { - none::<int>. { fail } - some::<int>(_) { 5 } - }; + let i: int = + alt some::<int>(3) { none::<int>. { fail } some::<int>(_) { 5 } }; log i; } diff --git a/src/test/run-pass/alt-join.rs b/src/test/run-pass/alt-join.rs index 423d08fc66a..4d1be53cdf3 100644 --- a/src/test/run-pass/alt-join.rs +++ b/src/test/run-pass/alt-join.rs @@ -7,12 +7,12 @@ import std::option::some; fn foo<T>(y: &option::t<T>) { let x: int; - let rs: [int] = ~[]; + let rs: [int] = []; /* tests that x doesn't get put in the precondition for the entire if expression */ if true { - } else { alt y { none::<T>. { x = 17; } _ { x = 42; } } rs += ~[x]; } + } else { alt y { none::<T>. { x = 17; } _ { x = 42; } } rs += [x]; } ret; } diff --git a/src/test/run-pass/alt-path.rs b/src/test/run-pass/alt-path.rs index 9f37cd2585c..84d79220f90 100644 --- a/src/test/run-pass/alt-path.rs +++ b/src/test/run-pass/alt-path.rs @@ -6,4 +6,4 @@ mod m1 { fn bar(x: m1::foo) { alt x { m1::foo1. { } } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/alt-pattern-drop.rs b/src/test/run-pass/alt-pattern-drop.rs index af0c615f53f..d3fb0715b4d 100644 --- a/src/test/run-pass/alt-pattern-drop.rs +++ b/src/test/run-pass/alt-pattern-drop.rs @@ -32,4 +32,4 @@ fn main() { log str::refcount(s); assert (str::refcount(s) == const_refcount); -} \ No newline at end of file +} diff --git a/src/test/run-pass/alt-pattern-lit.rs b/src/test/run-pass/alt-pattern-lit.rs index 3dc7bae1ea9..1f544495d88 100644 --- a/src/test/run-pass/alt-pattern-lit.rs +++ b/src/test/run-pass/alt-pattern-lit.rs @@ -4,4 +4,4 @@ fn altlit(f: int) -> int { alt f { 10 { log "case 10"; ret 20; } 11 { log "case 11"; ret 22; } } } -fn main() { assert (altlit(10) == 20); assert (altlit(11) == 22); } \ No newline at end of file +fn main() { assert (altlit(10) == 20); assert (altlit(11) == 22); } diff --git a/src/test/run-pass/alt-pattern-simple.rs b/src/test/run-pass/alt-pattern-simple.rs index 1d02eb64a82..e29cd72ac77 100644 --- a/src/test/run-pass/alt-pattern-simple.rs +++ b/src/test/run-pass/alt-pattern-simple.rs @@ -2,4 +2,4 @@ fn altsimple(f: int) { alt f { x { } } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/alt-str.rs b/src/test/run-pass/alt-str.rs index 8fd15eb76af..fbdf7fdbfe3 100644 --- a/src/test/run-pass/alt-str.rs +++ b/src/test/run-pass/alt-str.rs @@ -12,4 +12,4 @@ fn main() { tag1("test") { } _ { fail; } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/alt-tag.rs b/src/test/run-pass/alt-tag.rs index 3bdc4b3a528..6a3606d6dc3 100644 --- a/src/test/run-pass/alt-tag.rs +++ b/src/test/run-pass/alt-tag.rs @@ -25,4 +25,4 @@ fn main() { assert (process(gray) == 127); assert (process(clear) == 0); assert (process(red) == 255); -} \ No newline at end of file +} diff --git a/src/test/run-pass/anon-obj-backwarding-2.rs b/src/test/run-pass/anon-obj-backwarding-2.rs index 3a806a6e399..039d25be381 100644 --- a/src/test/run-pass/anon-obj-backwarding-2.rs +++ b/src/test/run-pass/anon-obj-backwarding-2.rs @@ -9,15 +9,17 @@ fn main() { let my_a = a(); - let my_b = obj () { - fn baz() -> int { ret self.foo(); } - with my_a - }; + let my_b = + obj () { + fn baz() -> int { ret self.foo(); } + with + my_a + }; - assert my_a.foo() == 2; - assert my_a.bar() == 2; - assert my_b.foo() == 2; - assert my_b.baz() == 2; - assert my_b.bar() == 2; + assert (my_a.foo() == 2); + assert (my_a.bar() == 2); + assert (my_b.foo() == 2); + assert (my_b.baz() == 2); + assert (my_b.bar() == 2); } diff --git a/src/test/run-pass/anon-obj-cats.rs b/src/test/run-pass/anon-obj-cats.rs index ca093f0cb9b..c1024afc6ec 100644 --- a/src/test/run-pass/anon-obj-cats.rs +++ b/src/test/run-pass/anon-obj-cats.rs @@ -3,42 +3,34 @@ fn main() { // The Internet made me do it. obj cat() { - fn ack() -> str { - ret "ack"; - } - fn meow() -> str { - ret "meow"; - } - fn zzz() -> str { - ret self.meow(); - } + fn ack() -> str { ret "ack"; } + fn meow() -> str { ret "meow"; } + fn zzz() -> str { ret self.meow(); } } let shortcat = cat(); - let longcat = obj() { - fn lol() -> str { - ret "lol"; - } - fn nyan() -> str { - ret "nyan"; - } - with shortcat - }; - - let longercat = obj() { - fn meow() -> str { - ret "zzz"; - } - with shortcat - }; - - let evenlongercat = obj() { - fn meow() -> str { - ret "zzzzzz"; - } - with longercat - }; + let longcat = + obj () { + fn lol() -> str { ret "lol"; } + fn nyan() -> str { ret "nyan"; } + with + shortcat + }; + + let longercat = + obj () { + fn meow() -> str { ret "zzz"; } + with + shortcat + }; + + let evenlongercat = + obj () { + fn meow() -> str { ret "zzzzzz"; } + with + longercat + }; // Tests self-call. assert (shortcat.zzz() == "meow"); diff --git a/src/test/run-pass/anon-obj-degenerate.rs b/src/test/run-pass/anon-obj-degenerate.rs index d4870fc3d78..c9c47e29008 100644 --- a/src/test/run-pass/anon-obj-degenerate.rs +++ b/src/test/run-pass/anon-obj-degenerate.rs @@ -17,4 +17,4 @@ fn main() { assert (my_d.foo() == 2); assert (my_d.bar() == 2); -} \ No newline at end of file +} diff --git a/src/test/run-pass/anon-obj-no-inner-obj-simple.rs b/src/test/run-pass/anon-obj-no-inner-obj-simple.rs index 423196dac82..3e782ce56de 100644 --- a/src/test/run-pass/anon-obj-no-inner-obj-simple.rs +++ b/src/test/run-pass/anon-obj-no-inner-obj-simple.rs @@ -3,36 +3,41 @@ use std; fn main() { // Anonymous object that doesn't extend an existing one. - let my_obj = obj() { - fn foo() -> int { ret 2; } - fn bar() -> int { ret 3; } - fn baz() -> str { "hello!" } - }; + let my_obj = + obj () { + fn foo() -> int { ret 2; } + fn bar() -> int { ret 3; } + fn baz() -> str { "hello!" } + }; - assert my_obj.foo() == 2; - assert my_obj.bar() == 3; - assert my_obj.baz() == "hello!"; + assert (my_obj.foo() == 2); + assert (my_obj.bar() == 3); + assert (my_obj.baz() == "hello!"); // Make sure the result is extendable. - let my_ext_obj = obj() { - fn foo() -> int { ret 3; } - fn quux() -> str { ret self.baz(); } - with my_obj - }; + let my_ext_obj = + obj () { + fn foo() -> int { ret 3; } + fn quux() -> str { ret self.baz(); } + with + my_obj + }; - assert my_ext_obj.foo() == 3; - assert my_ext_obj.bar() == 3; - assert my_ext_obj.baz() == "hello!"; - assert my_ext_obj.quux() == "hello!"; + assert (my_ext_obj.foo() == 3); + assert (my_ext_obj.bar() == 3); + assert (my_ext_obj.baz() == "hello!"); + assert (my_ext_obj.quux() == "hello!"); // And again. - let my_ext_ext_obj = obj() { - fn baz() -> str { "world!" } - with my_ext_obj - }; + let my_ext_ext_obj = + obj () { + fn baz() -> str { "world!" } + with + my_ext_obj + }; - assert my_ext_ext_obj.foo() == 3; - assert my_ext_ext_obj.bar() == 3; - assert my_ext_ext_obj.baz() == "world!"; - assert my_ext_ext_obj.quux() == "world!"; + assert (my_ext_ext_obj.foo() == 3); + assert (my_ext_ext_obj.bar() == 3); + assert (my_ext_ext_obj.baz() == "world!"); + assert (my_ext_ext_obj.quux() == "world!"); } diff --git a/src/test/run-pass/anon-obj-overriding-reduced.rs b/src/test/run-pass/anon-obj-overriding-reduced.rs index df1b700de56..3eb7c72d864 100644 --- a/src/test/run-pass/anon-obj-overriding-reduced.rs +++ b/src/test/run-pass/anon-obj-overriding-reduced.rs @@ -15,4 +15,4 @@ fn main() { }; assert (my_b.foo() == 3); -} \ No newline at end of file +} diff --git a/src/test/run-pass/anon-obj-overriding.rs b/src/test/run-pass/anon-obj-overriding.rs index 19860158ce4..e9551900b26 100644 --- a/src/test/run-pass/anon-obj-overriding.rs +++ b/src/test/run-pass/anon-obj-overriding.rs @@ -36,4 +36,4 @@ fn main() { assert (my_c.baz(1, 2) == 6); assert (my_d.baz(1, 2) == 5); -} \ No newline at end of file +} diff --git a/src/test/run-pass/anon-obj-with-self-call-2.rs b/src/test/run-pass/anon-obj-with-self-call-2.rs index 69153ac567b..807f1275d8a 100644 --- a/src/test/run-pass/anon-obj-with-self-call-2.rs +++ b/src/test/run-pass/anon-obj-with-self-call-2.rs @@ -13,4 +13,4 @@ fn main() { }; assert (my_b.baz() == 2); -} \ No newline at end of file +} diff --git a/src/test/run-pass/anon-obj-with-self-call.rs b/src/test/run-pass/anon-obj-with-self-call.rs index 2944bc0b595..76faa9decc4 100644 --- a/src/test/run-pass/anon-obj-with-self-call.rs +++ b/src/test/run-pass/anon-obj-with-self-call.rs @@ -28,4 +28,4 @@ fn main() { assert (my_c.baz() == 3); assert (my_c.bar() == 3); -} \ No newline at end of file +} diff --git a/src/test/run-pass/argv.rs b/src/test/run-pass/argv.rs index b0feeff2232..0bb536086ba 100644 --- a/src/test/run-pass/argv.rs +++ b/src/test/run-pass/argv.rs @@ -1,5 +1,5 @@ fn main(args: [str]) { - let vs: [str] = ~["hi", "there", "this", "is", "a", "vec"]; - let vvs: [[str]] = ~[args, vs]; + let vs: [str] = ["hi", "there", "this", "is", "a", "vec"]; + let vvs: [[str]] = [args, vs]; for vs: [str] in vvs { for s: str in vs { log s; } } } diff --git a/src/test/run-pass/arith-0.rs b/src/test/run-pass/arith-0.rs index 6ad797982e6..7c77d25e4c0 100644 --- a/src/test/run-pass/arith-0.rs +++ b/src/test/run-pass/arith-0.rs @@ -1,3 +1,3 @@ -fn main() { let a: int = 10; log a; assert (a * (a - 1) == 90); } \ No newline at end of file +fn main() { let a: int = 10; log a; assert (a * (a - 1) == 90); } diff --git a/src/test/run-pass/arith-1.rs b/src/test/run-pass/arith-1.rs index 0f907de0a6f..b9d61493ecf 100644 --- a/src/test/run-pass/arith-1.rs +++ b/src/test/run-pass/arith-1.rs @@ -20,4 +20,4 @@ fn main() { assert (i32_b & i32_b << 1 == 0); log i32_b | i32_b << 1; assert (i32_b | i32_b << 1 == 0x30303030); -} \ No newline at end of file +} diff --git a/src/test/run-pass/arith-2.rs b/src/test/run-pass/arith-2.rs index bb0f67499a2..b55c66f8462 100644 --- a/src/test/run-pass/arith-2.rs +++ b/src/test/run-pass/arith-2.rs @@ -4,4 +4,4 @@ fn main() { let i32_c: int = 0x10101010; assert (i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3) == i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3)); -} \ No newline at end of file +} diff --git a/src/test/run-pass/arith-unsigned.rs b/src/test/run-pass/arith-unsigned.rs index 75f7549b994..24433d49ebc 100644 --- a/src/test/run-pass/arith-unsigned.rs +++ b/src/test/run-pass/arith-unsigned.rs @@ -23,4 +23,4 @@ fn main() { assert (4000000005u32 % 10u32 == 5u32); // 64-bit numbers have some flakiness yet. Not tested -} \ No newline at end of file +} diff --git a/src/test/run-pass/artificial-block.rs b/src/test/run-pass/artificial-block.rs index 3944a0e9da5..87c7cc149f6 100644 --- a/src/test/run-pass/artificial-block.rs +++ b/src/test/run-pass/artificial-block.rs @@ -1,3 +1,3 @@ fn f() -> int { { ret 3; } } -fn main() { assert (f() == 3); } \ No newline at end of file +fn main() { assert (f() == 3); } diff --git a/src/test/run-pass/assign-assign.rs b/src/test/run-pass/assign-assign.rs index cdf5a6f18bd..fffb35e81fb 100644 --- a/src/test/run-pass/assign-assign.rs +++ b/src/test/run-pass/assign-assign.rs @@ -19,4 +19,4 @@ fn test_assign_op() { assert (x == 33); } -fn main() { test_assign(); test_assign_op(); } \ No newline at end of file +fn main() { test_assign(); test_assign_op(); } diff --git a/src/test/run-pass/auto-deref-fn.rs b/src/test/run-pass/auto-deref-fn.rs index 717d79ad18e..caff3f29fbc 100644 --- a/src/test/run-pass/auto-deref-fn.rs +++ b/src/test/run-pass/auto-deref-fn.rs @@ -7,4 +7,4 @@ fn main() { assert (g(8) == 9); assert (h(0x1badd00d) == 0x1badd00e); assert ((@add1)(42) == 43); -} \ No newline at end of file +} diff --git a/src/test/run-pass/auto-loop.rs b/src/test/run-pass/auto-loop.rs index b4ea2f5dedc..6e83d2ca0aa 100644 --- a/src/test/run-pass/auto-loop.rs +++ b/src/test/run-pass/auto-loop.rs @@ -1,5 +1,5 @@ fn main() { let sum = 0; - for x in ~[1, 2, 3, 4, 5] { sum += x; } + for x in [1, 2, 3, 4, 5] { sum += x; } assert (sum == 15); } diff --git a/src/test/run-pass/autobind.rs b/src/test/run-pass/autobind.rs index f8a0f8e3ee7..536db525d5c 100644 --- a/src/test/run-pass/autobind.rs +++ b/src/test/run-pass/autobind.rs @@ -1,9 +1,9 @@ -fn f<T>(x: &[T]) -> T { ret x.(0); } +fn f<T>(x: &[T]) -> T { ret x[0]; } -fn g(act: fn(&[int]) -> int ) -> int { ret act(~[1, 2, 3]); } +fn g(act: fn(&[int]) -> int) -> int { ret act([1, 2, 3]); } fn main() { assert (g(f) == 1); - let f1: fn(&[str]) -> str = f; - assert (f1(~["x", "y", "z"]) == "x"); + let f1: fn(&[str]) -> str = f; + assert (f1(["x", "y", "z"]) == "x"); } diff --git a/src/test/run-pass/autoderef-objfn.rs b/src/test/run-pass/autoderef-objfn.rs index cf7bb394b4c..430293989a0 100644 --- a/src/test/run-pass/autoderef-objfn.rs +++ b/src/test/run-pass/autoderef-objfn.rs @@ -8,4 +8,4 @@ obj clam() { fn foo(c: @clam) { c.chowder(); } -fn main() { let c: clam = clam(); foo(@c); } \ No newline at end of file +fn main() { let c: clam = clam(); foo(@c); } diff --git a/src/test/run-pass/bind-interior.rs b/src/test/run-pass/bind-interior.rs index ab3ce3b5e9f..639077a72c0 100644 --- a/src/test/run-pass/bind-interior.rs +++ b/src/test/run-pass/bind-interior.rs @@ -5,7 +5,7 @@ fn f(n: int) -> int { ret n; } fn main() { - let g: fn() -> int = bind f(10); + let g: fn() -> int = bind f(10); let i: int = g(); assert (i == 10); -} \ No newline at end of file +} diff --git a/src/test/run-pass/bind-obj-ctor.rs b/src/test/run-pass/bind-obj-ctor.rs index 6be4df99abc..a76b17cc10a 100644 --- a/src/test/run-pass/bind-obj-ctor.rs +++ b/src/test/run-pass/bind-obj-ctor.rs @@ -14,4 +14,4 @@ fn main() { assert (obj0.sum() == 3); assert (obj1.sum() == 3); assert (obj2.sum() == 3); -} \ No newline at end of file +} diff --git a/src/test/run-pass/bind-parameterized-args-2.rs b/src/test/run-pass/bind-parameterized-args-2.rs index 3646b8ba691..68d47073413 100644 --- a/src/test/run-pass/bind-parameterized-args-2.rs +++ b/src/test/run-pass/bind-parameterized-args-2.rs @@ -3,5 +3,5 @@ fn main() { let y = bind echo(42, _); - y(fn(i: &str){}); + y(fn (i: &str) { }); } diff --git a/src/test/run-pass/bind-parameterized-args.rs b/src/test/run-pass/bind-parameterized-args.rs index 53b8f85ea49..1f3e8efbf37 100644 --- a/src/test/run-pass/bind-parameterized-args.rs +++ b/src/test/run-pass/bind-parameterized-args.rs @@ -1,7 +1,7 @@ fn main() { fn echo<T>(c: int, x: &[T]) { } - let y: fn(&[int]) = bind echo(42, _); + let y: fn(&[int]) = bind echo(42, _); - y(~[1]); + y([1]); } diff --git a/src/test/run-pass/bind-thunk.rs b/src/test/run-pass/bind-thunk.rs index e70fa6fdd6c..a85c7fc9679 100644 --- a/src/test/run-pass/bind-thunk.rs +++ b/src/test/run-pass/bind-thunk.rs @@ -5,7 +5,7 @@ fn f() -> int { ret 42; } fn main() { - let g: fn() -> int = bind f(); + let g: fn() -> int = bind f(); let i: int = g(); assert (i == 42); -} \ No newline at end of file +} diff --git a/src/test/run-pass/bind-trivial.rs b/src/test/run-pass/bind-trivial.rs index 35ed5d7477f..20b217c1046 100644 --- a/src/test/run-pass/bind-trivial.rs +++ b/src/test/run-pass/bind-trivial.rs @@ -5,7 +5,7 @@ fn f(n: int) -> int { ret n; } fn main() { - let g: fn(int) -> int = bind f(_); + let g: fn(int) -> int = bind f(_); let i: int = g(42); assert (i == 42); -} \ No newline at end of file +} diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index dfb02f70e7e..f676e6a3b11 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -64,8 +64,8 @@ fn test_port() { let p1 = comm::mk_port::<int>(); let p2 = comm::mk_port::<int>(); - assert p1 == p1; - assert p1 != p2; + assert (p1 == p1); + assert (p1 != p2); } fn test_chan() { @@ -73,9 +73,9 @@ fn test_chan() { let ch1 = p.mk_chan(); let ch2 = p.mk_chan(); - assert ch1 == ch1; + assert (ch1 == ch1); // Chans are equal because they are just task:port addresses. - assert ch1 == ch2; + assert (ch1 == ch2); } fn test_ptr() { @@ -89,8 +89,8 @@ fn test_task() { let t1 = task::spawn(f1); let t2 = task::spawn(f2); - assert t1 == t1; - assert t1 != t2; + assert (t1 == t1); + assert (t1 != t2); } fn test_fn() { @@ -128,8 +128,8 @@ fn test_native_fn() { } fn test_obj() { - let o1 = obj () { }; - let o2 = obj () { }; + let o1 = obj () { }; + let o2 = obj () { }; assert (o1 == o1); diff --git a/src/test/run-pass/bitwise.rs b/src/test/run-pass/bitwise.rs index 0d41cb0c303..afe16cf113f 100644 --- a/src/test/run-pass/bitwise.rs +++ b/src/test/run-pass/bitwise.rs @@ -19,4 +19,4 @@ fn main() { assert (-16 >>> 2 == -4); assert (0b1010_1010 | 0b0101_0101 == 0xff); assert (-1000 >> 3 == 536870787); -} \ No newline at end of file +} diff --git a/src/test/run-pass/block-fn-coerce.rs b/src/test/run-pass/block-fn-coerce.rs index c9dd29f7d00..163d99ee5d6 100644 --- a/src/test/run-pass/block-fn-coerce.rs +++ b/src/test/run-pass/block-fn-coerce.rs @@ -1,7 +1,7 @@ -fn force(f: &block() -> int ) -> int { ret f(); } +fn force(f: &block() -> int) -> int { ret f(); } fn main() { let f = fn () -> int { ret 7 }; assert (force(f) == 7); let g = bind force(f); assert (g() == 7); -} \ No newline at end of file +} diff --git a/src/test/run-pass/block-iter-1.rs b/src/test/run-pass/block-iter-1.rs index 47c728af36d..006d4f18fe4 100644 --- a/src/test/run-pass/block-iter-1.rs +++ b/src/test/run-pass/block-iter-1.rs @@ -1,14 +1,10 @@ -fn iter_vec<T>(v: &[T], f: &block(&T) ) { for x: T in v { f(x); } } +fn iter_vec<T>(v: &[T], f: &block(&T)) { for x: T in v { f(x); } } fn main() { - let v = ~[1, 2, 3, 4, 5, 6, 7]; + let v = [1, 2, 3, 4, 5, 6, 7]; let odds = 0; iter_vec(v, - {|&i| - log_err i; - if i % 2 == 1 { odds += 1; } - log_err odds; - }); + {|&i| log_err i; if i % 2 == 1 { odds += 1; } log_err odds; }); log_err odds; assert (odds == 4); } diff --git a/src/test/run-pass/block-iter-2.rs b/src/test/run-pass/block-iter-2.rs index a6d9455e3f1..d49cffbcc72 100644 --- a/src/test/run-pass/block-iter-2.rs +++ b/src/test/run-pass/block-iter-2.rs @@ -1,12 +1,9 @@ -fn iter_vec<T>(v: &[T], f: &block(&T) ) { for x: T in v { f(x); } } +fn iter_vec<T>(v: &[T], f: &block(&T)) { for x: T in v { f(x); } } fn main() { - let v = ~[1, 2, 3, 4, 5]; + let v = [1, 2, 3, 4, 5]; let sum = 0; - iter_vec(v, - {|&i| - iter_vec(v, {|&j| log_err i * j; sum += i * j; }); - }); + iter_vec(v, {|&i| iter_vec(v, {|&j| log_err i * j; sum += i * j; }); }); log_err sum; assert (sum == 225); } diff --git a/src/test/run-pass/block-vec-map2.rs b/src/test/run-pass/block-vec-map2.rs index 5153a81d1c7..35b979b3694 100644 --- a/src/test/run-pass/block-vec-map2.rs +++ b/src/test/run-pass/block-vec-map2.rs @@ -2,9 +2,9 @@ use std; import std::vec; fn main() { - let v = std::vec::map2({|&i, &b| if b { -i } else { i }}, - ~[1, 2, 3, 4, 5], - ~[true, false, false, true, true]); + let v = + std::vec::map2({|&i, &b| if b { -i } else { i } }, [1, 2, 3, 4, 5], + [true, false, false, true, true]); log_err v; - assert v == ~[-1, 2, 3, -4, -5]; + assert (v == [-1, 2, 3, -4, -5]); } diff --git a/src/test/run-pass/bool-not.rs b/src/test/run-pass/bool-not.rs index 9d609d44efd..5e38e974c1a 100644 --- a/src/test/run-pass/bool-not.rs +++ b/src/test/run-pass/bool-not.rs @@ -5,4 +5,4 @@ fn main() { if !false { assert (true); } else { assert (false); } if !true { assert (false); } else { assert (true); } -} \ No newline at end of file +} diff --git a/src/test/run-pass/box-compare.rs b/src/test/run-pass/box-compare.rs index e3a93520d4a..51eeb6e8eb7 100644 --- a/src/test/run-pass/box-compare.rs +++ b/src/test/run-pass/box-compare.rs @@ -4,4 +4,4 @@ fn main() { assert (@1 < @3); assert (@@"hello " > @@"hello"); assert (@@@"hello" != @@@"there"); -} \ No newline at end of file +} diff --git a/src/test/run-pass/box-in-tup.rs b/src/test/run-pass/box-in-tup.rs index aa2d6a596e1..0f75897a337 100644 --- a/src/test/run-pass/box-in-tup.rs +++ b/src/test/run-pass/box-in-tup.rs @@ -1,4 +1 @@ -fn main() { - let i: (@int, int) = (@10, 10); - let (a, _) = i; -} \ No newline at end of file +fn main() { let i: (@int, int) = (@10, 10); let (a, _) = i; } diff --git a/src/test/run-pass/box-pattern.rs b/src/test/run-pass/box-pattern.rs index 6c20cdd805d..973d7e303b9 100644 --- a/src/test/run-pass/box-pattern.rs +++ b/src/test/run-pass/box-pattern.rs @@ -6,4 +6,4 @@ fn main() { u(@{a: a, b: b}) { a + (b as int) } _ { 66 } } == 50); -} \ No newline at end of file +} diff --git a/src/test/run-pass/box.rs b/src/test/run-pass/box.rs index c9ef392e347..c3dee8ed5ea 100644 --- a/src/test/run-pass/box.rs +++ b/src/test/run-pass/box.rs @@ -1,3 +1,3 @@ -fn main() { let x: @int = @10; assert (*x == 10); } \ No newline at end of file +fn main() { let x: @int = @10; assert (*x == 10); } diff --git a/src/test/run-pass/break-value.rs b/src/test/run-pass/break-value.rs index 9db96e85782..764d03bdf22 100644 --- a/src/test/run-pass/break-value.rs +++ b/src/test/run-pass/break-value.rs @@ -1,3 +1,3 @@ fn int_id(x: int) -> int { ret x; } -fn main() { while true { int_id(break); } } \ No newline at end of file +fn main() { while true { int_id(break); } } diff --git a/src/test/run-pass/break.rs b/src/test/run-pass/break.rs index d53445ef586..962c360ca7b 100644 --- a/src/test/run-pass/break.rs +++ b/src/test/run-pass/break.rs @@ -6,15 +6,12 @@ fn main() { assert (i == 10); do { i += 1; if i == 20 { break; } } while i < 30 assert (i == 20); - for x: int in ~[1, 2, 3, 4, 5, 6] { - if x == 3 { break; } - assert (x <= 3); - } + for x: int in [1, 2, 3, 4, 5, 6] { if x == 3 { break; } assert (x <= 3); } i = 0; while i < 10 { i += 1; if i % 2 == 0 { cont; } assert (i % 2 != 0); } i = 0; do { i += 1; if i % 2 == 0 { cont; } assert (i % 2 != 0); } while i < 10 - for x: int in ~[1, 2, 3, 4, 5, 6] { + for x: int in [1, 2, 3, 4, 5, 6] { if x % 2 == 0 { cont; } assert (x % 2 != 0); } diff --git a/src/test/run-pass/call-autoderef-tag.rs b/src/test/run-pass/call-autoderef-tag.rs index 6cc87ae7b95..f978092ca95 100644 --- a/src/test/run-pass/call-autoderef-tag.rs +++ b/src/test/run-pass/call-autoderef-tag.rs @@ -1,5 +1,5 @@ -tag int_fn { f(fn(int) -> int ); } -tag int_box_fn { fb(@fn(int) -> int ); } +tag int_fn { f(fn(int) -> int); } +tag int_box_fn { fb(@fn(int) -> int); } fn add1(i: int) -> int { ret i + 1; } fn main() { let g = f(add1); @@ -7,4 +7,4 @@ fn main() { assert (f(add1)(5) == 6); assert ((@f(add1))(5) == 6); assert (fb(@add1)(7) == 8); -} \ No newline at end of file +} diff --git a/src/test/run-pass/cast.rs b/src/test/run-pass/cast.rs index 38a4ca72a1a..6d1560305d6 100644 --- a/src/test/run-pass/cast.rs +++ b/src/test/run-pass/cast.rs @@ -13,4 +13,4 @@ fn main() { assert (0x51 as char == 'Q'); assert (true == 1 as bool); assert (0 as u32 == false as u32); -} \ No newline at end of file +} diff --git a/src/test/run-pass/chan-leak.rs b/src/test/run-pass/chan-leak.rs index 39e445b47ec..e08bfbd28ed 100644 --- a/src/test/run-pass/chan-leak.rs +++ b/src/test/run-pass/chan-leak.rs @@ -7,10 +7,7 @@ import std::comm::send; import std::comm; import std::comm::mk_port; -tag request { - quit; - close(_chan<bool>); -} +tag request { quit; close(_chan<bool>); } type ctx = _chan<request>; diff --git a/src/test/run-pass/char.rs b/src/test/run-pass/char.rs index 8383a3d36fc..2783c05200f 100644 --- a/src/test/run-pass/char.rs +++ b/src/test/run-pass/char.rs @@ -10,4 +10,4 @@ fn main() { assert (d == c); assert (d == 'x'); assert ('x' == d); -} \ No newline at end of file +} diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index d6b48ccb131..2da34466cdb 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -5,4 +5,4 @@ import std::task; fn child2(s: str) { } -fn main() { let x = task::_spawn(bind child2("hi")); } \ No newline at end of file +fn main() { let x = task::_spawn(bind child2("hi")); } diff --git a/src/test/run-pass/claim-nonterm.rs b/src/test/run-pass/claim-nonterm.rs index 6b555f1bc59..770beeb9fbf 100644 --- a/src/test/run-pass/claim-nonterm.rs +++ b/src/test/run-pass/claim-nonterm.rs @@ -5,4 +5,4 @@ import std::uint::*; pred fails(a: uint) -> bool { fail; } -fn main() { let b: uint = 4u; claim (fails(b)); } \ No newline at end of file +fn main() { let b: uint = 4u; claim (fails(b)); } diff --git a/src/test/run-pass/command-line-args.rs b/src/test/run-pass/command-line-args.rs index 429bea89771..efd5d2bb04c 100644 --- a/src/test/run-pass/command-line-args.rs +++ b/src/test/run-pass/command-line-args.rs @@ -1,3 +1,3 @@ -fn main(args: [str]) { log args.(0); } +fn main(args: [str]) { log args[0]; } diff --git a/src/test/run-pass/complex.rs b/src/test/run-pass/complex.rs index cc5d8d3acb7..1b14e7ab7f5 100644 --- a/src/test/run-pass/complex.rs +++ b/src/test/run-pass/complex.rs @@ -25,4 +25,4 @@ fn foo(x: int) -> int { ret 0; } -fn main() { let x: int = 2 + 2; log x; log "hello, world"; log 10; } \ No newline at end of file +fn main() { let x: int = 2 + 2; log x; log "hello, world"; log 10; } diff --git a/src/test/run-pass/const.rs b/src/test/run-pass/const.rs index d181c49484b..b96ae6f7360 100644 --- a/src/test/run-pass/const.rs +++ b/src/test/run-pass/const.rs @@ -2,4 +2,4 @@ const i: int = 10; -fn main() { log i; } \ No newline at end of file +fn main() { log i; } diff --git a/src/test/run-pass/constrained-type.rs b/src/test/run-pass/constrained-type.rs index 96ab84cb53d..d05e4311dbf 100644 --- a/src/test/run-pass/constrained-type.rs +++ b/src/test/run-pass/constrained-type.rs @@ -6,6 +6,6 @@ type bubu = {x: int, y: int}; pred less_than(x: int, y: int) -> bool { ret x < y; } -type ordered_range = {low: int, high: int} : less_than(*.low, *.high); +type ordered_range = {low: int, high: int} : less_than(*.low, *.high); -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/constraint-prop-expr-move.rs b/src/test/run-pass/constraint-prop-expr-move.rs index c9104f3e789..56ebc914b93 100644 --- a/src/test/run-pass/constraint-prop-expr-move.rs +++ b/src/test/run-pass/constraint-prop-expr-move.rs @@ -9,4 +9,4 @@ fn main() { check (le(a, b)); c <- a; log safe_slice("kitties", c, b); -} \ No newline at end of file +} diff --git a/src/test/run-pass/constraint-prop-move.rs b/src/test/run-pass/constraint-prop-move.rs index 9418d3dff7f..97285adae0c 100644 --- a/src/test/run-pass/constraint-prop-move.rs +++ b/src/test/run-pass/constraint-prop-move.rs @@ -8,4 +8,4 @@ fn main() { check (le(a, b)); let c <- a; log safe_slice("kitties", c, b); -} \ No newline at end of file +} diff --git a/src/test/run-pass/constraint-prop-swap.rs b/src/test/run-pass/constraint-prop-swap.rs index 3212ad54e2a..7b96a89bb16 100644 --- a/src/test/run-pass/constraint-prop-swap.rs +++ b/src/test/run-pass/constraint-prop-swap.rs @@ -8,4 +8,4 @@ fn main() { check (le(b, a)); b <-> a; log safe_slice("kitties", a, b); -} \ No newline at end of file +} diff --git a/src/test/run-pass/constraint-prop.rs b/src/test/run-pass/constraint-prop.rs index 720f2ff5631..71f151f5260 100644 --- a/src/test/run-pass/constraint-prop.rs +++ b/src/test/run-pass/constraint-prop.rs @@ -8,4 +8,4 @@ fn main() { check (le(a, b)); let c = b; log safe_slice("kitties", a, c); -} \ No newline at end of file +} diff --git a/src/test/run-pass/crate-attributes-src/foo.rs b/src/test/run-pass/crate-attributes-src/foo.rs index 7decb512ec4..5ab36dfe00d 100644 --- a/src/test/run-pass/crate-attributes-src/foo.rs +++ b/src/test/run-pass/crate-attributes-src/foo.rs @@ -5,4 +5,4 @@ // Attributes of the following function #[attr1 = "val"] #[attr2 = "val"] -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/dead-code-one-arm-if.rs b/src/test/run-pass/dead-code-one-arm-if.rs index 456d8bff367..5aedb18282b 100644 --- a/src/test/run-pass/dead-code-one-arm-if.rs +++ b/src/test/run-pass/dead-code-one-arm-if.rs @@ -2,4 +2,4 @@ // -*- rust -*- -fn main() { if 1 == 1 { ret; } log "Paul is dead"; } \ No newline at end of file +fn main() { if 1 == 1 { ret; } log "Paul is dead"; } diff --git a/src/test/run-pass/deep.rs b/src/test/run-pass/deep.rs index c229ff93598..461d3c9ddfd 100644 --- a/src/test/run-pass/deep.rs +++ b/src/test/run-pass/deep.rs @@ -6,4 +6,4 @@ fn f(x: int) -> int { if x == 1 { ret 1; } else { let y: int = 1 + f(x - 1); ret y; } } -fn main() { assert (f(5000) == 5000); } \ No newline at end of file +fn main() { assert (f(5000) == 5000); } diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index ba5149a7fd8..33d7f48dfe0 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -1,3 +1,3 @@ -fn main() { let x = @mutable 5; *x = 1000; log *x; } \ No newline at end of file +fn main() { let x = @mutable 5; *x = 1000; log *x; } diff --git a/src/test/run-pass/deref.rs b/src/test/run-pass/deref.rs index 71dcfeb81f6..0d7276af659 100644 --- a/src/test/run-pass/deref.rs +++ b/src/test/run-pass/deref.rs @@ -1,3 +1,3 @@ -fn main() { let x: @int = @10; let y: int = *x; } \ No newline at end of file +fn main() { let x: @int = @10; let y: int = *x; } diff --git a/src/test/run-pass/div-mod.rs b/src/test/run-pass/div-mod.rs index 38a5bab5ca7..0e663ef4e09 100644 --- a/src/test/run-pass/div-mod.rs +++ b/src/test/run-pass/div-mod.rs @@ -15,4 +15,4 @@ fn main() { assert (x % 3 == 0); assert (x % y == 0); assert (15 % y == 0); -} \ No newline at end of file +} diff --git a/src/test/run-pass/double-unbox.rs b/src/test/run-pass/double-unbox.rs index 32ecfa628e6..aacfbb91509 100644 --- a/src/test/run-pass/double-unbox.rs +++ b/src/test/run-pass/double-unbox.rs @@ -3,4 +3,4 @@ type quux = {bar: int}; fn g(i: &int) { } fn f(foo: @@quux) { g(foo.bar); } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/drop-bind-thunk-args.rs b/src/test/run-pass/drop-bind-thunk-args.rs index d5eddb77321..2a2d2c5e630 100644 --- a/src/test/run-pass/drop-bind-thunk-args.rs +++ b/src/test/run-pass/drop-bind-thunk-args.rs @@ -2,4 +2,4 @@ fn f(x: @int) { } -fn main() { let x = @10; let ff = bind f(_); ff(x); ff(x); } \ No newline at end of file +fn main() { let x = @10; let ff = bind f(_); ff(x); ff(x); } diff --git a/src/test/run-pass/drop-on-empty-block-exit.rs b/src/test/run-pass/drop-on-empty-block-exit.rs index 2a4f093f1de..97a161f19e7 100644 --- a/src/test/run-pass/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop-on-empty-block-exit.rs @@ -2,4 +2,4 @@ tag t { foo(@int); } -fn main() { let tt = foo(@10); alt tt { foo(z) { } } } \ No newline at end of file +fn main() { let tt = foo(@10); alt tt { foo(z) { } } } diff --git a/src/test/run-pass/drop-on-ret.rs b/src/test/run-pass/drop-on-ret.rs index f1da1a37176..821601baae8 100644 --- a/src/test/run-pass/drop-on-ret.rs +++ b/src/test/run-pass/drop-on-ret.rs @@ -4,4 +4,4 @@ // -*- rust -*- fn f() -> int { if true { let s: str = "should not leak"; ret 1; } ret 0; } -fn main() { f(); } \ No newline at end of file +fn main() { f(); } diff --git a/src/test/run-pass/early-ret-binop-add.rs b/src/test/run-pass/early-ret-binop-add.rs index dc847b30fc2..f7719afc591 100644 --- a/src/test/run-pass/early-ret-binop-add.rs +++ b/src/test/run-pass/early-ret-binop-add.rs @@ -1,4 +1,2 @@ -fn wsucc(n: int) -> int { - { ret n + 1 } + 0; -} -fn main() {} +fn wsucc(n: int) -> int { { ret n + 1 } + 0; } +fn main() { } diff --git a/src/test/run-pass/early-ret-binop.rs b/src/test/run-pass/early-ret-binop.rs index 682bf502ce3..ffa6efb4e80 100644 --- a/src/test/run-pass/early-ret-binop.rs +++ b/src/test/run-pass/early-ret-binop.rs @@ -1,4 +1,2 @@ -fn wsucc(n: int) -> int { - { ret n + 1 } == 0; -} -fn main() {} +fn wsucc(n: int) -> int { { ret n + 1 } == 0; } +fn main() { } diff --git a/src/test/run-pass/else-if.rs b/src/test/run-pass/else-if.rs index cf13a53d86a..5f85f13ae80 100644 --- a/src/test/run-pass/else-if.rs +++ b/src/test/run-pass/else-if.rs @@ -3,13 +3,13 @@ fn main() { if 1 == 2 { assert (false); - } else if (2 == 3) { + } else if 2 == 3 { assert (false); - } else if (3 == 4) { assert (false); } else { assert (true); } - if 1 == 2 { assert (false); } else if (2 == 2) { assert (true); } + } else if 3 == 4 { assert (false); } else { assert (true); } + if 1 == 2 { assert (false); } else if 2 == 2 { assert (true); } if 1 == 2 { assert (false); - } else if (2 == 2) { + } else if 2 == 2 { if 1 == 1 { assert (true); } else { if 2 == 1 { assert (false); } else { assert (false); } } @@ -17,4 +17,4 @@ fn main() { if 1 == 2 { assert (false); } else { if 1 == 2 { assert (false); } else { assert (true); } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/empty-mutable-vec.rs b/src/test/run-pass/empty-mutable-vec.rs index de1d84ae134..6dfd5446160 100644 --- a/src/test/run-pass/empty-mutable-vec.rs +++ b/src/test/run-pass/empty-mutable-vec.rs @@ -1,3 +1,3 @@ -fn main() { let v: [mutable int] = ~[mutable ]; } +fn main() { let v: [mutable int] = [mutable]; } diff --git a/src/test/run-pass/export-abstract-tag.rs b/src/test/run-pass/export-abstract-tag.rs index 7ef167c6a0a..f30d128635b 100644 --- a/src/test/run-pass/export-abstract-tag.rs +++ b/src/test/run-pass/export-abstract-tag.rs @@ -10,4 +10,4 @@ mod foo { fn f() -> t { ret t1; } } -fn main() { let v: foo::t = foo::f(); } \ No newline at end of file +fn main() { let v: foo::t = foo::f(); } diff --git a/src/test/run-pass/export-multi.rs b/src/test/run-pass/export-multi.rs index 9f382cb4b77..6229e60532e 100644 --- a/src/test/run-pass/export-multi.rs +++ b/src/test/run-pass/export-multi.rs @@ -4,13 +4,8 @@ import m::g; mod m { export f, g; - fn f() {} - fn g() {} + fn f() { } + fn g() { } } -fn main() { - f(); - g(); - m::f(); - m::g(); -} \ No newline at end of file +fn main() { f(); g(); m::f(); m::g(); } diff --git a/src/test/run-pass/export-non-interference2.rs b/src/test/run-pass/export-non-interference2.rs index b9ffd8e8a58..c32f718c4d1 100644 --- a/src/test/run-pass/export-non-interference2.rs +++ b/src/test/run-pass/export-non-interference2.rs @@ -9,4 +9,4 @@ mod foo { fn x() { log "x"; } } -fn main() { foo::bar::y(); } \ No newline at end of file +fn main() { foo::bar::y(); } diff --git a/src/test/run-pass/export-non-interference3.rs b/src/test/run-pass/export-non-interference3.rs index bfb734525a1..14fba5d40c3 100644 --- a/src/test/run-pass/export-non-interference3.rs +++ b/src/test/run-pass/export-non-interference3.rs @@ -10,4 +10,4 @@ mod bar { fn x() { log "x"; } } -fn main() { foo::x(); } \ No newline at end of file +fn main() { foo::x(); } diff --git a/src/test/run-pass/export-tag-variant.rs b/src/test/run-pass/export-tag-variant.rs index f7599d08728..12eaf63949b 100644 --- a/src/test/run-pass/export-tag-variant.rs +++ b/src/test/run-pass/export-tag-variant.rs @@ -5,4 +5,4 @@ mod foo { tag t { t1; } } -fn main() { let v = foo::t1; } \ No newline at end of file +fn main() { let v = foo::t1; } diff --git a/src/test/run-pass/export-unexported-dep.rs b/src/test/run-pass/export-unexported-dep.rs index 8f1d54ea5a5..bc8451a4854 100644 --- a/src/test/run-pass/export-unexported-dep.rs +++ b/src/test/run-pass/export-unexported-dep.rs @@ -13,4 +13,4 @@ mod foo { fn g(v: t) { assert (v == t1); } } -fn main() { foo::g(foo::f()); } \ No newline at end of file +fn main() { foo::g(foo::f()); } diff --git a/src/test/run-pass/expr-alt-box.rs b/src/test/run-pass/expr-alt-box.rs index a397874dbd9..84c9e424f46 100644 --- a/src/test/run-pass/expr-alt-box.rs +++ b/src/test/run-pass/expr-alt-box.rs @@ -11,4 +11,4 @@ fn test_str() { assert (res == "happy"); } -fn main() { test_box(); test_str(); } \ No newline at end of file +fn main() { test_box(); test_str(); } diff --git a/src/test/run-pass/expr-alt-fail-all.rs b/src/test/run-pass/expr-alt-fail-all.rs index 55f4e69524d..3ff8af3cb97 100644 --- a/src/test/run-pass/expr-alt-fail-all.rs +++ b/src/test/run-pass/expr-alt-fail-all.rs @@ -9,4 +9,4 @@ fn main() { true { 10 } false { alt true { true { fail } false { fail } } } }; -} \ No newline at end of file +} diff --git a/src/test/run-pass/expr-alt-fail.rs b/src/test/run-pass/expr-alt-fail.rs index fb3f0dac014..7dfffcc1120 100644 --- a/src/test/run-pass/expr-alt-fail.rs +++ b/src/test/run-pass/expr-alt-fail.rs @@ -4,8 +4,8 @@ fn test_simple() { } fn test_box() { - let r = alt true { true { ~[10] } false { fail } }; - assert (r.(0) == 10); + let r = alt true { true { [10] } false { fail } }; + assert (r[0] == 10); } -fn main() { test_simple(); test_box(); } \ No newline at end of file +fn main() { test_simple(); test_box(); } diff --git a/src/test/run-pass/expr-alt-generic-box1.rs b/src/test/run-pass/expr-alt-generic-box1.rs index ec299544094..763f303bbd6 100644 --- a/src/test/run-pass/expr-alt-generic-box1.rs +++ b/src/test/run-pass/expr-alt-generic-box1.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(@T, @T) -> bool ; +type compare<T> = fn(@T, @T) -> bool; fn test_generic<T>(expected: @T, eq: &compare<T>) { let actual: @T = alt true { true { expected } }; diff --git a/src/test/run-pass/expr-alt-generic-box2.rs b/src/test/run-pass/expr-alt-generic-box2.rs index f7e96af98d5..046d77cd438 100644 --- a/src/test/run-pass/expr-alt-generic-box2.rs +++ b/src/test/run-pass/expr-alt-generic-box2.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool ; +type compare<T> = fn(&T, &T) -> bool; fn test_generic<T>(expected: &T, eq: &compare<T>) { let actual: T = alt true { true { expected } }; diff --git a/src/test/run-pass/expr-alt-generic.rs b/src/test/run-pass/expr-alt-generic.rs index cfecd0302a1..c9990a0c756 100644 --- a/src/test/run-pass/expr-alt-generic.rs +++ b/src/test/run-pass/expr-alt-generic.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool ; +type compare<T> = fn(&T, &T) -> bool; fn test_generic<T>(expected: &T, eq: &compare<T>) { let actual: T = alt true { true { expected } }; diff --git a/src/test/run-pass/expr-alt-struct.rs b/src/test/run-pass/expr-alt-struct.rs index 51ef9e09457..e346c9d2a9f 100644 --- a/src/test/run-pass/expr-alt-struct.rs +++ b/src/test/run-pass/expr-alt-struct.rs @@ -15,4 +15,4 @@ fn test_tag() { assert (rs == happy); } -fn main() { test_rec(); test_tag(); } \ No newline at end of file +fn main() { test_rec(); test_tag(); } diff --git a/src/test/run-pass/expr-alt.rs b/src/test/run-pass/expr-alt.rs index 8d4ddd288f6..93495115ba7 100644 --- a/src/test/run-pass/expr-alt.rs +++ b/src/test/run-pass/expr-alt.rs @@ -41,4 +41,4 @@ fn main() { test_inferrence(); test_alt_as_alt_head(); test_alt_as_block_result(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/expr-block-box.rs b/src/test/run-pass/expr-block-box.rs index 62971193037..c434db7a8bf 100644 --- a/src/test/run-pass/expr-block-box.rs +++ b/src/test/run-pass/expr-block-box.rs @@ -2,4 +2,4 @@ // -*- rust -*- -fn main() { let x = { @100 }; assert (*x == 100); } \ No newline at end of file +fn main() { let x = { @100 }; assert (*x == 100); } diff --git a/src/test/run-pass/expr-block-fn.rs b/src/test/run-pass/expr-block-fn.rs index dc8690f15ad..8b461bcf863 100644 --- a/src/test/run-pass/expr-block-fn.rs +++ b/src/test/run-pass/expr-block-fn.rs @@ -1,11 +1,11 @@ fn test_fn() { - type t = fn() -> int ; + type t = fn() -> int; fn ten() -> int { ret 10; } let rs: t = { ten }; assert (rs() == 10); } -fn main() { test_fn(); } \ No newline at end of file +fn main() { test_fn(); } diff --git a/src/test/run-pass/expr-block-generic-box1.rs b/src/test/run-pass/expr-block-generic-box1.rs index d68f0cf5d89..5ab310cb309 100644 --- a/src/test/run-pass/expr-block-generic-box1.rs +++ b/src/test/run-pass/expr-block-generic-box1.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(@T, @T) -> bool ; +type compare<T> = fn(@T, @T) -> bool; fn test_generic<T>(expected: @T, eq: &compare<T>) { let actual: @T = { expected }; diff --git a/src/test/run-pass/expr-block-generic-box2.rs b/src/test/run-pass/expr-block-generic-box2.rs index d630b65c822..3f8293490f3 100644 --- a/src/test/run-pass/expr-block-generic-box2.rs +++ b/src/test/run-pass/expr-block-generic-box2.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool ; +type compare<T> = fn(&T, &T) -> bool; fn test_generic<T>(expected: &T, eq: &compare<T>) { let actual: T = { expected }; diff --git a/src/test/run-pass/expr-block-generic.rs b/src/test/run-pass/expr-block-generic.rs index d7c17731559..52d463eae2a 100644 --- a/src/test/run-pass/expr-block-generic.rs +++ b/src/test/run-pass/expr-block-generic.rs @@ -4,7 +4,7 @@ // -*- rust -*- // Tests for standalone blocks as expressions with dynamic type sizes -type compare<T> = fn(&T, &T) -> bool ; +type compare<T> = fn(&T, &T) -> bool; fn test_generic<T>(expected: &T, eq: &compare<T>) { let actual: T = { expected }; diff --git a/src/test/run-pass/expr-block-ref.rs b/src/test/run-pass/expr-block-ref.rs index 6a0a1700a94..59107298782 100644 --- a/src/test/run-pass/expr-block-ref.rs +++ b/src/test/run-pass/expr-block-ref.rs @@ -1,2 +1,2 @@ // Regression test for issue #388 -fn main() { let x = { { @10 } }; } \ No newline at end of file +fn main() { let x = { { @10 } }; } diff --git a/src/test/run-pass/expr-block-slot.rs b/src/test/run-pass/expr-block-slot.rs index d36330f287f..f2a73836f01 100644 --- a/src/test/run-pass/expr-block-slot.rs +++ b/src/test/run-pass/expr-block-slot.rs @@ -4,4 +4,4 @@ fn main() { assert (a.a == 3); let c = { let d = {v: 3}; d }; assert (c.v == 3); -} \ No newline at end of file +} diff --git a/src/test/run-pass/expr-block.rs b/src/test/run-pass/expr-block.rs index d0fb65c5ffd..3aab0a64744 100644 --- a/src/test/run-pass/expr-block.rs +++ b/src/test/run-pass/expr-block.rs @@ -13,4 +13,4 @@ fn test_filled_with_stuff() { assert (rs == 10); } -fn main() { test_basic(); test_rec(); test_filled_with_stuff(); } \ No newline at end of file +fn main() { test_basic(); test_rec(); test_filled_with_stuff(); } diff --git a/src/test/run-pass/expr-copy.rs b/src/test/run-pass/expr-copy.rs index 6fbaf4f7679..56f7dbb9996 100644 --- a/src/test/run-pass/expr-copy.rs +++ b/src/test/run-pass/expr-copy.rs @@ -1,5 +1 @@ -fn main() { - let x = 10; - let y = copy x; - log y; -} \ No newline at end of file +fn main() { let x = 10; let y = copy x; log y; } diff --git a/src/test/run-pass/expr-elseif-ref.rs b/src/test/run-pass/expr-elseif-ref.rs index 1de7fa6e414..4235c21ac5f 100644 --- a/src/test/run-pass/expr-elseif-ref.rs +++ b/src/test/run-pass/expr-elseif-ref.rs @@ -2,6 +2,6 @@ // values from the else if branch fn main() { let y: @uint = @10u; - let x = if false { y } else if (true) { y } else { y }; + let x = if false { y } else if true { y } else { y }; assert (*y == 10u); } diff --git a/src/test/run-pass/expr-elseif-ref2.rs b/src/test/run-pass/expr-elseif-ref2.rs index ef8559ef062..8a3af93dc90 100644 --- a/src/test/run-pass/expr-elseif-ref2.rs +++ b/src/test/run-pass/expr-elseif-ref2.rs @@ -1,4 +1,2 @@ // Regression test for issue #388 -fn main() { - let x = if false { @0u } else if (true) { @10u } else { @0u }; -} \ No newline at end of file +fn main() { let x = if false { @0u } else if true { @10u } else { @0u }; } diff --git a/src/test/run-pass/expr-empty-ret.rs b/src/test/run-pass/expr-empty-ret.rs index 99ce1fac7b7..6044c6e8ff7 100644 --- a/src/test/run-pass/expr-empty-ret.rs +++ b/src/test/run-pass/expr-empty-ret.rs @@ -2,4 +2,4 @@ fn f() { let x = alt true { true { 10 } false { ret } }; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/expr-fn.rs b/src/test/run-pass/expr-fn.rs index 1bff51000b9..b7070ead5ed 100644 --- a/src/test/run-pass/expr-fn.rs +++ b/src/test/run-pass/expr-fn.rs @@ -4,8 +4,8 @@ fn test_int() { } fn test_vec() { - fn f() -> [int] { ~[10, 11] } - assert (f().(1) == 11); + fn f() -> [int] { [10, 11] } + assert (f()[1] == 11); } fn test_generic() { diff --git a/src/test/run-pass/expr-if-box.rs b/src/test/run-pass/expr-if-box.rs index 32881d23bae..7d9e2320e93 100644 --- a/src/test/run-pass/expr-if-box.rs +++ b/src/test/run-pass/expr-if-box.rs @@ -14,4 +14,4 @@ fn test_str() { assert (rs == "happy"); } -fn main() { test_box(); test_str(); } \ No newline at end of file +fn main() { test_box(); test_str(); } diff --git a/src/test/run-pass/expr-if-fail-all.rs b/src/test/run-pass/expr-if-fail-all.rs index f9ad1075605..347a7f5ce9a 100644 --- a/src/test/run-pass/expr-if-fail-all.rs +++ b/src/test/run-pass/expr-if-fail-all.rs @@ -1,3 +1,3 @@ // When all branches of an if expression result in fail, the entire if // expression results in fail. -fn main() { let x = if true { 10 } else { if true { fail } else { fail } }; } \ No newline at end of file +fn main() { let x = if true { 10 } else { if true { fail } else { fail } }; } diff --git a/src/test/run-pass/expr-if-fail.rs b/src/test/run-pass/expr-if-fail.rs index 4c9c8e07d4c..0a19c446388 100644 --- a/src/test/run-pass/expr-if-fail.rs +++ b/src/test/run-pass/expr-if-fail.rs @@ -6,8 +6,8 @@ fn test_else_fail() { } fn test_elseif_fail() { - let x = if false { 0 } else if (false) { fail } else { 10 }; + let x = if false { 0 } else if false { fail } else { 10 }; assert (x == 10); } -fn main() { test_if_fail(); test_else_fail(); test_elseif_fail(); } \ No newline at end of file +fn main() { test_if_fail(); test_else_fail(); test_elseif_fail(); } diff --git a/src/test/run-pass/expr-if-generic-box1.rs b/src/test/run-pass/expr-if-generic-box1.rs index 82bbbb840a6..6d69cce9a1b 100644 --- a/src/test/run-pass/expr-if-generic-box1.rs +++ b/src/test/run-pass/expr-if-generic-box1.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(@T, @T) -> bool ; +type compare<T> = fn(@T, @T) -> bool; fn test_generic<T>(expected: @T, not_expected: @T, eq: &compare<T>) { let actual: @T = if true { expected } else { not_expected }; diff --git a/src/test/run-pass/expr-if-generic-box2.rs b/src/test/run-pass/expr-if-generic-box2.rs index 7cf77d61686..b31fb91f229 100644 --- a/src/test/run-pass/expr-if-generic-box2.rs +++ b/src/test/run-pass/expr-if-generic-box2.rs @@ -2,7 +2,7 @@ // -*- rust -*- -type compare<T> = fn(&T, &T) -> bool ; +type compare<T> = fn(&T, &T) -> bool; fn test_generic<T>(expected: &T, not_expected: &T, eq: &compare<T>) { let actual: T = if true { expected } else { not_expected }; diff --git a/src/test/run-pass/expr-if-generic.rs b/src/test/run-pass/expr-if-generic.rs index df466051ce4..99709ea396c 100644 --- a/src/test/run-pass/expr-if-generic.rs +++ b/src/test/run-pass/expr-if-generic.rs @@ -4,7 +4,7 @@ // -*- rust -*- // Tests for if as expressions with dynamic type sizes -type compare<T> = fn(&T, &T) -> bool ; +type compare<T> = fn(&T, &T) -> bool; fn test_generic<T>(expected: &T, not_expected: &T, eq: &compare<T>) { let actual: T = if true { expected } else { not_expected }; diff --git a/src/test/run-pass/expr-if-struct.rs b/src/test/run-pass/expr-if-struct.rs index 481fbf3b21a..56728c67706 100644 --- a/src/test/run-pass/expr-if-struct.rs +++ b/src/test/run-pass/expr-if-struct.rs @@ -15,4 +15,4 @@ fn test_tag() { assert (rs == happy); } -fn main() { test_rec(); test_tag(); } \ No newline at end of file +fn main() { test_rec(); test_tag(); } diff --git a/src/test/run-pass/expr-if.rs b/src/test/run-pass/expr-if.rs index 74c2a53eda1..43f3083f164 100644 --- a/src/test/run-pass/expr-if.rs +++ b/src/test/run-pass/expr-if.rs @@ -12,17 +12,17 @@ fn test_else() { } fn test_elseif1() { - let rs: bool = if true { true } else if (true) { false } else { false }; + let rs: bool = if true { true } else if true { false } else { false }; assert (rs); } fn test_elseif2() { - let rs: bool = if false { false } else if (true) { true } else { false }; + let rs: bool = if false { false } else if true { true } else { false }; assert (rs); } fn test_elseif3() { - let rs: bool = if false { false } else if (false) { false } else { true }; + let rs: bool = if false { false } else if false { false } else { true }; assert (rs); } @@ -52,4 +52,4 @@ fn main() { test_inferrence(); test_if_as_if_condition(); test_if_as_block_result(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/expr-scope.rs b/src/test/run-pass/expr-scope.rs index d5a2a069f7f..53c8223c778 100644 --- a/src/test/run-pass/expr-scope.rs +++ b/src/test/run-pass/expr-scope.rs @@ -2,4 +2,4 @@ // xfail-fast fn f() { } -fn main() { ret ::f(); } \ No newline at end of file +fn main() { ret ::f(); } diff --git a/src/test/run-pass/exterior.rs b/src/test/run-pass/exterior.rs index ae34d051a2b..228f7dff061 100644 --- a/src/test/run-pass/exterior.rs +++ b/src/test/run-pass/exterior.rs @@ -13,4 +13,4 @@ fn main() { f(b); assert (a.z == 12); assert (b.z == 13); -} \ No newline at end of file +} diff --git a/src/test/run-pass/fact.rs b/src/test/run-pass/fact.rs index f47c2e9ece9..95af3b8a6b6 100644 --- a/src/test/run-pass/fact.rs +++ b/src/test/run-pass/fact.rs @@ -25,4 +25,4 @@ fn main() { assert (f(5) == 120); // log "all done"; -} \ No newline at end of file +} diff --git a/src/test/run-pass/fixed-point-bind-box.rs b/src/test/run-pass/fixed-point-bind-box.rs index f93add461a4..4ca1cdb34c9 100644 --- a/src/test/run-pass/fixed-point-bind-box.rs +++ b/src/test/run-pass/fixed-point-bind-box.rs @@ -1,12 +1,12 @@ -fn fix_help<A, B>(f: @fn(@fn(&A) -> B , &A) -> B , x: &A) -> B { +fn fix_help<A, B>(f: @fn(@fn(&A) -> B, &A) -> B, x: &A) -> B { ret f(@bind fix_help(f, _), x); } -fn fix<A, B>(f: @fn(@fn(&A) -> B , &A) -> B ) -> @fn(&A) -> B { +fn fix<A, B>(f: @fn(@fn(&A) -> B, &A) -> B) -> @fn(&A) -> B { ret @bind fix_help(f, _); } -fn fact_(f: @fn(&int) -> int , n: &int) -> int { +fn fact_(f: @fn(&int) -> int, n: &int) -> int { // fun fact 0 = 1 ret if n == 0 { 1 } else { n * f(n - 1) }; } diff --git a/src/test/run-pass/float-signature.rs b/src/test/run-pass/float-signature.rs index f2e7229623a..8eb940d8883 100644 --- a/src/test/run-pass/float-signature.rs +++ b/src/test/run-pass/float-signature.rs @@ -5,4 +5,4 @@ fn main() { let n: float = 0.1; let m: float = foo(n); log m; -} \ No newline at end of file +} diff --git a/src/test/run-pass/float.rs b/src/test/run-pass/float.rs index b9014c9b085..a0b4a32d41a 100644 --- a/src/test/run-pass/float.rs +++ b/src/test/run-pass/float.rs @@ -7,4 +7,4 @@ fn main() { || pi > 1.0 { log "yes"; } -} \ No newline at end of file +} diff --git a/src/test/run-pass/float2.rs b/src/test/run-pass/float2.rs index 1eed1e37aec..26b5a64ebe5 100644 --- a/src/test/run-pass/float2.rs +++ b/src/test/run-pass/float2.rs @@ -21,4 +21,4 @@ fn main() { assert (h == i); assert (j > k); assert (k < a); -} \ No newline at end of file +} diff --git a/src/test/run-pass/floatlits.rs b/src/test/run-pass/floatlits.rs index 13039f2bf3b..6f43ad9b760 100644 --- a/src/test/run-pass/floatlits.rs +++ b/src/test/run-pass/floatlits.rs @@ -7,4 +7,4 @@ fn main() { let g = 4.90000000001e-10; assert (g > 5e-11); assert (g < 5e-9); -} \ No newline at end of file +} diff --git a/src/test/run-pass/fn-constraint.rs b/src/test/run-pass/fn-constraint.rs index 2f7b81effec..f9ea572a735 100644 --- a/src/test/run-pass/fn-constraint.rs +++ b/src/test/run-pass/fn-constraint.rs @@ -7,4 +7,4 @@ fn main() { let b: uint = 4u; check (le(a, b)); log safe_slice("kitties", a, b); -} \ No newline at end of file +} diff --git a/src/test/run-pass/fn-expr.rs b/src/test/run-pass/fn-expr.rs index dfe4d2bd9a7..64b28e4a289 100644 --- a/src/test/run-pass/fn-expr.rs +++ b/src/test/run-pass/fn-expr.rs @@ -1 +1 @@ -fn main() { let x = fn (a: int) -> int { ret a + 1; }; assert (x(4) == 5); } \ No newline at end of file +fn main() { let x = fn (a: int) -> int { ret a + 1; }; assert (x(4) == 5); } diff --git a/src/test/run-pass/fn-lval.rs b/src/test/run-pass/fn-lval.rs index faa12c8720d..c62ad36052f 100644 --- a/src/test/run-pass/fn-lval.rs +++ b/src/test/run-pass/fn-lval.rs @@ -2,8 +2,8 @@ // -*- rust -*- -fn foo(f: fn(int) -> int ) { } +fn foo(f: fn(int) -> int) { } fn id(x: int) -> int { ret x; } -fn main() { foo(id); } \ No newline at end of file +fn main() { foo(id); } diff --git a/src/test/run-pass/fn-type-infer.rs b/src/test/run-pass/fn-type-infer.rs index c3513bdff8a..d9b6ac60ba3 100644 --- a/src/test/run-pass/fn-type-infer.rs +++ b/src/test/run-pass/fn-type-infer.rs @@ -1,4 +1,4 @@ fn main() { // We should be able to type infer inside of lambdas. let f = fn () { let i = 10; }; -} \ No newline at end of file +} diff --git a/src/test/run-pass/for-destruct.rs b/src/test/run-pass/for-destruct.rs index cc1702d247c..569d596e7b7 100644 --- a/src/test/run-pass/for-destruct.rs +++ b/src/test/run-pass/for-destruct.rs @@ -1,5 +1,5 @@ fn main() { - for {x, y}: {x: int, y: int} in ~[{x: 10, y: 20}, {x: 30, y: 0}] { - assert x + y == 30; + for {x: x, y: y}: {x: int, y: int} in [{x: 10, y: 20}, {x: 30, y: 0}] { + assert (x + y == 30); } } diff --git a/src/test/run-pass/for-each-destruct.rs b/src/test/run-pass/for-each-destruct.rs index 935746473a9..59488f8730d 100644 --- a/src/test/run-pass/for-each-destruct.rs +++ b/src/test/run-pass/for-each-destruct.rs @@ -1,13 +1,8 @@ iter x() -> {x: int, y: int} { let i = 0; - while i < 40 { - put {x: i, y: 30 - i}; - i += 10; - } + while i < 40 { put {x: i, y: 30 - i}; i += 10; } } fn main() { - for each {x, y}: {x: int, y: int} in x() { - assert x + y == 30; - } + for each {x: x, y: y}: {x: int, y: int} in x() { assert (x + y == 30); } } diff --git a/src/test/run-pass/for-loop-fail.rs b/src/test/run-pass/for-loop-fail.rs index 2e52a5ae1f7..d605e1797e1 100644 --- a/src/test/run-pass/for-loop-fail.rs +++ b/src/test/run-pass/for-loop-fail.rs @@ -1 +1 @@ -fn main() { let x: [int] = ~[]; for i: int in x { fail "moop"; } } +fn main() { let x: [int] = []; for i: int in x { fail "moop"; } } diff --git a/src/test/run-pass/foreach-nested-2.rs b/src/test/run-pass/foreach-nested-2.rs index ba42d7a6ac4..472bea23cfe 100644 --- a/src/test/run-pass/foreach-nested-2.rs +++ b/src/test/run-pass/foreach-nested-2.rs @@ -10,20 +10,20 @@ iter range(start: int, stop: int) -> int { } fn main() { - let a: [mutable int] = ~[mutable -1, -1, -1, -1, -1, -1, -1, -1]; + let a: [mutable int] = [mutable -1, -1, -1, -1, -1, -1, -1, -1]; let p: int = 0; for each i: int in two() { for each j: int in range(0, 2) { let tmp: int = 10 * i + j; - for each k: int in range(0, 2) { a.(p) = 10 * tmp + k; p += 1; } + for each k: int in range(0, 2) { a[p] = 10 * tmp + k; p += 1; } } } - assert (a.(0) == 0); - assert (a.(1) == 1); - assert (a.(2) == 10); - assert (a.(3) == 11); - assert (a.(4) == 100); - assert (a.(5) == 101); - assert (a.(6) == 110); - assert (a.(7) == 111); + assert (a[0] == 0); + assert (a[1] == 1); + assert (a[2] == 10); + assert (a[3] == 11); + assert (a[4] == 100); + assert (a[5] == 101); + assert (a[6] == 110); + assert (a[7] == 111); } diff --git a/src/test/run-pass/foreach-nested.rs b/src/test/run-pass/foreach-nested.rs index 4e90818621d..802381006e5 100644 --- a/src/test/run-pass/foreach-nested.rs +++ b/src/test/run-pass/foreach-nested.rs @@ -5,13 +5,13 @@ iter two() -> int { put 0; put 1; } fn main() { - let a: [mutable int] = ~[mutable -1, -1, -1, -1]; + let a: [mutable int] = [mutable -1, -1, -1, -1]; let p: int = 0; for each i: int in two() { - for each j: int in two() { a.(p) = 10 * i + j; p += 1; } + for each j: int in two() { a[p] = 10 * i + j; p += 1; } } - assert (a.(0) == 0); - assert (a.(1) == 1); - assert (a.(2) == 10); - assert (a.(3) == 11); + assert (a[0] == 0); + assert (a[1] == 1); + assert (a[2] == 10); + assert (a[3] == 11); } diff --git a/src/test/run-pass/fun-call-variants.rs b/src/test/run-pass/fun-call-variants.rs index 6409767ab40..0469e804948 100644 --- a/src/test/run-pass/fun-call-variants.rs +++ b/src/test/run-pass/fun-call-variants.rs @@ -1,15 +1,13 @@ // -*- rust -*- -fn ho(f: fn(int) -> int ) -> int { let n: int = f(3); ret n; } +fn ho(f: fn(int) -> int) -> int { let n: int = f(3); ret n; } fn direct(x: int) -> int { ret x + 1; } fn main() { - let a: int = - direct(3); // direct + let a: int = direct(3); // direct let b: int = ho(direct); // indirect unbound - let c: int = - ho(bind direct(_)); // indirect bound + let c: int = ho(bind direct(_)); // indirect bound assert (a == b); assert (b == c); -} \ No newline at end of file +} diff --git a/src/test/run-pass/fun-indirect-call.rs b/src/test/run-pass/fun-indirect-call.rs index 7bbfd7b84e9..8c4068c425c 100644 --- a/src/test/run-pass/fun-indirect-call.rs +++ b/src/test/run-pass/fun-indirect-call.rs @@ -4,4 +4,4 @@ // -*- rust -*- fn f() -> int { ret 42; } -fn main() { let g: fn() -> int = f; let i: int = g(); assert (i == 42); } \ No newline at end of file +fn main() { let g: fn() -> int = f; let i: int = g(); assert (i == 42); } diff --git a/src/test/run-pass/generic-ivec-leak.rs b/src/test/run-pass/generic-ivec-leak.rs index f9755e176b9..4e4508d08e9 100644 --- a/src/test/run-pass/generic-ivec-leak.rs +++ b/src/test/run-pass/generic-ivec-leak.rs @@ -1,4 +1,4 @@ tag wrapper<T> { wrapped(T); } -fn main() { let w = wrapped(~[1, 2, 3, 4, 5]); } +fn main() { let w = wrapped([1, 2, 3, 4, 5]); } diff --git a/src/test/run-pass/generic-ivec.rs b/src/test/run-pass/generic-ivec.rs index 39ba083a5a3..26298de5b94 100644 --- a/src/test/run-pass/generic-ivec.rs +++ b/src/test/run-pass/generic-ivec.rs @@ -1,3 +1,3 @@ fn f<T>(v: @T) { } -fn main() { f(@~[1, 2, 3, 4, 5]); } +fn main() { f(@[1, 2, 3, 4, 5]); } diff --git a/src/test/run-pass/generic-temporary.rs b/src/test/run-pass/generic-temporary.rs index 1abd0f7daf9..afac9e176ee 100644 --- a/src/test/run-pass/generic-temporary.rs +++ b/src/test/run-pass/generic-temporary.rs @@ -4,10 +4,10 @@ fn mk() -> int { ret 1; } fn chk(a: &int) { log a; assert (a == 1); } -fn apply<T>(produce: fn() -> T , consume: fn(&T) ) { consume(produce()); } +fn apply<T>(produce: fn() -> T, consume: fn(&T)) { consume(produce()); } fn main() { - let produce: fn() -> int = mk; - let consume: fn(&int) = chk; + let produce: fn() -> int = mk; + let consume: fn(&int) = chk; apply::<int>(produce, consume); } diff --git a/src/test/run-pass/generic-tup.rs b/src/test/run-pass/generic-tup.rs index bdd8ddf1268..8cacf51e9b5 100644 --- a/src/test/run-pass/generic-tup.rs +++ b/src/test/run-pass/generic-tup.rs @@ -1,7 +1,4 @@ -fn get_third<T>(t: &(T, T, T)) -> T { - let (_, _, x) = t; - ret x; -} +fn get_third<T>(t: &(T, T, T)) -> T { let (_, _, x) = t; ret x; } fn main() { log get_third((1, 2, 3)); diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index ecf13f39595..31b34aa1464 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -26,9 +26,9 @@ mod map_reduce { export mapper; export map_reduce; - type putter = fn(str, str) ; + type putter = fn(str, str); - type mapper = fn(str, putter) ; + type mapper = fn(str, putter); tag ctrl_proto { find_reducer([u8], _chan<int>); mapper_done; } @@ -92,5 +92,5 @@ mod map_reduce { } fn main() { - map_reduce::map_reduce(~["../src/test/run-pass/hashmap-memory.rs"]); + map_reduce::map_reduce(["../src/test/run-pass/hashmap-memory.rs"]); } diff --git a/src/test/run-pass/hello.rs b/src/test/run-pass/hello.rs index 5e442db7fbe..fa917bd4902 100644 --- a/src/test/run-pass/hello.rs +++ b/src/test/run-pass/hello.rs @@ -2,4 +2,4 @@ // -*- rust -*- -fn main() { log "hello, world."; } \ No newline at end of file +fn main() { log "hello, world."; } diff --git a/src/test/run-pass/i32-sub.rs b/src/test/run-pass/i32-sub.rs index a83e95a73b8..5dd3ce8de2c 100644 --- a/src/test/run-pass/i32-sub.rs +++ b/src/test/run-pass/i32-sub.rs @@ -2,4 +2,4 @@ // -*- rust -*- -fn main() { let x: i32 = -400_i32; x = 0_i32 - x; assert (x == 400_i32); } \ No newline at end of file +fn main() { let x: i32 = -400_i32; x = 0_i32 - x; assert (x == 400_i32); } diff --git a/src/test/run-pass/i8-incr.rs b/src/test/run-pass/i8-incr.rs index f825d54bba1..4a51fd58517 100644 --- a/src/test/run-pass/i8-incr.rs +++ b/src/test/run-pass/i8-incr.rs @@ -8,4 +8,4 @@ fn main() { x = x + 1i8; x = x - 1i8; assert (x == y); -} \ No newline at end of file +} diff --git a/src/test/run-pass/if-bot.rs b/src/test/run-pass/if-bot.rs index 8ef6bab684e..35452a2ba6d 100644 --- a/src/test/run-pass/if-bot.rs +++ b/src/test/run-pass/if-bot.rs @@ -1,3 +1,3 @@ -fn main() { let i: int = if false { fail } else { 5 }; log i; } \ No newline at end of file +fn main() { let i: int = if false { fail } else { 5 }; log i; } diff --git a/src/test/run-pass/if-check-precond.rs b/src/test/run-pass/if-check-precond.rs index 88c744642d0..eadffd7b75a 100644 --- a/src/test/run-pass/if-check-precond.rs +++ b/src/test/run-pass/if-check-precond.rs @@ -1,11 +1,11 @@ pred even(x: uint) -> bool { if x < 2u { ret false; - } else if (x == 2u) { ret true; } else { ret even(x - 2u); } + } else if x == 2u { ret true; } else { ret even(x - 2u); } } fn print_even(x: uint) : even(x) { log x; } fn foo(x: uint) { if check even(x) { print_even(x); } else { fail; } } -fn main() { foo(2u); } \ No newline at end of file +fn main() { foo(2u); } diff --git a/src/test/run-pass/if-check.rs b/src/test/run-pass/if-check.rs index 220b784e12e..090330bef0e 100644 --- a/src/test/run-pass/if-check.rs +++ b/src/test/run-pass/if-check.rs @@ -1,9 +1,9 @@ pred even(x: uint) -> bool { if x < 2u { ret false; - } else if (x == 2u) { ret true; } else { ret even(x - 2u); } + } else if x == 2u { ret true; } else { ret even(x - 2u); } } fn foo(x: uint) { if check even(x) { log x; } else { fail; } } -fn main() { foo(2u); } \ No newline at end of file +fn main() { foo(2u); } diff --git a/src/test/run-pass/if-ret.rs b/src/test/run-pass/if-ret.rs index 3dc897683fc..87cd9647243 100644 --- a/src/test/run-pass/if-ret.rs +++ b/src/test/run-pass/if-ret.rs @@ -1,3 +1,3 @@ fn foo() { if (ret) { } } -fn main() { foo(); } \ No newline at end of file +fn main() { foo(); } diff --git a/src/test/run-pass/import-from-native.rs b/src/test/run-pass/import-from-native.rs index 03c49b2adfe..b8837692c07 100644 --- a/src/test/run-pass/import-from-native.rs +++ b/src/test/run-pass/import-from-native.rs @@ -1,6 +1,6 @@ mod spam { - fn ham() {} - fn eggs() {} + fn ham() { } + fn eggs() { } } native "rust" mod rustrt { @@ -9,7 +9,4 @@ native "rust" mod rustrt { export eggs; } -fn main() { - rustrt::ham(); - rustrt::eggs(); -} \ No newline at end of file +fn main() { rustrt::ham(); rustrt::eggs(); } diff --git a/src/test/run-pass/import-from.rs b/src/test/run-pass/import-from.rs index b42793d16df..d8314e6b0b8 100644 --- a/src/test/run-pass/import-from.rs +++ b/src/test/run-pass/import-from.rs @@ -1,11 +1,8 @@ import spam::{ham, eggs}; mod spam { - fn ham() {} - fn eggs() {} + fn ham() { } + fn eggs() { } } -fn main() { - ham(); - eggs(); -} \ No newline at end of file +fn main() { ham(); eggs(); } diff --git a/src/test/run-pass/import-glob-0.rs b/src/test/run-pass/import-glob-0.rs index e5e9ab90d0d..51144e492ce 100644 --- a/src/test/run-pass/import-glob-0.rs +++ b/src/test/run-pass/import-glob-0.rs @@ -27,4 +27,4 @@ mod dug { } -fn main() { f1(); f2(); f4(); nameless_fear(); also_redstone(); } \ No newline at end of file +fn main() { f1(); f2(); f4(); nameless_fear(); also_redstone(); } diff --git a/src/test/run-pass/import-glob-1.rs b/src/test/run-pass/import-glob-1.rs index 64c5a47ec17..d9c1b653217 100644 --- a/src/test/run-pass/import-glob-1.rs +++ b/src/test/run-pass/import-glob-1.rs @@ -1,40 +1,40 @@ import a1::b1::word_traveler; mod a1 { - // + // mod b1 { - // + // import a2::b1::*; - // <-\ + // <-\ export word_traveler; // | } - // | + // | mod b2 { - // | + // | import a2::b2::*; - // <-\ -\ | + // <-\ -\ | export word_traveler; // | | | } // | | | } - // | | | - // | | | - mod a2 { - // | | | - native "cdecl" mod b1 = "" { - // | | | - import a1::b2::*; - // | <-/ -/ - export word_traveler; // | - } - // | - mod b2 { - // | - fn word_traveler() { // | - log "ahoy!"; // -/ - } // - } // - } - // +// | | | +// | | | +mod a2 { + // | | | + native "cdecl" mod b1 = "" { + // | | | + import a1::b2::*; + // | <-/ -/ + export word_traveler; // | + } + // | + mod b2 { + // | + fn word_traveler() { // | + log "ahoy!"; // -/ + } // + } // +} +// -fn main() { word_traveler(); } \ No newline at end of file +fn main() { word_traveler(); } diff --git a/src/test/run-pass/import-glob-circular.rs b/src/test/run-pass/import-glob-circular.rs index bc97c7925eb..4035790b934 100644 --- a/src/test/run-pass/import-glob-circular.rs +++ b/src/test/run-pass/import-glob-circular.rs @@ -47,4 +47,4 @@ mod test2 { -fn main() { test1(); test2(); } \ No newline at end of file +fn main() { test1(); test2(); } diff --git a/src/test/run-pass/import-glob-crate.rs b/src/test/run-pass/import-glob-crate.rs index c32973fa377..fca6c1d61bd 100644 --- a/src/test/run-pass/import-glob-crate.rs +++ b/src/test/run-pass/import-glob-crate.rs @@ -4,6 +4,6 @@ import std::vec::*; fn main() { let v = init_elt(0, 0u); - v += ~[4, 2]; - assert (reversed(v) == ~[2, 4]); + v += [4, 2]; + assert (reversed(v) == [2, 4]); } diff --git a/src/test/run-pass/import.rs b/src/test/run-pass/import.rs index 31622c1fee8..ffd84fda952 100644 --- a/src/test/run-pass/import.rs +++ b/src/test/run-pass/import.rs @@ -8,4 +8,4 @@ mod bar { fn thing() { x(10); z(10); } } -fn main() { bar::thing(); } \ No newline at end of file +fn main() { bar::thing(); } diff --git a/src/test/run-pass/import2.rs b/src/test/run-pass/import2.rs index f8810e1bf4a..5b287cd7ddd 100644 --- a/src/test/run-pass/import2.rs +++ b/src/test/run-pass/import2.rs @@ -5,4 +5,4 @@ mod zed { fn bar() { log "bar"; } } -fn main() { bar(); } \ No newline at end of file +fn main() { bar(); } diff --git a/src/test/run-pass/import3.rs b/src/test/run-pass/import3.rs index 687074d55be..bd38defe405 100644 --- a/src/test/run-pass/import3.rs +++ b/src/test/run-pass/import3.rs @@ -8,4 +8,4 @@ mod baz { } } -fn main() { bar(); } \ No newline at end of file +fn main() { bar(); } diff --git a/src/test/run-pass/import6.rs b/src/test/run-pass/import6.rs index bc57537580f..33898c35a35 100644 --- a/src/test/run-pass/import6.rs +++ b/src/test/run-pass/import6.rs @@ -9,4 +9,4 @@ mod bar { import zed::baz; export baz; } -fn main() { baz(); } \ No newline at end of file +fn main() { baz(); } diff --git a/src/test/run-pass/import8.rs b/src/test/run-pass/import8.rs index ed559347824..884dcebacdf 100644 --- a/src/test/run-pass/import8.rs +++ b/src/test/run-pass/import8.rs @@ -6,4 +6,4 @@ mod foo { fn x(y: int) { log y; } } -fn main() { x(10); z(10); } \ No newline at end of file +fn main() { x(10); z(10); } diff --git a/src/test/run-pass/infer-fn-tail-expr.rs b/src/test/run-pass/infer-fn-tail-expr.rs index 9134f3a78de..4658ea4329c 100644 --- a/src/test/run-pass/infer-fn-tail-expr.rs +++ b/src/test/run-pass/infer-fn-tail-expr.rs @@ -1,5 +1,5 @@ // issue #680 -fn f() -> [int] { ~[] } +fn f() -> [int] { [] } fn main() { } diff --git a/src/test/run-pass/inner-module.rs b/src/test/run-pass/inner-module.rs index f9ef1b040de..6fcc0a79af0 100644 --- a/src/test/run-pass/inner-module.rs +++ b/src/test/run-pass/inner-module.rs @@ -9,4 +9,4 @@ mod inner { fn hello() { inner2::hello(); } } -fn main() { inner::hello(); inner::inner2::hello(); } \ No newline at end of file +fn main() { inner::hello(); inner::inner2::hello(); } diff --git a/src/test/run-pass/int.rs b/src/test/run-pass/int.rs index 2d2422d9f87..2c91b5920b7 100644 --- a/src/test/run-pass/int.rs +++ b/src/test/run-pass/int.rs @@ -2,4 +2,4 @@ // -*- rust -*- -fn main() { let x: int = 10; } \ No newline at end of file +fn main() { let x: int = 10; } diff --git a/src/test/run-pass/integral-indexing.rs b/src/test/run-pass/integral-indexing.rs index d03963df2ed..ed17e36bcb2 100644 --- a/src/test/run-pass/integral-indexing.rs +++ b/src/test/run-pass/integral-indexing.rs @@ -3,7 +3,7 @@ // This is a testcase for issue #94. fn main() { - let v: [int] = ~[0, 1, 2, 3, 4, 5]; + let v: [int] = [0, 1, 2, 3, 4, 5]; let s: str = "abcdef"; assert (v[3u] == 3); assert (v[3u8] == 3); diff --git a/src/test/run-pass/interior-vec.rs b/src/test/run-pass/interior-vec.rs index 15186078343..4c722b3cc64 100644 --- a/src/test/run-pass/interior-vec.rs +++ b/src/test/run-pass/interior-vec.rs @@ -5,25 +5,24 @@ native "rust-intrinsic" mod rusti { } fn main() { - let v: [int] = ~[]; + let v: [int] = []; assert (ivec_len(v) == 0u); // zero-length - let x = ~[1, 2]; + let x = [1, 2]; assert (ivec_len(x) == 2u); // on stack - let y = ~[1, 2, 3, 4, 5]; + let y = [1, 2, 3, 4, 5]; assert (ivec_len(y) == 5u); // on heap - v += ~[]; + v += []; assert (ivec_len(v) == 0u); // zero-length append - x += ~[3]; + x += [3]; assert (ivec_len(x) == 3u); // on-stack append - y += ~[6, 7, 8, 9]; + y += [6, 7, 8, 9]; assert (ivec_len(y) == 9u); // on-heap append let vv = v + v; assert (ivec_len(vv) == 0u); // zero-length add - let xx = x + ~[4]; + let xx = x + [4]; assert (ivec_len(xx) == 4u); // on-stack add - let yy = y + ~[10, 11]; + let yy = y + [10, 11]; assert (ivec_len(yy) == 11u); // on-heap add } - diff --git a/src/test/run-pass/issue-506.rs b/src/test/run-pass/issue-506.rs index 3487c1a7f37..1fb76cfd62b 100644 --- a/src/test/run-pass/issue-506.rs +++ b/src/test/run-pass/issue-506.rs @@ -9,11 +9,6 @@ native "rust" mod rustrt { fn task_yield(); } -fn yield_wrap() { - rustrt::task_yield(); -} +fn yield_wrap() { rustrt::task_yield(); } -fn main() { - let f = yield_wrap; - task::_spawn(f); -} +fn main() { let f = yield_wrap; task::_spawn(f); } diff --git a/src/test/run-pass/issue-687.rs b/src/test/run-pass/issue-687.rs index 8b9fef446da..2b6c2d9938b 100644 --- a/src/test/run-pass/issue-687.rs +++ b/src/test/run-pass/issue-687.rs @@ -10,8 +10,8 @@ import std::comm::send; tag msg { closed; received([u8]); } fn producer(c: _chan<[u8]>) { - send(c, ~[1u8, 2u8, 3u8, 4u8]); - let empty: [u8] = ~[]; + send(c, [1u8, 2u8, 3u8, 4u8]); + let empty: [u8] = []; send(c, empty); } @@ -22,10 +22,7 @@ fn packager(cb: _chan<_chan<[u8]>>, msg: _chan<msg>) { log "waiting for bytes"; let data = p.recv(); log "got bytes"; - if vec::len(data) == 0u { - log "got empty bytes, quitting"; - break; - } + if vec::len(data) == 0u { log "got empty bytes, quitting"; break; } log "sending non-empty buffer of length"; log vec::len(data); send(msg, received(data)); @@ -39,8 +36,8 @@ fn packager(cb: _chan<_chan<[u8]>>, msg: _chan<msg>) { fn main() { let p: _port<msg> = mk_port(); let recv_reader: _port<_chan<[u8]>> = mk_port(); - let pack = task::_spawn(bind packager(recv_reader.mk_chan(), - p.mk_chan())); + let pack = + task::_spawn(bind packager(recv_reader.mk_chan(), p.mk_chan())); let source_chan: _chan<[u8]> = recv_reader.recv(); let prod = task::_spawn(bind producer(source_chan)); diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 8d34414cc07..352fa4ac53e 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -167,7 +167,7 @@ mod test_distinguish_syntax_ext { use std; fn f() { - #fmt("test%s", "s"); + #fmt["test%s", "s"]; #[attr = "val"] fn g() { } } diff --git a/src/test/run-pass/item-name-overload.rs b/src/test/run-pass/item-name-overload.rs index 489fe8c39a3..02930d65cfa 100644 --- a/src/test/run-pass/item-name-overload.rs +++ b/src/test/run-pass/item-name-overload.rs @@ -10,4 +10,4 @@ mod bar { fn baz() { } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/ivec-add.rs b/src/test/run-pass/ivec-add.rs index 8dd2c32f86b..17b0a77d6ad 100644 --- a/src/test/run-pass/ivec-add.rs +++ b/src/test/run-pass/ivec-add.rs @@ -1,14 +1,14 @@ -fn double<T>(a: &T) -> [T] { ret ~[a] + ~[a]; } +fn double<T>(a: &T) -> [T] { ret [a] + [a]; } -fn double_int(a: int) -> [int] { ret ~[a] + ~[a]; } +fn double_int(a: int) -> [int] { ret [a] + [a]; } fn main() { let d = double(1); - assert (d.(0) == 1); - assert (d.(1) == 1); + assert (d[0] == 1); + assert (d[1] == 1); d = double_int(1); - assert (d.(0) == 1); - assert (d.(1) == 1); + assert (d[0] == 1); + assert (d[1] == 1); } diff --git a/src/test/run-pass/ivec-pass-by-value.rs b/src/test/run-pass/ivec-pass-by-value.rs index 213e1384658..557c3dc9b3e 100644 --- a/src/test/run-pass/ivec-pass-by-value.rs +++ b/src/test/run-pass/ivec-pass-by-value.rs @@ -1,3 +1,3 @@ fn f(a: [int]) { } -fn main() { f(~[1, 2, 3, 4, 5]); } +fn main() { f([1, 2, 3, 4, 5]); } diff --git a/src/test/run-pass/ivec-tag.rs b/src/test/run-pass/ivec-tag.rs index 41cc89aed7e..5efe202b66e 100644 --- a/src/test/run-pass/ivec-tag.rs +++ b/src/test/run-pass/ivec-tag.rs @@ -8,8 +8,9 @@ import std::comm::mk_port; import std::comm::send; fn producer(c: _chan<[u8]>) { - send(c, ~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, - 8u8, 9u8, 10u8, 11u8, 12u8, 13u8 ]); + send(c, + [1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8, + 13u8]); } fn main() { diff --git a/src/test/run-pass/join.rs b/src/test/run-pass/join.rs index 5545aadb1fb..91fba0bad40 100644 --- a/src/test/run-pass/join.rs +++ b/src/test/run-pass/join.rs @@ -13,4 +13,4 @@ fn main() { log_err "3"; } -fn child() { log_err "2"; } \ No newline at end of file +fn child() { log_err "2"; } diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs index 921b5568b0b..7bfba99baac 100644 --- a/src/test/run-pass/lambda-infer-unresolved.rs +++ b/src/test/run-pass/lambda-infer-unresolved.rs @@ -1,7 +1,7 @@ // This should typecheck even though the type of e is not fully // resolved when we finish typechecking the lambda. fn main() { - let e = @{mutable refs: ~[], n: 0}; - let f = lambda() { log_err e.n; }; - e.refs += ~[1]; + let e = @{mutable refs: [], n: 0}; + let f = lambda () { log_err e.n; }; + e.refs += [1]; } diff --git a/src/test/run-pass/lambda-no-leak.rs b/src/test/run-pass/lambda-no-leak.rs index 183c1ae1446..0643de4bcfb 100644 --- a/src/test/run-pass/lambda-no-leak.rs +++ b/src/test/run-pass/lambda-no-leak.rs @@ -2,6 +2,6 @@ fn force(f: &fn()) { f() } fn main() { let x = 7; - lambda() { log_err x; }; - force(lambda() { log_err x; }); + lambda () { log_err x; } + force(lambda () { log_err x; }); } diff --git a/src/test/run-pass/large-records.rs b/src/test/run-pass/large-records.rs index 004e3a8c225..8c5afc031d1 100644 --- a/src/test/run-pass/large-records.rs +++ b/src/test/run-pass/large-records.rs @@ -30,4 +30,4 @@ fn f() { l: 0}; } -fn main() { f(); } \ No newline at end of file +fn main() { f(); } diff --git a/src/test/run-pass/lazy-and-or.rs b/src/test/run-pass/lazy-and-or.rs index 348ce5de599..26edb631273 100644 --- a/src/test/run-pass/lazy-and-or.rs +++ b/src/test/run-pass/lazy-and-or.rs @@ -9,4 +9,4 @@ fn main() { log x || incr(y); assert (y == 10); if true && x { assert (true); } else { assert (false); } -} \ No newline at end of file +} diff --git a/src/test/run-pass/lazy-init.rs b/src/test/run-pass/lazy-init.rs index d36ad1b387f..b5f53400229 100644 --- a/src/test/run-pass/lazy-init.rs +++ b/src/test/run-pass/lazy-init.rs @@ -2,4 +2,4 @@ fn foo(x: int) { log x; } -fn main() { let x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); } \ No newline at end of file +fn main() { let x: int; if 1 > 2 { x = 12; } else { x = 10; } foo(x); } diff --git a/src/test/run-pass/leak-tag-copy.rs b/src/test/run-pass/leak-tag-copy.rs index 48b11174da5..7c5eb538bc2 100644 --- a/src/test/run-pass/leak-tag-copy.rs +++ b/src/test/run-pass/leak-tag-copy.rs @@ -2,4 +2,4 @@ tag t { a; b(@int); } -fn main() { let x = b(@10); x = a; } \ No newline at end of file +fn main() { let x = b(@10); x = a; } diff --git a/src/test/run-pass/let-destruct-fresh-mem.rs b/src/test/run-pass/let-destruct-fresh-mem.rs index fa2798ecc66..9a41ef7f084 100644 --- a/src/test/run-pass/let-destruct-fresh-mem.rs +++ b/src/test/run-pass/let-destruct-fresh-mem.rs @@ -1,10 +1,10 @@ fn main() { let u = {x: 10, y: @{a: 20}}; - let {x, y: @{a}} = u; + let {x: x, y: @{a: a}} = u; x = 100; a = 100; - assert x == 100; - assert a == 100; - assert u.x == 10; - assert u.y.a == 20; + assert (x == 100); + assert (a == 100); + assert (u.x == 10); + assert (u.y.a == 20); } diff --git a/src/test/run-pass/let-destruct.rs b/src/test/run-pass/let-destruct.rs index 7d59645ff04..bdc7c6a798c 100644 --- a/src/test/run-pass/let-destruct.rs +++ b/src/test/run-pass/let-destruct.rs @@ -1,8 +1,6 @@ -tag xx { - xx(int); -} +tag xx = int; fn main() { - let @{x:xx(x), y} = @{x: xx(10), y: 20}; - assert x + y == 30; + let @{x: xx(x), y: y} = @{x: xx(10), y: 20}; + assert (x + y == 30); } diff --git a/src/test/run-pass/linear-for-loop.rs b/src/test/run-pass/linear-for-loop.rs index a36848106f6..319ce032d8d 100644 --- a/src/test/run-pass/linear-for-loop.rs +++ b/src/test/run-pass/linear-for-loop.rs @@ -1,7 +1,7 @@ fn main() { - let x = ~[1, 2, 3]; + let x = [1, 2, 3]; let y = 0; for i: int in x { log i; y += i; } log y; diff --git a/src/test/run-pass/list.rs b/src/test/run-pass/list.rs index e81c0d12fd2..272ec4b3b6f 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -4,4 +4,4 @@ // -*- rust -*- tag list { cons(int, @list); nil; } -fn main() { cons(10, @cons(11, @cons(12, @nil))); } \ No newline at end of file +fn main() { cons(10, @cons(11, @cons(12, @nil))); } diff --git a/src/test/run-pass/log-err-phi.rs b/src/test/run-pass/log-err-phi.rs index 0623daed212..0317f90573b 100644 --- a/src/test/run-pass/log-err-phi.rs +++ b/src/test/run-pass/log-err-phi.rs @@ -1,3 +1,3 @@ -fn main() { if false { log_err "foo" + "bar"; } } \ No newline at end of file +fn main() { if false { log_err "foo" + "bar"; } } diff --git a/src/test/run-pass/long-while.rs b/src/test/run-pass/long-while.rs index 59cbd10d64a..4e68287b18f 100644 --- a/src/test/run-pass/long-while.rs +++ b/src/test/run-pass/long-while.rs @@ -1,3 +1,3 @@ -fn main() { let i: int = 0; while i < 1000000 { i += 1; let x = 3; } } \ No newline at end of file +fn main() { let i: int = 0; while i < 1000000 { i += 1; let x = 3; } } diff --git a/src/test/run-pass/loop-scope.rs b/src/test/run-pass/loop-scope.rs index fc5618d823d..85d39ee0bbc 100644 --- a/src/test/run-pass/loop-scope.rs +++ b/src/test/run-pass/loop-scope.rs @@ -1,5 +1,5 @@ fn main() { - let x = ~[10, 20, 30]; + let x = [10, 20, 30]; let sum = 0; for x in x { sum += x; } assert (sum == 60); diff --git a/src/test/run-pass/macro-2.rs b/src/test/run-pass/macro-2.rs index 4aae975a5e9..497742e9e4f 100644 --- a/src/test/run-pass/macro-2.rs +++ b/src/test/run-pass/macro-2.rs @@ -1,5 +1,9 @@ fn main() { - #macro([#mylambda[x,body], {fn f(x: int) -> int { ret body }; f}]); + #macro[[#mylambda[x, body], + { + fn f(x: int) -> int { ret body } + f + }]]; - assert(#mylambda[y,y*2](8) == 16); -} \ No newline at end of file + assert (#mylambda[y, y * 2](8) == 16); +} diff --git a/src/test/run-pass/macro-3.rs b/src/test/run-pass/macro-3.rs index f143c4f058f..3e8de676073 100644 --- a/src/test/run-pass/macro-3.rs +++ b/src/test/run-pass/macro-3.rs @@ -1,5 +1,5 @@ fn main() { - #macro([#trivial[], 1*2*4*2*1]); + #macro[[#trivial[], 1 * 2 * 4 * 2 * 1]]; - assert(#trivial[] == 16); + assert (#trivial[] == 16); } diff --git a/src/test/run-pass/macro-by-example-1.rs b/src/test/run-pass/macro-by-example-1.rs index 08e5c4e249f..520adef92eb 100644 --- a/src/test/run-pass/macro-by-example-1.rs +++ b/src/test/run-pass/macro-by-example-1.rs @@ -1,7 +1,7 @@ fn main() { - #macro([#apply[f, [x, ...]], f(x, ...)]); + #macro[[#apply[f, [x, ...]], f(x, ...)]]; fn add(a: int, b: int) -> int { ret a + b; } assert (#apply[add, [1, 15]] == 16); -} \ No newline at end of file +} diff --git a/src/test/run-pass/macro-by-example-2.rs b/src/test/run-pass/macro-by-example-2.rs index 58da59e2a7c..e1a7b97e888 100644 --- a/src/test/run-pass/macro-by-example-2.rs +++ b/src/test/run-pass/macro-by-example-2.rs @@ -1,6 +1,6 @@ fn main() { - #macro([#zip_or_unzip[[x, ...], [y, ...]], [[x, y], ...]], - [#zip_or_unzip[[xx, yy], ...], [[xx, ...], [yy, ...]]]); + #macro[[#zip_or_unzip[[x, ...], [y, ...]], [[x, y], ...]], + [#zip_or_unzip[[xx, yy], ...], [[xx, ...], [yy, ...]]]]; assert (#zip_or_unzip[[1, 2, 3, 4], [5, 6, 7, 8]] == @@ -9,41 +9,38 @@ fn main() { [[1, 2, 3, 4], [5, 6, 7, 8]]); - #macro([#nested[[[x, ...], ...], [[y, ...], ...]], - [[[x, y], ...], ...]]); + #macro[[#nested[[[x, ...], ...], [[y, ...], ...]], [[[x, y], ...], ...]]]; assert (#nested[[[1, 2, 3, 4, 5], [7, 8, 9, 10, 11, 12]], [[-1, -2, -3, -4, -5], [-7, -8, -9, -10, -11, -12]]] == [[[1, -1], [2, -2], [3, -3], [4, -4], [5, -5]], [[7, -7], [8, -8], [9, -9], [10, -10], [11, -11], [12, -12]]]); - #macro([#dup[y, [x, ...]], [[y, x], ...]]); + #macro[[#dup[y, [x, ...]], [[y, x], ...]]]; assert (#dup[1, [1, 2, 3, 4]] == [[1, 1], [1, 2], [1, 3], [1, 4]]); - #macro([#lambda[x, #<t>, body, #<s>], + #macro[[#lambda[x, #<t>, body, #<s>], { fn result(x: t) -> s { ret body } result - }]); + }]]; - assert ((#lambda[i, #<uint>, i + 4u, #<uint>])(12u) == 16u); + assert (#lambda[i, #<uint>, i + 4u, #<uint>](12u) == 16u); - #macro[[#sum[x, xs, ...], x + #sum[xs, ...]], - [#sum[], 0]]; + #macro[[#sum[x, xs, ...], x + #sum[xs, ...]], [#sum[], 0]]; - assert (#sum[1,2,3,4] == 10); + assert (#sum[1, 2, 3, 4] == 10); #macro[[#transcr_mixed[a, as, ...], #sum[6, as, ...] * a]]; assert (#transcr_mixed[10, 5, 4, 3, 2, 1] == 210); - #macro[[#surround[pre, [xs, ...], post], - [pre, xs, ..., post]]]; + #macro[[#surround[pre, [xs, ...], post], [pre, xs, ..., post]]]; - assert (#surround[1, [2,3,4], 5] == [1,2,3,4,5]); + assert (#surround[1, [2, 3, 4], 5] == [1, 2, 3, 4, 5]); -} \ No newline at end of file +} diff --git a/src/test/run-pass/macro.rs b/src/test/run-pass/macro.rs index 1b561e3c487..66f2ccc6a89 100644 --- a/src/test/run-pass/macro.rs +++ b/src/test/run-pass/macro.rs @@ -1,4 +1 @@ -fn main() { - #macro[[#m1[a], a*4]]; - assert (#m1[2] == 8); -} +fn main() { #macro[[#m1[a], a * 4]]; assert (#m1[2] == 8); } diff --git a/src/test/run-pass/main-ivec.rs b/src/test/run-pass/main-ivec.rs index e3d1403411b..ec2403a9151 100644 --- a/src/test/run-pass/main-ivec.rs +++ b/src/test/run-pass/main-ivec.rs @@ -1,3 +1 @@ -fn main(args: [str]) { - for s in args { log s } -} \ No newline at end of file +fn main(args: [str]) { for s in args { log s } } diff --git a/src/test/run-pass/many.rs b/src/test/run-pass/many.rs index 3413c6a3147..76cbc9fa19a 100644 --- a/src/test/run-pass/many.rs +++ b/src/test/run-pass/many.rs @@ -5,21 +5,21 @@ import std::task; import std::comm; fn sub(parent: comm::_chan<int>, id: int) { - if (id == 0) { - comm::send(parent, 0); - } else { - let p = comm::mk_port(); - let child = task::_spawn(bind sub(p.mk_chan(), id-1)); - let y = p.recv(); - comm::send(parent, y + 1); - } + if id == 0 { + comm::send(parent, 0); + } else { + let p = comm::mk_port(); + let child = task::_spawn(bind sub(p.mk_chan(), id - 1)); + let y = p.recv(); + comm::send(parent, y + 1); + } } fn main() { - let p = comm::mk_port(); - let child = task::_spawn(bind sub(p.mk_chan(), 200)); - let y = p.recv(); - log "transmission complete"; - log y; - assert (y == 200); + let p = comm::mk_port(); + let child = task::_spawn(bind sub(p.mk_chan(), 200)); + let y = p.recv(); + log "transmission complete"; + log y; + assert (y == 200); } diff --git a/src/test/run-pass/maybe-mutable.rs b/src/test/run-pass/maybe-mutable.rs index 5c941e7c477..f8436fe0717 100644 --- a/src/test/run-pass/maybe-mutable.rs +++ b/src/test/run-pass/maybe-mutable.rs @@ -9,8 +9,8 @@ fn len(v: [mutable? int]) -> uint { } fn main() { - let v0 = ~[1, 2, 3, 4, 5]; + let v0 = [1, 2, 3, 4, 5]; log len(v0); - let v1 = ~[mutable 1, 2, 3, 4, 5]; + let v1 = [mutable 1, 2, 3, 4, 5]; log len(v1); } diff --git a/src/test/run-pass/mlist.rs b/src/test/run-pass/mlist.rs index c6b8de4e400..5b5a2c3fdf0 100644 --- a/src/test/run-pass/mlist.rs +++ b/src/test/run-pass/mlist.rs @@ -1,4 +1,4 @@ // -*- rust -*- tag mlist { cons(int, @mlist); nil; } -fn main() { cons(10, @cons(11, @cons(12, @nil))); } \ No newline at end of file +fn main() { cons(10, @cons(11, @cons(12, @nil))); } diff --git a/src/test/run-pass/move-1.rs b/src/test/run-pass/move-1.rs index d0dcc0b743f..9124bd3e0a9 100644 --- a/src/test/run-pass/move-1.rs +++ b/src/test/run-pass/move-1.rs @@ -11,4 +11,4 @@ fn main() { assert (test(true, x) == 2); assert (test(true, x) == 2); assert (test(false, x) == 5); -} \ No newline at end of file +} diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index 0f36f5f2865..9309d718b15 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -1,3 +1,3 @@ -fn main() { let x = @{x: 1, y: 2, z: 3}; let y <- x; assert (y.y == 2); } \ No newline at end of file +fn main() { let x = @{x: 1, y: 2, z: 3}; let y <- x; assert (y.y == 2); } diff --git a/src/test/run-pass/move-4.rs b/src/test/run-pass/move-4.rs index 6fc6c6b65f5..5a104555375 100644 --- a/src/test/run-pass/move-4.rs +++ b/src/test/run-pass/move-4.rs @@ -9,4 +9,4 @@ fn test(foo: @{a: int, b: int, c: int}) -> @{a: int, b: int, c: int} { ret quux; } -fn main() { let x = @{a: 1, b: 2, c: 3}; let y = test(x); assert (y.c == 3); } \ No newline at end of file +fn main() { let x = @{a: 1, b: 2, c: 3}; let y = test(x); assert (y.c == 3); } diff --git a/src/test/run-pass/move-arg-2.rs b/src/test/run-pass/move-arg-2.rs index 07f40e403ff..9978478f177 100644 --- a/src/test/run-pass/move-arg-2.rs +++ b/src/test/run-pass/move-arg-2.rs @@ -1,12 +1,10 @@ -fn test(foo: -@[int]) { - assert (foo.(0) == 10); -} +fn test(foo: -@[int]) { assert (foo[0] == 10); } fn main() { - let x = @~[10]; + let x = @[10]; // Test forgetting a local by move-in test(x); // Test forgetting a temporary by move-in. - test(@~[10]); + test(@[10]); } diff --git a/src/test/run-pass/move-arg.rs b/src/test/run-pass/move-arg.rs index 131f69558ea..115d89e2bcd 100644 --- a/src/test/run-pass/move-arg.rs +++ b/src/test/run-pass/move-arg.rs @@ -1,8 +1,3 @@ -fn test(foo: -int) { - assert (foo == 10); -} +fn test(foo: -int) { assert (foo == 10); } -fn main() { - let x = 10; - test(x); -} \ No newline at end of file +fn main() { let x = 10; test(x); } diff --git a/src/test/run-pass/move-scalar.rs b/src/test/run-pass/move-scalar.rs index 2a2c805944e..0594ee91fe1 100644 --- a/src/test/run-pass/move-scalar.rs +++ b/src/test/run-pass/move-scalar.rs @@ -4,4 +4,4 @@ fn main() { let x: int; x <- y; assert (x == 42); -} \ No newline at end of file +} diff --git a/src/test/run-pass/multi-let.rs b/src/test/run-pass/multi-let.rs index fbc8db94bd0..ab9e6578fc6 100644 --- a/src/test/run-pass/multi-let.rs +++ b/src/test/run-pass/multi-let.rs @@ -1,4 +1 @@ -fn main() { - let x = 10, y = x; - assert (y == 10); -} \ No newline at end of file +fn main() { let x = 10, y = x; assert (y == 10); } diff --git a/src/test/run-pass/multi-src/bar.rs b/src/test/run-pass/multi-src/bar.rs index 7b52a9e089a..949a34bb1c2 100644 --- a/src/test/run-pass/multi-src/bar.rs +++ b/src/test/run-pass/multi-src/bar.rs @@ -1,3 +1,3 @@ -fn other() { log "yes"; } \ No newline at end of file +fn other() { log "yes"; } diff --git a/src/test/run-pass/multi-src/foo.rs b/src/test/run-pass/multi-src/foo.rs index 63305812ef6..2c38317bf1d 100644 --- a/src/test/run-pass/multi-src/foo.rs +++ b/src/test/run-pass/multi-src/foo.rs @@ -1,3 +1,3 @@ -fn main() { log "hello, multi-file world."; bar::other(); } \ No newline at end of file +fn main() { log "hello, multi-file world."; bar::other(); } diff --git a/src/test/run-pass/multiline-comment.rs b/src/test/run-pass/multiline-comment.rs index 90eaa93fda0..85e80ab201b 100644 --- a/src/test/run-pass/multiline-comment.rs +++ b/src/test/run-pass/multiline-comment.rs @@ -6,4 +6,4 @@ /* * This is a /* depth-balanced */ multi-line comment. */ -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/mutable-alias-vec.rs b/src/test/run-pass/mutable-alias-vec.rs index b620c2236dc..a185dfd0027 100644 --- a/src/test/run-pass/mutable-alias-vec.rs +++ b/src/test/run-pass/mutable-alias-vec.rs @@ -3,10 +3,10 @@ // -*- rust -*- use std; -fn grow(v: &mutable [int]) { v += ~[1]; } +fn grow(v: &mutable [int]) { v += [1]; } fn main() { - let v: [int] = ~[]; + let v: [int] = []; grow(v); grow(v); grow(v); diff --git a/src/test/run-pass/mutable-vec-drop.rs b/src/test/run-pass/mutable-vec-drop.rs index 58dc936083a..625bcb17f97 100644 --- a/src/test/run-pass/mutable-vec-drop.rs +++ b/src/test/run-pass/mutable-vec-drop.rs @@ -2,5 +2,5 @@ fn main() { // This just tests whether the vec leaks its members. let pvec: [mutable @{a: int, b: int}] = - ~[mutable @{a: 1, b: 2}, @{a: 3, b: 4}, @{a: 5, b: 6}]; + [mutable @{a: 1, b: 2}, @{a: 3, b: 4}, @{a: 5, b: 6}]; } diff --git a/src/test/run-pass/mutual-recursion-group.rs b/src/test/run-pass/mutual-recursion-group.rs index 732d3a27177..f21bbf1a435 100644 --- a/src/test/run-pass/mutual-recursion-group.rs +++ b/src/test/run-pass/mutual-recursion-group.rs @@ -10,4 +10,4 @@ tag list { cons(@tree, @list); nil; } tag small_list { kons(int, @small_list); neel; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/native-mod-src/inner.rs b/src/test/run-pass/native-mod-src/inner.rs index 0842fcb9f27..bee820cf3be 100644 --- a/src/test/run-pass/native-mod-src/inner.rs +++ b/src/test/run-pass/native-mod-src/inner.rs @@ -11,4 +11,4 @@ fn main() { libc.write(1, buf, 1024); libc.close(fd); libc.free(buf); -} \ No newline at end of file +} diff --git a/src/test/run-pass/native-opaque-type.rs b/src/test/run-pass/native-opaque-type.rs index fa4a5e25e5a..6ec8b4dba6a 100644 --- a/src/test/run-pass/native-opaque-type.rs +++ b/src/test/run-pass/native-opaque-type.rs @@ -4,4 +4,4 @@ native "cdecl" mod libc = "" { type file_handle; } -fn main() { assert (true); } \ No newline at end of file +fn main() { assert (true); } diff --git a/src/test/run-pass/native-src/native.rs b/src/test/run-pass/native-src/native.rs index eac66adb58a..164c55d0e9f 100644 --- a/src/test/run-pass/native-src/native.rs +++ b/src/test/run-pass/native-src/native.rs @@ -6,4 +6,4 @@ fn main() { libc.puts(rustrt.str_buf("hello, native world 1")); libc.puts(rustrt.str_buf("hello, native world 2")); libc.puts(rustrt.str_buf("hello, native world 3")); -} \ No newline at end of file +} diff --git a/src/test/run-pass/nested-obj-self.rs b/src/test/run-pass/nested-obj-self.rs index 3ed72d8d8ef..f664ef50ee2 100644 --- a/src/test/run-pass/nested-obj-self.rs +++ b/src/test/run-pass/nested-obj-self.rs @@ -25,4 +25,4 @@ fn main() { assert (s2 == "foo.m1"); let s3: str = a.m3(); assert (s3 == "bar.m1"); -} \ No newline at end of file +} diff --git a/src/test/run-pass/newtype-polymorphic.rs b/src/test/run-pass/newtype-polymorphic.rs index 637b1b8103b..fc3002ba662 100644 --- a/src/test/run-pass/newtype-polymorphic.rs +++ b/src/test/run-pass/newtype-polymorphic.rs @@ -2,11 +2,11 @@ tag myvec<X> = [X]; fn myvec_deref<X>(mv: &myvec<X>) -> [X] { ret *mv; } -fn myvec_elt<X>(mv: &myvec<X>) -> X { ret mv.(0); } +fn myvec_elt<X>(mv: &myvec<X>) -> X { ret mv[0]; } fn main() { - let mv = myvec(~[1, 2, 3]); - assert (myvec_deref(mv).(1) == 2); + let mv = myvec([1, 2, 3]); + assert (myvec_deref(mv)[1] == 2); assert (myvec_elt(mv) == 1); - assert (mv.(2) == 3); + assert (mv[2] == 3); } diff --git a/src/test/run-pass/newtype.rs b/src/test/run-pass/newtype.rs index b0e67f4121f..0b0a8c7b2d9 100644 --- a/src/test/run-pass/newtype.rs +++ b/src/test/run-pass/newtype.rs @@ -1,8 +1,8 @@ -tag mytype = {compute: fn(&mytype) -> int , val: int}; +tag mytype = {compute: fn(&mytype) -> int, val: int}; fn compute(i: &mytype) -> int { ret i.val + 20; } fn main() { let myval = mytype({compute: compute, val: 30}); assert (myval.compute(myval) == 50); -} \ No newline at end of file +} diff --git a/src/test/run-pass/nil-pattern.rs b/src/test/run-pass/nil-pattern.rs index af499adee57..927ff5be3e5 100644 --- a/src/test/run-pass/nil-pattern.rs +++ b/src/test/run-pass/nil-pattern.rs @@ -1 +1 @@ -fn main() { let x = (); alt x { () { } } } \ No newline at end of file +fn main() { let x = (); alt x { () { } } } diff --git a/src/test/run-pass/obj-docs.rs b/src/test/run-pass/obj-docs.rs index cdda794acff..de5a91e886b 100644 --- a/src/test/run-pass/obj-docs.rs +++ b/src/test/run-pass/obj-docs.rs @@ -9,55 +9,42 @@ fn main() { // Ref.Item.Obj obj counter(state: @mutable int) { - fn incr() { - *state += 1; - } - fn get() -> int { - ret *state; - } - } + fn incr() { *state += 1; } + fn get() -> int { ret *state; } + } let c: counter = counter(@mutable 1); c.incr(); c.incr(); - assert c.get() == 3; + assert (c.get() == 3); obj my_obj() { - fn get() -> int { - ret 3; - } - fn foo() -> int{ + fn get() -> int { ret 3; } + fn foo() -> int { let c = self.get(); ret c + 2; // returns 5 } } let o = my_obj(); - assert o.foo() == 5; + assert (o.foo() == 5); // Ref.Type.Obj - type taker = obj { - fn take(int); - }; + type taker = + obj { + fn take(int); + }; obj adder(x: @mutable int) { - fn take(y: int) { - *x += y; - } + fn take(y: int) { *x += y; } } obj sender(c: _chan<int>) { - fn take(z: int) { - send(c, z); - } + fn take(z: int) { send(c, z); } } - fn give_ints(t: taker) { - t.take(1); - t.take(2); - t.take(3); - } + fn give_ints(t: taker) { t.take(1); t.take(2); t.take(3); } let p = mk_port::<int>(); diff --git a/src/test/run-pass/obj-drop.rs b/src/test/run-pass/obj-drop.rs index b807fe3dcfc..a823784e1b0 100644 --- a/src/test/run-pass/obj-drop.rs +++ b/src/test/run-pass/obj-drop.rs @@ -5,4 +5,4 @@ fn main() { // This just tests whether the obj leaks its box state members. let ob = handle(@0xf00f00); -} \ No newline at end of file +} diff --git a/src/test/run-pass/obj-recursion.rs b/src/test/run-pass/obj-recursion.rs index 7110683d9d1..3c4346af32e 100644 --- a/src/test/run-pass/obj-recursion.rs +++ b/src/test/run-pass/obj-recursion.rs @@ -2,7 +2,7 @@ type adder = obj { - fn add() ; + fn add(); }; obj leaf_adder(x: int) { @@ -16,4 +16,4 @@ obj delegate_adder(a: adder) { fn main() { let x = delegate_adder(delegate_adder(delegate_adder(leaf_adder(10)))); x.add(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/obj-self-2.rs b/src/test/run-pass/obj-self-2.rs index 8b0dd4b1595..ca33b382792 100644 --- a/src/test/run-pass/obj-self-2.rs +++ b/src/test/run-pass/obj-self-2.rs @@ -9,4 +9,4 @@ fn main() { let i: int = 0; a.m1(i); a.m2(i); -} \ No newline at end of file +} diff --git a/src/test/run-pass/obj-self-3.rs b/src/test/run-pass/obj-self-3.rs index fcee2e1a087..29720216bd1 100644 --- a/src/test/run-pass/obj-self-3.rs +++ b/src/test/run-pass/obj-self-3.rs @@ -14,4 +14,4 @@ fn main() { assert (i == 2); i = a.m3(i); assert (i == 4); -} \ No newline at end of file +} diff --git a/src/test/run-pass/obj-self-4.rs b/src/test/run-pass/obj-self-4.rs index 8c52593faa9..e13a39f0998 100644 --- a/src/test/run-pass/obj-self-4.rs +++ b/src/test/run-pass/obj-self-4.rs @@ -19,4 +19,4 @@ fn main() { assert (rs == 8); rs = o.get(); assert (rs == 8); -} \ No newline at end of file +} diff --git a/src/test/run-pass/obj-self.rs b/src/test/run-pass/obj-self.rs index 6e293fc344a..c6a1b141558 100644 --- a/src/test/run-pass/obj-self.rs +++ b/src/test/run-pass/obj-self.rs @@ -8,4 +8,4 @@ fn main() { let a = foo(); a.m1(); a.m2(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/obj-with-vec.rs b/src/test/run-pass/obj-with-vec.rs index db4050aaf94..1ce8cbc46bf 100644 --- a/src/test/run-pass/obj-with-vec.rs +++ b/src/test/run-pass/obj-with-vec.rs @@ -2,9 +2,9 @@ fn main() { obj buf(data: [u8]) { - fn get(i: int) -> u8 { ret data.(i); } + fn get(i: int) -> u8 { ret data[i]; } } - let b = buf(~[1 as u8, 2 as u8, 3 as u8]); + let b = buf([1 as u8, 2 as u8, 3 as u8]); log b.get(1); assert (b.get(1) == 2 as u8); } diff --git a/src/test/run-pass/opeq.rs b/src/test/run-pass/opeq.rs index 03576541d47..b38a6313f54 100644 --- a/src/test/run-pass/opeq.rs +++ b/src/test/run-pass/opeq.rs @@ -16,4 +16,4 @@ fn main() { x /= 5; log x; assert (x == 5); -} \ No newline at end of file +} diff --git a/src/test/run-pass/operator-associativity.rs b/src/test/run-pass/operator-associativity.rs index 624d431b45a..af8c3ee6228 100644 --- a/src/test/run-pass/operator-associativity.rs +++ b/src/test/run-pass/operator-associativity.rs @@ -2,4 +2,4 @@ // Testcase for issue #130, operator associativity. -fn main() { assert (3 * 5 / 2 == 7); } \ No newline at end of file +fn main() { assert (3 * 5 / 2 == 7); } diff --git a/src/test/run-pass/or-pattern.rs b/src/test/run-pass/or-pattern.rs index 498a6777d9c..99682e0977a 100644 --- a/src/test/run-pass/or-pattern.rs +++ b/src/test/run-pass/or-pattern.rs @@ -8,4 +8,4 @@ fn main() { assert (or_alt(c) == 0); assert (or_alt(a(10, 100, 0u)) == 110); assert (or_alt(b(20, 200)) == 220); -} \ No newline at end of file +} diff --git a/src/test/run-pass/output-slot-variants.rs b/src/test/run-pass/output-slot-variants.rs index fe318ec539c..41d5b2871b3 100644 --- a/src/test/run-pass/output-slot-variants.rs +++ b/src/test/run-pass/output-slot-variants.rs @@ -55,4 +55,4 @@ fn main() { ext_ext_mem = ret_ext_ext_mem(); // non-initializing -} \ No newline at end of file +} diff --git a/src/test/run-pass/over-constrained-vregs.rs b/src/test/run-pass/over-constrained-vregs.rs index 29840986793..98f4ab7a6d8 100644 --- a/src/test/run-pass/over-constrained-vregs.rs +++ b/src/test/run-pass/over-constrained-vregs.rs @@ -2,4 +2,4 @@ // Regression test for issue #152. -fn main() { let b: uint = 1u; while b <= 32u { 0u << b; b <<= 1u; log b; } } \ No newline at end of file +fn main() { let b: uint = 1u; while b <= 32u { 0u << b; b <<= 1u; log b; } } diff --git a/src/test/run-pass/paren-free.rs b/src/test/run-pass/paren-free.rs index cde723b835b..4d48c09175a 100644 --- a/src/test/run-pass/paren-free.rs +++ b/src/test/run-pass/paren-free.rs @@ -2,4 +2,4 @@ fn main() { let x = true; if x { let i = 10; while i > 0 { i -= 1; } } alt x { true { log "right"; } false { log "wrong"; } } -} \ No newline at end of file +} diff --git a/src/test/run-pass/parse-fail.rs b/src/test/run-pass/parse-fail.rs index 3d7b372b9b4..0b4e959c9ee 100644 --- a/src/test/run-pass/parse-fail.rs +++ b/src/test/run-pass/parse-fail.rs @@ -4,4 +4,4 @@ // -*- rust -*- fn dont_call_me() { fail; log 1; } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/polymorphic-iter.rs b/src/test/run-pass/polymorphic-iter.rs index 46d3705649e..4f23b58f268 100644 --- a/src/test/run-pass/polymorphic-iter.rs +++ b/src/test/run-pass/polymorphic-iter.rs @@ -1,4 +1,2 @@ iter iter2<@T>() -> T { } -fn main() { - for each i: int in iter2() { } -} +fn main() { for each i: int in iter2() { } } diff --git a/src/test/run-pass/pred-check.rs b/src/test/run-pass/pred-check.rs index 4f7d6e92ec9..12b1ff5ed73 100644 --- a/src/test/run-pass/pred-check.rs +++ b/src/test/run-pass/pred-check.rs @@ -1,4 +1,4 @@ // -*- rust -*- pred f(q: int) -> bool { ret true; } -fn main() { let x = 0; check (f(x)); } \ No newline at end of file +fn main() { let x = 0; check (f(x)); } diff --git a/src/test/run-pass/pred.rs b/src/test/run-pass/pred.rs index e1ddf1c2ece..5c9a56c904c 100644 --- a/src/test/run-pass/pred.rs +++ b/src/test/run-pass/pred.rs @@ -11,4 +11,4 @@ fn main() { check (lt(a, c)); f(a, b); f(a, c); -} \ No newline at end of file +} diff --git a/src/test/run-pass/readalias.rs b/src/test/run-pass/readalias.rs index 451aa290fa5..93b8b22aef5 100644 --- a/src/test/run-pass/readalias.rs +++ b/src/test/run-pass/readalias.rs @@ -6,4 +6,4 @@ type point = {x: int, y: int, z: int}; fn f(p: &point) { assert (p.z == 12); } -fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); } \ No newline at end of file +fn main() { let x: point = {x: 10, y: 11, z: 12}; f(x); } diff --git a/src/test/run-pass/rebind-fn.rs b/src/test/run-pass/rebind-fn.rs index b10054de0cd..62d3ca16d11 100644 --- a/src/test/run-pass/rebind-fn.rs +++ b/src/test/run-pass/rebind-fn.rs @@ -1,11 +1,8 @@ fn add(i: int, j: int) -> int { ret i + j; } -fn binder(n: int) -> fn() -> int { - let f = bind add(n, _); - ret bind f(2); -} +fn binder(n: int) -> fn() -> int { let f = bind add(n, _); ret bind f(2); } fn main() { binder(5); let f = binder(1); - assert(f() == 3); - assert(binder(8)() == 10); + assert (f() == 3); + assert (binder(8)() == 10); } diff --git a/src/test/run-pass/rec-auto.rs b/src/test/run-pass/rec-auto.rs index 4162bebfb92..c23c359d621 100644 --- a/src/test/run-pass/rec-auto.rs +++ b/src/test/run-pass/rec-auto.rs @@ -4,4 +4,4 @@ // -*- rust -*- // Issue #50. -fn main() { let x = {foo: "hello", bar: "world"}; log x.foo; log x.bar; } \ No newline at end of file +fn main() { let x = {foo: "hello", bar: "world"}; log x.foo; log x.bar; } diff --git a/src/test/run-pass/rec-extend.rs b/src/test/run-pass/rec-extend.rs index 6b307107ab0..cd0d089d28a 100644 --- a/src/test/run-pass/rec-extend.rs +++ b/src/test/run-pass/rec-extend.rs @@ -14,4 +14,4 @@ fn main() { assert (right.y == 0); assert (up.x == 0); assert (up.y == 10); -} \ No newline at end of file +} diff --git a/src/test/run-pass/rec-tup.rs b/src/test/run-pass/rec-tup.rs index e1656bf17b8..66cf866de9d 100644 --- a/src/test/run-pass/rec-tup.rs +++ b/src/test/run-pass/rec-tup.rs @@ -3,14 +3,8 @@ type point = {x: int, y: int}; type rect = (point, point); -fn fst(r: &rect) -> point { - let (fst, _) = r; - ret fst; -} -fn snd(r: &rect) -> point { - let (_, snd) = r; - ret snd; -} +fn fst(r: &rect) -> point { let (fst, _) = r; ret fst; } +fn snd(r: &rect) -> point { let (_, snd) = r; ret snd; } fn f(r: rect, x1: int, y1: int, x2: int, y2: int) { assert (fst(r).x == x1); diff --git a/src/test/run-pass/rec.rs b/src/test/run-pass/rec.rs index b7a3f3a6d84..04867f72fa8 100644 --- a/src/test/run-pass/rec.rs +++ b/src/test/run-pass/rec.rs @@ -22,4 +22,4 @@ fn main() { assert (x == 10); f(r, 10, 20, 100, 200); f(r2, 10, 20, 100, 200); -} \ No newline at end of file +} diff --git a/src/test/run-pass/record-pat.rs b/src/test/run-pass/record-pat.rs index 794a1a9ee04..f2f4c6af2c7 100644 --- a/src/test/run-pass/record-pat.rs +++ b/src/test/run-pass/record-pat.rs @@ -12,4 +12,4 @@ fn m(in: &t3) -> int { fn main() { assert (m(c({x: a(10), y: 5}, 4u)) == 10); assert (m(c({x: b(10u), y: 5}, 4u)) == 19); -} \ No newline at end of file +} diff --git a/src/test/run-pass/resource-destruct.rs b/src/test/run-pass/resource-destruct.rs index 8d6d85899b1..25a3c79e1c3 100644 --- a/src/test/run-pass/resource-destruct.rs +++ b/src/test/run-pass/resource-destruct.rs @@ -6,4 +6,4 @@ fn main() { let my_total = @mutable 10; { let pt <- shrinky_pointer(my_total); assert (look_at(pt) == 10); } assert (*my_total == 9); -} \ No newline at end of file +} diff --git a/src/test/run-pass/resource-generic.rs b/src/test/run-pass/resource-generic.rs index 6ab2eb308b6..34ecc55f2e4 100644 --- a/src/test/run-pass/resource-generic.rs +++ b/src/test/run-pass/resource-generic.rs @@ -1,4 +1,4 @@ -resource finish<T>(arg: {val: T, fin: fn(&T) }) { arg.fin(arg.val); } +resource finish<T>(arg: {val: T, fin: fn(&T)}) { arg.fin(arg.val); } fn main() { let box = @mutable 10; diff --git a/src/test/run-pass/resource-in-struct.rs b/src/test/run-pass/resource-in-struct.rs index 6e7e8dc6bfd..758beb3d9e1 100644 --- a/src/test/run-pass/resource-in-struct.rs +++ b/src/test/run-pass/resource-in-struct.rs @@ -3,17 +3,15 @@ type closable = @mutable bool; -resource close_res(i: closable) { - *i = false; -} +resource close_res(i: closable) { *i = false; } tag option<T> { none; some(T); } -fn sink(res: option<close_res>) {} +fn sink(res: option<close_res>) { } fn main() { let c = @mutable true; sink(none); sink(some(close_res(c))); - assert !*c; + assert (!*c); } diff --git a/src/test/run-pass/ret-bang.rs b/src/test/run-pass/ret-bang.rs index e668ff9b0bc..55a4c5922c3 100644 --- a/src/test/run-pass/ret-bang.rs +++ b/src/test/run-pass/ret-bang.rs @@ -8,4 +8,4 @@ fn okay(i: uint) -> int { if i == 3u { my_err("I don't like three"); } else { ret 42; } } -fn main() { okay(4u); } \ No newline at end of file +fn main() { okay(4u); } diff --git a/src/test/run-pass/return-nil.rs b/src/test/run-pass/return-nil.rs index 6e7b9d8b048..a7a55e60971 100644 --- a/src/test/run-pass/return-nil.rs +++ b/src/test/run-pass/return-nil.rs @@ -2,4 +2,4 @@ fn f() { let x: () = (); ret x; } -fn main() { let x = f(); } \ No newline at end of file +fn main() { let x = f(); } diff --git a/src/test/run-pass/rt-circular-buffer.rs b/src/test/run-pass/rt-circular-buffer.rs index 4a6839a8de5..0d84d1abe64 100644 --- a/src/test/run-pass/rt-circular-buffer.rs +++ b/src/test/run-pass/rt-circular-buffer.rs @@ -30,7 +30,7 @@ fn test_init() { fn test_grow() { let myport: comm::_port<record> = comm::mk_port(); let mychan = myport.mk_chan(); - for each i: uint in uint::range(0u, 100u) { + for each i: uint in uint::range(0u, 100u) { let val: record = {val1: 0u32, val2: 0u32, val3: 0u32}; comm::send(mychan, val); } @@ -48,11 +48,11 @@ fn test_shrink1() { fn test_shrink2() { let myport = mk_port::<record>(); let mychan = myport.mk_chan(); - for each i: uint in uint::range(0u, 100u) { + for each i: uint in uint::range(0u, 100u) { let val: record = {val1: 0u32, val2: 0u32, val3: 0u32}; send(mychan, val); } - for each i: uint in uint::range(0u, 100u) { let x = myport.recv(); } + for each i: uint in uint::range(0u, 100u) { let x = myport.recv(); } } @@ -60,7 +60,7 @@ fn test_shrink2() { fn test_rotate() { let myport = mk_port::<record>(); let mychan = myport.mk_chan(); - for each i: uint in uint::range(0u, 100u) { + for each i: uint in uint::range(0u, 100u) { let val = {val1: i as u32, val2: i as u32, val3: i as u32}; send(mychan, val); let x = myport.recv(); @@ -76,13 +76,13 @@ fn test_rotate() { fn test_rotate_grow() { let myport = mk_port::<record>(); let mychan = myport.mk_chan(); - for each j: uint in uint::range(0u, 10u) { - for each i: uint in uint::range(0u, 10u) { + for each j: uint in uint::range(0u, 10u) { + for each i: uint in uint::range(0u, 10u) { let val: record = {val1: i as u32, val2: i as u32, val3: i as u32}; send(mychan, val); } - for each i: uint in uint::range(0u, 10u) { + for each i: uint in uint::range(0u, 10u) { let x = myport.recv(); assert (x.val1 == i as u32); assert (x.val2 == i as u32); diff --git a/src/test/run-pass/self-shadowing-import.rs b/src/test/run-pass/self-shadowing-import.rs index c9b70d35d46..7887990f080 100644 --- a/src/test/run-pass/self-shadowing-import.rs +++ b/src/test/run-pass/self-shadowing-import.rs @@ -11,4 +11,4 @@ mod c { fn bar() { assert (a::foo() == 1); } } -fn main() { c::bar(); } \ No newline at end of file +fn main() { c::bar(); } diff --git a/src/test/run-pass/seq-compare.rs b/src/test/run-pass/seq-compare.rs index 265c45a101d..79a318eefd2 100644 --- a/src/test/run-pass/seq-compare.rs +++ b/src/test/run-pass/seq-compare.rs @@ -4,13 +4,13 @@ fn main() { assert ("hello" < "hellr"); assert ("hello " > "hello"); assert ("hello" != "there"); - assert (~[1, 2, 3, 4] > ~[1, 2, 3]); - assert (~[1, 2, 3] < ~[1, 2, 3, 4]); - assert (~[1, 2, 4, 4] > ~[1, 2, 3, 4]); - assert (~[1, 2, 3, 4] < ~[1, 2, 4, 4]); - assert (~[1, 2, 3] <= ~[1, 2, 3]); - assert (~[1, 2, 3] <= ~[1, 2, 3, 3]); - assert (~[1, 2, 3, 4] > ~[1, 2, 3]); - assert (~[1, 2, 3] == ~[1, 2, 3]); - assert (~[1, 2, 3] != ~[1, 1, 3]); -} \ No newline at end of file + assert ([1, 2, 3, 4] > [1, 2, 3]); + assert ([1, 2, 3] < [1, 2, 3, 4]); + assert ([1, 2, 4, 4] > [1, 2, 3, 4]); + assert ([1, 2, 3, 4] < [1, 2, 4, 4]); + assert ([1, 2, 3] <= [1, 2, 3]); + assert ([1, 2, 3] <= [1, 2, 3, 3]); + assert ([1, 2, 3, 4] > [1, 2, 3]); + assert ([1, 2, 3] == [1, 2, 3]); + assert ([1, 2, 3] != [1, 1, 3]); +} diff --git a/src/test/run-pass/shadow.rs b/src/test/run-pass/shadow.rs index e3f86246594..3fc3a015915 100644 --- a/src/test/run-pass/shadow.rs +++ b/src/test/run-pass/shadow.rs @@ -1,20 +1,15 @@ // -*- rust -*- fn foo(c: [int]) { let a: int = 5; - let b: [int] = ~[]; + let b: [int] = []; alt none::<int> { - some::<int>(_) { for i: int in c { log a; let a = 17; b += ~[a]; } } - _ {} + some::<int>(_) { for i: int in c { log a; let a = 17; b += [a]; } } + _ { } } } tag t<T> { none; some(T); } -fn main() { - let x = 10; - let x = x + 20; - assert x == 30; - foo(~[]); -} +fn main() { let x = 10; let x = x + 20; assert (x == 30); foo([]); } diff --git a/src/test/run-pass/simple-alt-generic-tag.rs b/src/test/run-pass/simple-alt-generic-tag.rs index 39a9619b1c6..ac0e5ed6994 100644 --- a/src/test/run-pass/simple-alt-generic-tag.rs +++ b/src/test/run-pass/simple-alt-generic-tag.rs @@ -3,5 +3,6 @@ tag opt<T> { none; } fn main() { - let x = none::<int>; alt x { none::<int>. { log "hello world"; } } + let x = none::<int>; + alt x { none::<int>. { log "hello world"; } } } diff --git a/src/test/run-pass/simple-anon-objs.rs b/src/test/run-pass/simple-anon-objs.rs index 8525ea8c8a3..5c2315d67d0 100644 --- a/src/test/run-pass/simple-anon-objs.rs +++ b/src/test/run-pass/simple-anon-objs.rs @@ -26,4 +26,4 @@ fn main() { assert (another_anon_obj.baz() == 4); -} \ No newline at end of file +} diff --git a/src/test/run-pass/simple-infer.rs b/src/test/run-pass/simple-infer.rs index 6cf8df90222..03656fc8c1b 100644 --- a/src/test/run-pass/simple-infer.rs +++ b/src/test/run-pass/simple-infer.rs @@ -1,3 +1,3 @@ -fn main() { let n; n = 1; log n; } \ No newline at end of file +fn main() { let n; n = 1; log n; } diff --git a/src/test/run-pass/simple-obj.rs b/src/test/run-pass/simple-obj.rs index 1133cdc7630..6cb4caafe16 100644 --- a/src/test/run-pass/simple-obj.rs +++ b/src/test/run-pass/simple-obj.rs @@ -6,4 +6,4 @@ obj x() { fn hello() { log "hello, object world"; } } -fn main() { let mx = x(); mx.hello(); } \ No newline at end of file +fn main() { let mx = x(); mx.hello(); } diff --git a/src/test/run-pass/size-and-align.rs b/src/test/run-pass/size-and-align.rs index 8628e359ccb..929ce3500f1 100644 --- a/src/test/run-pass/size-and-align.rs +++ b/src/test/run-pass/size-and-align.rs @@ -5,13 +5,13 @@ tag clam<T> { a(T, int); b; } fn uhoh<T>(v: &[clam<T>]) { - alt v.(1) { + alt v[1] { a::<T>(t, u) { log "incorrect"; log u; fail; } b::<T>. { log "correct"; } } } fn main() { - let v: [clam<int>] = ~[b::<int>, b::<int>, a::<int>(42, 17)]; + let v: [clam<int>] = [b::<int>, b::<int>, a::<int>(42, 17)]; uhoh::<int>(v); } diff --git a/src/test/run-pass/spawn-fn.rs b/src/test/run-pass/spawn-fn.rs index 26495c4a085..03d450a9cfa 100644 --- a/src/test/run-pass/spawn-fn.rs +++ b/src/test/run-pass/spawn-fn.rs @@ -12,4 +12,4 @@ fn main() { task::_spawn(bind x("hello from third spawned fn", 67)); let i: int = 30; while i > 0 { i = i - 1; log "parent sleeping"; yield(); } -} \ No newline at end of file +} diff --git a/src/test/run-pass/spawn-module-qualified.rs b/src/test/run-pass/spawn-module-qualified.rs index 46d0dfee616..f1d1a099ef2 100644 --- a/src/test/run-pass/spawn-module-qualified.rs +++ b/src/test/run-pass/spawn-module-qualified.rs @@ -2,12 +2,7 @@ use std; import std::task::join_id; import std::task::_spawn; -fn main() { - let x = _spawn(bind m::child(10)); - join_id(x); -} +fn main() { let x = _spawn(bind m::child(10)); join_id(x); } mod m { - fn child(i: int) { - log i; - } + fn child(i: int) { log i; } } diff --git a/src/test/run-pass/spawn.rs b/src/test/run-pass/spawn.rs index 1ef82f24a2d..29126d85018 100644 --- a/src/test/run-pass/spawn.rs +++ b/src/test/run-pass/spawn.rs @@ -4,10 +4,7 @@ use std; import std::task; -fn main() { - let t = task::_spawn(bind child(10)); - task::join_id(t); -} +fn main() { let t = task::_spawn(bind child(10)); task::join_id(t); } fn child(i: int) { log_err i; assert (i == 10); } diff --git a/src/test/run-pass/standalone-method.rs b/src/test/run-pass/standalone-method.rs index 3fe6763bf97..e9768339433 100644 --- a/src/test/run-pass/standalone-method.rs +++ b/src/test/run-pass/standalone-method.rs @@ -1,22 +1,18 @@ // Test case for issue #435. obj foo() { - fn add5(n: int) -> int { - ret n + 5; - } + fn add5(n: int) -> int { ret n + 5; } } -fn add5(n: int) -> int { - ret n + 5; -} +fn add5(n: int) -> int { ret n + 5; } fn main() { let fiveplusseven = bind add5(7); - assert add5(7) == 12; - assert fiveplusseven() == 12; + assert (add5(7) == 12); + assert (fiveplusseven() == 12); let my_foo = foo(); let fiveplusseven_too = bind my_foo.add5(7); - assert my_foo.add5(7) == 12; - assert fiveplusseven_too() == 12; + assert (my_foo.add5(7) == 12); + assert (fiveplusseven_too() == 12); } diff --git a/src/test/run-pass/stateful-obj.rs b/src/test/run-pass/stateful-obj.rs index 7e3fa5602b4..97160244d16 100644 --- a/src/test/run-pass/stateful-obj.rs +++ b/src/test/run-pass/stateful-obj.rs @@ -16,4 +16,4 @@ fn main() { y.incr(); log y.get(); assert (y.get() == 2); -} \ No newline at end of file +} diff --git a/src/test/run-pass/str-append.rs b/src/test/run-pass/str-append.rs index a27f729fe5d..e1fa92738cb 100644 --- a/src/test/run-pass/str-append.rs +++ b/src/test/run-pass/str-append.rs @@ -8,7 +8,7 @@ fn test1() { let s: str = "hello"; s += "world"; log s; - assert (s.(9) == 'd' as u8); + assert (s[9] == 'd' as u8); } fn test2() { @@ -23,4 +23,4 @@ fn test2() { assert (str::eq(b, "ABCabcABC")); } -fn main() { test1(); test2(); } \ No newline at end of file +fn main() { test1(); test2(); } diff --git a/src/test/run-pass/str-concat.rs b/src/test/run-pass/str-concat.rs index 57c0525cfd3..8fc48725875 100644 --- a/src/test/run-pass/str-concat.rs +++ b/src/test/run-pass/str-concat.rs @@ -7,5 +7,5 @@ fn main() { let b: str = "world"; let s: str = a + b; log s; - assert (s.(9) == 'd' as u8); -} \ No newline at end of file + assert (s[9] == 'd' as u8); +} diff --git a/src/test/run-pass/str-growth.rs b/src/test/run-pass/str-growth.rs index 35d29fec65a..5c0d34b3501 100644 --- a/src/test/run-pass/str-growth.rs +++ b/src/test/run-pass/str-growth.rs @@ -3,12 +3,12 @@ fn main() { let s = "a"; s += "b"; - assert (s.(0) == 'a' as u8); - assert (s.(1) == 'b' as u8); + assert (s[0] == 'a' as u8); + assert (s[1] == 'b' as u8); s += "c"; s += "d"; - assert (s.(0) == 'a' as u8); - assert (s.(1) == 'b' as u8); - assert (s.(2) == 'c' as u8); - assert (s.(3) == 'd' as u8); -} \ No newline at end of file + assert (s[0] == 'a' as u8); + assert (s[1] == 'b' as u8); + assert (s[2] == 'c' as u8); + assert (s[3] == 'd' as u8); +} diff --git a/src/test/run-pass/str-idx.rs b/src/test/run-pass/str-idx.rs index 0c619a213fa..4b5ea5f7961 100644 --- a/src/test/run-pass/str-idx.rs +++ b/src/test/run-pass/str-idx.rs @@ -5,4 +5,4 @@ fn main() { let c: u8 = s[4]; log c; assert (c == 0x6f as u8); -} \ No newline at end of file +} diff --git a/src/test/run-pass/str-multiline.rs b/src/test/run-pass/str-multiline.rs index 45d6ad632ba..15a13083321 100644 --- a/src/test/run-pass/str-multiline.rs +++ b/src/test/run-pass/str-multiline.rs @@ -14,4 +14,4 @@ is a test"; test"; assert (str::eq(a, "this is a test")); assert (str::eq(b, "this is another test")); -} \ No newline at end of file +} diff --git a/src/test/run-pass/string-self-append.rs b/src/test/run-pass/string-self-append.rs index 3b15df94ce4..94a9696adf0 100644 --- a/src/test/run-pass/string-self-append.rs +++ b/src/test/run-pass/string-self-append.rs @@ -13,4 +13,4 @@ fn main() { i -= 1; expected_len *= 2u; } -} \ No newline at end of file +} diff --git a/src/test/run-pass/structured-compare-recursive.rs b/src/test/run-pass/structured-compare-recursive.rs index bc8bb76a480..cee650ed40e 100644 --- a/src/test/run-pass/structured-compare-recursive.rs +++ b/src/test/run-pass/structured-compare-recursive.rs @@ -2,4 +2,4 @@ tag taggy { foo(@taggy); bar; } -fn main() { assert (bar <= bar); } \ No newline at end of file +fn main() { assert (bar <= bar); } diff --git a/src/test/run-pass/structured-compare.rs b/src/test/run-pass/structured-compare.rs index e2d95a54575..04bc1d75da8 100644 --- a/src/test/run-pass/structured-compare.rs +++ b/src/test/run-pass/structured-compare.rs @@ -16,4 +16,4 @@ fn main() { assert (x != y); assert (x == large); assert (x != small); -} \ No newline at end of file +} diff --git a/src/test/run-pass/swap-1.rs b/src/test/run-pass/swap-1.rs index 62b557eba63..c9fc58a93aa 100644 --- a/src/test/run-pass/swap-1.rs +++ b/src/test/run-pass/swap-1.rs @@ -1 +1 @@ -fn main() { let x = 3; let y = 7; x <-> y; assert (x == 7); assert (y == 3); } \ No newline at end of file +fn main() { let x = 3; let y = 7; x <-> y; assert (x == 7); assert (y == 3); } diff --git a/src/test/run-pass/swap-2.rs b/src/test/run-pass/swap-2.rs index 155d71399e5..5caf36f9b92 100644 --- a/src/test/run-pass/swap-2.rs +++ b/src/test/run-pass/swap-2.rs @@ -1,12 +1,12 @@ -fn swap<@T>(v: &[mutable T], i: int, j: int) { v.(i) <-> v.(j); } +fn swap<@T>(v: &[mutable T], i: int, j: int) { v[i] <-> v[j]; } fn main() { - let a: [mutable int] = ~[mutable 0, 1, 2, 3, 4, 5, 6]; + let a: [mutable int] = [mutable 0, 1, 2, 3, 4, 5, 6]; swap(a, 2, 4); - assert (a.(2) == 4); - assert (a.(4) == 2); + assert (a[2] == 4); + assert (a[4] == 2); let n = 42; - n <-> a.(0); - assert (a.(0) == 42); + n <-> a[0]; + assert (a[0] == 42); assert (n == 0); } diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs index 22033e2acf2..c241a68e7f1 100644 --- a/src/test/run-pass/syntax-extension-fmt.rs +++ b/src/test/run-pass/syntax-extension-fmt.rs @@ -8,10 +8,10 @@ fn test(actual: str, expected: str) { } fn main() { - test(#fmt("hello %d friends and %s things", 10, "formatted"), + test(#fmt["hello %d friends and %s things", 10, "formatted"], "hello 10 friends and formatted things"); - test(#fmt("test"), "test"); + test(#fmt["test"], "test"); // a quadratic optimization in LLVM (jump-threading) makes this test a // bit slow to compile unless we break it up @@ -26,192 +26,192 @@ fn main() { fn part1() { // Simple tests for types - test(#fmt("%d", 1), "1"); - test(#fmt("%i", 2), "2"); - test(#fmt("%i", -1), "-1"); - test(#fmt("%u", 10u), "10"); - test(#fmt("%s", "test"), "test"); - test(#fmt("%b", true), "true"); - test(#fmt("%b", false), "false"); - test(#fmt("%c", 'A'), "A"); - test(#fmt("%x", 0xff_u), "ff"); - test(#fmt("%X", 0x12ab_u), "12AB"); - test(#fmt("%o", 10u), "12"); - test(#fmt("%t", 0b11010101_u), "11010101"); + test(#fmt["%d", 1], "1"); + test(#fmt["%i", 2], "2"); + test(#fmt["%i", -1], "-1"); + test(#fmt["%u", 10u], "10"); + test(#fmt["%s", "test"], "test"); + test(#fmt["%b", true], "true"); + test(#fmt["%b", false], "false"); + test(#fmt["%c", 'A'], "A"); + test(#fmt["%x", 0xff_u], "ff"); + test(#fmt["%X", 0x12ab_u], "12AB"); + test(#fmt["%o", 10u], "12"); + test(#fmt["%t", 0b11010101_u], "11010101"); // 32-bit limits - test(#fmt("%i", -2147483648), "-2147483648"); - test(#fmt("%i", 2147483647), "2147483647"); - test(#fmt("%u", 4294967295u), "4294967295"); - test(#fmt("%x", 0xffffffff_u), "ffffffff"); - test(#fmt("%o", 0xffffffff_u), "37777777777"); - test(#fmt("%t", 0xffffffff_u), "11111111111111111111111111111111"); + test(#fmt["%i", -2147483648], "-2147483648"); + test(#fmt["%i", 2147483647], "2147483647"); + test(#fmt["%u", 4294967295u], "4294967295"); + test(#fmt["%x", 0xffffffff_u], "ffffffff"); + test(#fmt["%o", 0xffffffff_u], "37777777777"); + test(#fmt["%t", 0xffffffff_u], "11111111111111111111111111111111"); } fn part2() { // Widths - test(#fmt("%1d", 500), "500"); - test(#fmt("%10d", 500), " 500"); - test(#fmt("%10d", -500), " -500"); - test(#fmt("%10u", 500u), " 500"); - test(#fmt("%10s", "test"), " test"); - test(#fmt("%10b", true), " true"); - test(#fmt("%10x", 0xff_u), " ff"); - test(#fmt("%10X", 0xff_u), " FF"); - test(#fmt("%10o", 10u), " 12"); - test(#fmt("%10t", 0xff_u), " 11111111"); - test(#fmt("%10c", 'A'), " A"); + test(#fmt["%1d", 500], "500"); + test(#fmt["%10d", 500], " 500"); + test(#fmt["%10d", -500], " -500"); + test(#fmt["%10u", 500u], " 500"); + test(#fmt["%10s", "test"], " test"); + test(#fmt["%10b", true], " true"); + test(#fmt["%10x", 0xff_u], " ff"); + test(#fmt["%10X", 0xff_u], " FF"); + test(#fmt["%10o", 10u], " 12"); + test(#fmt["%10t", 0xff_u], " 11111111"); + test(#fmt["%10c", 'A'], " A"); // Left justify - test(#fmt("%-10d", 500), "500 "); - test(#fmt("%-10d", -500), "-500 "); - test(#fmt("%-10u", 500u), "500 "); - test(#fmt("%-10s", "test"), "test "); - test(#fmt("%-10b", true), "true "); - test(#fmt("%-10x", 0xff_u), "ff "); - test(#fmt("%-10X", 0xff_u), "FF "); - test(#fmt("%-10o", 10u), "12 "); - test(#fmt("%-10t", 0xff_u), "11111111 "); - test(#fmt("%-10c", 'A'), "A "); + test(#fmt["%-10d", 500], "500 "); + test(#fmt["%-10d", -500], "-500 "); + test(#fmt["%-10u", 500u], "500 "); + test(#fmt["%-10s", "test"], "test "); + test(#fmt["%-10b", true], "true "); + test(#fmt["%-10x", 0xff_u], "ff "); + test(#fmt["%-10X", 0xff_u], "FF "); + test(#fmt["%-10o", 10u], "12 "); + test(#fmt["%-10t", 0xff_u], "11111111 "); + test(#fmt["%-10c", 'A'], "A "); } fn part3() { // Precision - test(#fmt("%.d", 0), ""); - test(#fmt("%.u", 0u), ""); - test(#fmt("%.x", 0u), ""); - test(#fmt("%.t", 0u), ""); - test(#fmt("%.d", 10), "10"); - test(#fmt("%.d", -10), "-10"); - test(#fmt("%.u", 10u), "10"); - test(#fmt("%.s", "test"), ""); - test(#fmt("%.x", 127u), "7f"); - test(#fmt("%.o", 10u), "12"); - test(#fmt("%.t", 3u), "11"); - test(#fmt("%.c", 'A'), "A"); - test(#fmt("%.0d", 0), ""); - test(#fmt("%.0u", 0u), ""); - test(#fmt("%.0x", 0u), ""); - test(#fmt("%.0t", 0u), ""); - test(#fmt("%.0d", 10), "10"); - test(#fmt("%.0d", -10), "-10"); - test(#fmt("%.0u", 10u), "10"); - test(#fmt("%.0s", "test"), ""); - test(#fmt("%.0x", 127u), "7f"); - test(#fmt("%.0o", 10u), "12"); - test(#fmt("%.0t", 3u), "11"); - test(#fmt("%.0c", 'A'), "A"); - test(#fmt("%.1d", 0), "0"); - test(#fmt("%.1u", 0u), "0"); - test(#fmt("%.1x", 0u), "0"); - test(#fmt("%.1t", 0u), "0"); - test(#fmt("%.1d", 10), "10"); - test(#fmt("%.1d", -10), "-10"); - test(#fmt("%.1u", 10u), "10"); - test(#fmt("%.1s", "test"), "t"); - test(#fmt("%.1x", 127u), "7f"); - test(#fmt("%.1o", 10u), "12"); - test(#fmt("%.1t", 3u), "11"); - test(#fmt("%.1c", 'A'), "A"); + test(#fmt["%.d", 0], ""); + test(#fmt["%.u", 0u], ""); + test(#fmt["%.x", 0u], ""); + test(#fmt["%.t", 0u], ""); + test(#fmt["%.d", 10], "10"); + test(#fmt["%.d", -10], "-10"); + test(#fmt["%.u", 10u], "10"); + test(#fmt["%.s", "test"], ""); + test(#fmt["%.x", 127u], "7f"); + test(#fmt["%.o", 10u], "12"); + test(#fmt["%.t", 3u], "11"); + test(#fmt["%.c", 'A'], "A"); + test(#fmt["%.0d", 0], ""); + test(#fmt["%.0u", 0u], ""); + test(#fmt["%.0x", 0u], ""); + test(#fmt["%.0t", 0u], ""); + test(#fmt["%.0d", 10], "10"); + test(#fmt["%.0d", -10], "-10"); + test(#fmt["%.0u", 10u], "10"); + test(#fmt["%.0s", "test"], ""); + test(#fmt["%.0x", 127u], "7f"); + test(#fmt["%.0o", 10u], "12"); + test(#fmt["%.0t", 3u], "11"); + test(#fmt["%.0c", 'A'], "A"); + test(#fmt["%.1d", 0], "0"); + test(#fmt["%.1u", 0u], "0"); + test(#fmt["%.1x", 0u], "0"); + test(#fmt["%.1t", 0u], "0"); + test(#fmt["%.1d", 10], "10"); + test(#fmt["%.1d", -10], "-10"); + test(#fmt["%.1u", 10u], "10"); + test(#fmt["%.1s", "test"], "t"); + test(#fmt["%.1x", 127u], "7f"); + test(#fmt["%.1o", 10u], "12"); + test(#fmt["%.1t", 3u], "11"); + test(#fmt["%.1c", 'A'], "A"); } fn part4() { - test(#fmt("%.5d", 0), "00000"); - test(#fmt("%.5u", 0u), "00000"); - test(#fmt("%.5x", 0u), "00000"); - test(#fmt("%.5t", 0u), "00000"); - test(#fmt("%.5d", 10), "00010"); - test(#fmt("%.5d", -10), "-00010"); - test(#fmt("%.5u", 10u), "00010"); - test(#fmt("%.5s", "test"), "test"); - test(#fmt("%.5x", 127u), "0007f"); - test(#fmt("%.5o", 10u), "00012"); - test(#fmt("%.5t", 3u), "00011"); - test(#fmt("%.5c", 'A'), "A"); + test(#fmt["%.5d", 0], "00000"); + test(#fmt["%.5u", 0u], "00000"); + test(#fmt["%.5x", 0u], "00000"); + test(#fmt["%.5t", 0u], "00000"); + test(#fmt["%.5d", 10], "00010"); + test(#fmt["%.5d", -10], "-00010"); + test(#fmt["%.5u", 10u], "00010"); + test(#fmt["%.5s", "test"], "test"); + test(#fmt["%.5x", 127u], "0007f"); + test(#fmt["%.5o", 10u], "00012"); + test(#fmt["%.5t", 3u], "00011"); + test(#fmt["%.5c", 'A'], "A"); // Bool precision. I'm not sure if it's good or bad to have bool // conversions support precision - it's not standard printf so we // can do whatever. For now I'm making it behave the same as string // conversions. - test(#fmt("%.b", true), ""); - test(#fmt("%.0b", true), ""); - test(#fmt("%.1b", true), "t"); + test(#fmt["%.b", true], ""); + test(#fmt["%.0b", true], ""); + test(#fmt["%.1b", true], "t"); } fn part5() { // Explicit + sign. Only for signed conversions - test(#fmt("%+d", 0), "+0"); - test(#fmt("%+d", 1), "+1"); - test(#fmt("%+d", -1), "-1"); + test(#fmt["%+d", 0], "+0"); + test(#fmt["%+d", 1], "+1"); + test(#fmt["%+d", -1], "-1"); // Leave space for sign - test(#fmt("% d", 0), " 0"); - test(#fmt("% d", 1), " 1"); - test(#fmt("% d", -1), "-1"); + test(#fmt["% d", 0], " 0"); + test(#fmt["% d", 1], " 1"); + test(#fmt["% d", -1], "-1"); // Plus overrides space - test(#fmt("% +d", 0), "+0"); - test(#fmt("%+ d", 0), "+0"); + test(#fmt["% +d", 0], "+0"); + test(#fmt["%+ d", 0], "+0"); // 0-padding - test(#fmt("%05d", 0), "00000"); - test(#fmt("%05d", 1), "00001"); - test(#fmt("%05d", -1), "-0001"); - test(#fmt("%05u", 1u), "00001"); - test(#fmt("%05x", 127u), "0007f"); - test(#fmt("%05X", 127u), "0007F"); - test(#fmt("%05o", 10u), "00012"); - test(#fmt("%05t", 3u), "00011"); + test(#fmt["%05d", 0], "00000"); + test(#fmt["%05d", 1], "00001"); + test(#fmt["%05d", -1], "-0001"); + test(#fmt["%05u", 1u], "00001"); + test(#fmt["%05x", 127u], "0007f"); + test(#fmt["%05X", 127u], "0007F"); + test(#fmt["%05o", 10u], "00012"); + test(#fmt["%05t", 3u], "00011"); // 0-padding a string is undefined but glibc does this: - test(#fmt("%05s", "test"), " test"); - test(#fmt("%05c", 'A'), " A"); - test(#fmt("%05b", true), " true"); + test(#fmt["%05s", "test"], " test"); + test(#fmt["%05c", 'A'], " A"); + test(#fmt["%05b", true], " true"); // Left-justify overrides 0-padding - test(#fmt("%-05d", 0), "0 "); - test(#fmt("%-05d", 1), "1 "); - test(#fmt("%-05d", -1), "-1 "); - test(#fmt("%-05u", 1u), "1 "); - test(#fmt("%-05x", 127u), "7f "); - test(#fmt("%-05X", 127u), "7F "); - test(#fmt("%-05o", 10u), "12 "); - test(#fmt("%-05t", 3u), "11 "); - test(#fmt("%-05s", "test"), "test "); - test(#fmt("%-05c", 'A'), "A "); - test(#fmt("%-05b", true), "true "); + test(#fmt["%-05d", 0], "0 "); + test(#fmt["%-05d", 1], "1 "); + test(#fmt["%-05d", -1], "-1 "); + test(#fmt["%-05u", 1u], "1 "); + test(#fmt["%-05x", 127u], "7f "); + test(#fmt["%-05X", 127u], "7F "); + test(#fmt["%-05o", 10u], "12 "); + test(#fmt["%-05t", 3u], "11 "); + test(#fmt["%-05s", "test"], "test "); + test(#fmt["%-05c", 'A'], "A "); + test(#fmt["%-05b", true], "true "); } fn part6() { // Precision overrides 0-padding - test(#fmt("%06.5d", 0), " 00000"); - test(#fmt("%06.5u", 0u), " 00000"); - test(#fmt("%06.5x", 0u), " 00000"); - test(#fmt("%06.5d", 10), " 00010"); - test(#fmt("%06.5d", -10), "-00010"); - test(#fmt("%06.5u", 10u), " 00010"); - test(#fmt("%06.5s", "test"), " test"); - test(#fmt("%06.5c", 'A'), " A"); - test(#fmt("%06.5x", 127u), " 0007f"); - test(#fmt("%06.5X", 127u), " 0007F"); - test(#fmt("%06.5o", 10u), " 00012"); + test(#fmt["%06.5d", 0], " 00000"); + test(#fmt["%06.5u", 0u], " 00000"); + test(#fmt["%06.5x", 0u], " 00000"); + test(#fmt["%06.5d", 10], " 00010"); + test(#fmt["%06.5d", -10], "-00010"); + test(#fmt["%06.5u", 10u], " 00010"); + test(#fmt["%06.5s", "test"], " test"); + test(#fmt["%06.5c", 'A'], " A"); + test(#fmt["%06.5x", 127u], " 0007f"); + test(#fmt["%06.5X", 127u], " 0007F"); + test(#fmt["%06.5o", 10u], " 00012"); // Signed combinations - test(#fmt("% 5d", 1), " 1"); - test(#fmt("% 5d", -1), " -1"); - test(#fmt("%+5d", 1), " +1"); - test(#fmt("%+5d", -1), " -1"); - test(#fmt("% 05d", 1), " 0001"); - test(#fmt("% 05d", -1), "-0001"); - test(#fmt("%+05d", 1), "+0001"); - test(#fmt("%+05d", -1), "-0001"); - test(#fmt("%- 5d", 1), " 1 "); - test(#fmt("%- 5d", -1), "-1 "); - test(#fmt("%-+5d", 1), "+1 "); - test(#fmt("%-+5d", -1), "-1 "); - test(#fmt("%- 05d", 1), " 1 "); - test(#fmt("%- 05d", -1), "-1 "); - test(#fmt("%-+05d", 1), "+1 "); - test(#fmt("%-+05d", -1), "-1 "); -} \ No newline at end of file + test(#fmt["% 5d", 1], " 1"); + test(#fmt["% 5d", -1], " -1"); + test(#fmt["%+5d", 1], " +1"); + test(#fmt["%+5d", -1], " -1"); + test(#fmt["% 05d", 1], " 0001"); + test(#fmt["% 05d", -1], "-0001"); + test(#fmt["%+05d", 1], "+0001"); + test(#fmt["%+05d", -1], "-0001"); + test(#fmt["%- 5d", 1], " 1 "); + test(#fmt["%- 5d", -1], "-1 "); + test(#fmt["%-+5d", 1], "+1 "); + test(#fmt["%-+5d", -1], "-1 "); + test(#fmt["%- 05d", 1], " 1 "); + test(#fmt["%- 05d", -1], "-1 "); + test(#fmt["%-+05d", 1], "+1 "); + test(#fmt["%-+05d", -1], "-1 "); +} diff --git a/src/test/run-pass/syntax-extension-minor.rs b/src/test/run-pass/syntax-extension-minor.rs index f5f7f5564f6..50939997523 100644 --- a/src/test/run-pass/syntax-extension-minor.rs +++ b/src/test/run-pass/syntax-extension-minor.rs @@ -1,8 +1,8 @@ fn main() { let asdf_fdsa = "<.<"; - assert(#concat_idents[asd,f_f,dsa] == "<.<"); + assert (#concat_idents[asd, f_f, dsa] == "<.<"); - assert(#ident_to_str[use_mention_distinction] - == "use_mention_distinction"); + assert (#ident_to_str[use_mention_distinction] == + "use_mention_distinction"); } diff --git a/src/test/run-pass/tag.rs b/src/test/run-pass/tag.rs index 1ea470252f9..534ab1dc395 100644 --- a/src/test/run-pass/tag.rs +++ b/src/test/run-pass/tag.rs @@ -12,4 +12,4 @@ fn f() { } -fn main() { f(); } \ No newline at end of file +fn main() { f(); } diff --git a/src/test/run-pass/tail-call-arg-leak.rs b/src/test/run-pass/tail-call-arg-leak.rs index f771e9efc9b..b208d32009d 100644 --- a/src/test/run-pass/tail-call-arg-leak.rs +++ b/src/test/run-pass/tail-call-arg-leak.rs @@ -4,4 +4,4 @@ // use of tail calls causes arg slot leaks, issue #160. fn inner(dummy: str, b: bool) { if b { be inner(dummy, false); } } -fn main() { inner("hi", true); } \ No newline at end of file +fn main() { inner("hi", true); } diff --git a/src/test/run-pass/tail-cps.rs b/src/test/run-pass/tail-cps.rs index 81efa8f5502..a8a4436a2be 100644 --- a/src/test/run-pass/tail-cps.rs +++ b/src/test/run-pass/tail-cps.rs @@ -6,14 +6,14 @@ fn checktrue(rs: bool) -> bool { assert (rs); ret true; } fn main() { let k = checktrue; evenk(42, k); oddk(45, k); } -fn evenk(n: int, k: fn(bool) -> bool ) -> bool { +fn evenk(n: int, k: fn(bool) -> bool) -> bool { log "evenk"; log n; if n == 0 { be k(true); } else { be oddk(n - 1, k); } } -fn oddk(n: int, k: fn(bool) -> bool ) -> bool { +fn oddk(n: int, k: fn(bool) -> bool) -> bool { log "oddk"; log n; if n == 0 { be k(false); } else { be evenk(n - 1, k); } -} \ No newline at end of file +} diff --git a/src/test/run-pass/tail-direct.rs b/src/test/run-pass/tail-direct.rs index f0b50b07ce1..0bd771e7369 100644 --- a/src/test/run-pass/tail-direct.rs +++ b/src/test/run-pass/tail-direct.rs @@ -6,4 +6,4 @@ fn main() { assert (even(42)); assert (odd(45)); } fn even(n: int) -> bool { if n == 0 { ret true; } else { be odd(n - 1); } } -fn odd(n: int) -> bool { if n == 0 { ret false; } else { be even(n - 1); } } \ No newline at end of file +fn odd(n: int) -> bool { if n == 0 { ret false; } else { be even(n - 1); } } diff --git a/src/test/run-pass/task-comm-11.rs b/src/test/run-pass/task-comm-11.rs index ab994c7f378..35b30cda1a2 100644 --- a/src/test/run-pass/task-comm-11.rs +++ b/src/test/run-pass/task-comm-11.rs @@ -4,7 +4,7 @@ import std::comm; import std::task; fn start(c: comm::_chan<comm::_chan<int>>) { - let p : comm::_port<int> = comm::mk_port(); + let p: comm::_port<int> = comm::mk_port(); comm::send(c, p.mk_chan()); } diff --git a/src/test/run-pass/task-comm-13.rs b/src/test/run-pass/task-comm-13.rs index 2ae80750f45..7fb31f2d666 100644 --- a/src/test/run-pass/task-comm-13.rs +++ b/src/test/run-pass/task-comm-13.rs @@ -10,7 +10,7 @@ fn start(c: comm::_chan<int>, start: int, number_of_messages: int) { fn main() { log "Check that we don't deadlock."; - let p : comm::_port<int> = comm::mk_port(); + let p: comm::_port<int> = comm::mk_port(); let a = task::_spawn(bind start(p.mk_chan(), 0, 10)); task::join_id(a); log "Joined task"; diff --git a/src/test/run-pass/task-comm-15.rs b/src/test/run-pass/task-comm-15.rs index 84f3abe9b86..4ea320add2c 100644 --- a/src/test/run-pass/task-comm-15.rs +++ b/src/test/run-pass/task-comm-15.rs @@ -2,7 +2,7 @@ use std; import std::comm; import std::task; -fn start(c : comm::chan<int>, n: int) { +fn start(c: comm::chan<int>, n: int) { let i: int = n; while i > 0 { comm::send(c, 0); i = i - 1; } diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs index 9b43986e2ed..6ac2df9d94a 100644 --- a/src/test/run-pass/task-comm-16.rs +++ b/src/test/run-pass/task-comm-16.rs @@ -23,29 +23,29 @@ fn test_rec() { fn test_vec() { let po = comm::mk_port(); let ch = po.mk_chan(); - let v0: [int] = ~[0, 1, 2]; + let v0: [int] = [0, 1, 2]; send(ch, v0); let v1: [int]; v1 = po.recv(); - assert (v1.(0) == 0); - assert (v1.(1) == 1); - assert (v1.(2) == 2); + assert (v1[0] == 0); + assert (v1[1] == 1); + assert (v1[2] == 2); } fn test_str() { // FIXME: re-enable this once strings are unique and sendable -/* - let po = comm::mk_port(); - let ch = po.mk_chan(); - let s0: str = "test"; - send(ch, s0); - let s1: str; - s1 = po.recv(); - assert (s1.(0) as u8 == 't' as u8); - assert (s1.(1) as u8 == 'e' as u8); - assert (s1.(2) as u8 == 's' as u8); - assert (s1.(3) as u8 == 't' as u8); -*/ + /* + let po = comm::mk_port(); + let ch = po.mk_chan(); + let s0: str = "test"; + send(ch, s0); + let s1: str; + s1 = po.recv(); + assert (s1.(0) as u8 == 't' as u8); + assert (s1.(1) as u8 == 'e' as u8); + assert (s1.(2) as u8 == 's' as u8); + assert (s1.(3) as u8 == 't' as u8); + */ } fn test_tag() { @@ -80,10 +80,4 @@ fn test_chan() { assert (i == 10); } -fn main() { - test_rec(); - test_vec(); - test_str(); - test_tag(); - test_chan(); -} +fn main() { test_rec(); test_vec(); test_str(); test_tag(); test_chan(); } diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index ac3430aec3f..f8522282800 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -14,7 +14,7 @@ fn test00_start(ch: _chan<int>, message: int, count: int) { let i: int = 0; while i < count { log "Sending Message"; - send(ch, message+0); + send(ch, message + 0); i = i + 1; } log "Ending test00_start"; @@ -34,8 +34,7 @@ fn test00() { // Create and spawn tasks... let tasks = []; while i < number_of_tasks { - tasks += - [task::_spawn(bind test00_start(ch, i, number_of_messages))]; + tasks += [task::_spawn(bind test00_start(ch, i, number_of_messages))]; i = i + 1; } diff --git a/src/test/run-pass/task-comm-4.rs b/src/test/run-pass/task-comm-4.rs index 30342d877f0..b54020cbe0f 100644 --- a/src/test/run-pass/task-comm-4.rs +++ b/src/test/run-pass/task-comm-4.rs @@ -42,4 +42,4 @@ fn test00() { sum += r; log r; assert (sum == 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8); -} \ No newline at end of file +} diff --git a/src/test/run-pass/task-comm-5.rs b/src/test/run-pass/task-comm-5.rs index bb3a1e4dc70..dd07023b2e9 100644 --- a/src/test/run-pass/task-comm-5.rs +++ b/src/test/run-pass/task-comm-5.rs @@ -10,8 +10,8 @@ fn test00() { let c = p.mk_chan(); let number_of_messages: int = 1000; let i: int = 0; - while i < number_of_messages { comm::send(c, i+0); i += 1; } + while i < number_of_messages { comm::send(c, i + 0); i += 1; } i = 0; while i < number_of_messages { r = p.recv(); sum += r; i += 1; } assert (sum == number_of_messages * (number_of_messages - 1) / 2); -} \ No newline at end of file +} diff --git a/src/test/run-pass/task-comm-6.rs b/src/test/run-pass/task-comm-6.rs index 41dc6d203ad..036f96981ff 100644 --- a/src/test/run-pass/task-comm-6.rs +++ b/src/test/run-pass/task-comm-6.rs @@ -15,10 +15,10 @@ fn test00() { let number_of_messages: int = 1000; let i: int = 0; while i < number_of_messages { - send(c0, i+0); - send(c1, i+0); - send(c2, i+0); - send(c3, i+0); + send(c0, i + 0); + send(c1, i + 0); + send(c2, i + 0); + send(c3, i + 0); i += 1; } i = 0; @@ -37,4 +37,4 @@ fn test00() { // assert (sum == 4 * ((number_of_messages * // (number_of_messages - 1)) / 2)); -} \ No newline at end of file +} diff --git a/src/test/run-pass/task-comm-8.rs b/src/test/run-pass/task-comm-8.rs index 649e23f9806..0acff8cc022 100644 --- a/src/test/run-pass/task-comm-8.rs +++ b/src/test/run-pass/task-comm-8.rs @@ -4,7 +4,7 @@ import std::comm; fn main() { test00(); } -fn test00_start(c : comm::_chan<int>, start: int, number_of_messages: int) { +fn test00_start(c: comm::_chan<int>, start: int, number_of_messages: int) { let i: int = 0; while i < number_of_messages { comm::send(c, start + i); i += 1; } } diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index a197ebdf507..46dd1d89e51 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -6,7 +6,7 @@ fn main() { test00(); } fn test00_start(c: comm::_chan<int>, number_of_messages: int) { let i: int = 0; - while i < number_of_messages { comm::send(c, i+0); i += 1; } + while i < number_of_messages { comm::send(c, i + 0); i += 1; } } fn test00() { @@ -15,8 +15,7 @@ fn test00() { let p = comm::mk_port(); let number_of_messages: int = 10; - let t0 = task::_spawn(bind test00_start(p.mk_chan(), - number_of_messages)); + let t0 = task::_spawn(bind test00_start(p.mk_chan(), number_of_messages)); let i: int = 0; while i < number_of_messages { r = p.recv(); sum += r; log r; i += 1; } diff --git a/src/test/run-pass/task-comm.rs b/src/test/run-pass/task-comm.rs index c468d1c89d6..f5a6a111608 100644 --- a/src/test/run-pass/task-comm.rs +++ b/src/test/run-pass/task-comm.rs @@ -20,7 +20,11 @@ fn main() { fn test00_start(ch: _chan<int>, message: int, count: int) { log "Starting test00_start"; let i: int = 0; - while i < count { log "Sending Message"; send(ch, message+0); i = i + 1; } + while i < count { + log "Sending Message"; + send(ch, message + 0); + i = i + 1; + } log "Ending test00_start"; } @@ -39,22 +43,19 @@ fn test00() { i = i + 1; tasks += [task::spawn(bind test00_start(ch, i, number_of_messages))]; } - let sum: int = 0; for t: task_id in tasks { i = 0; - while i < number_of_messages { - sum += po.recv(); - i = i + 1; - } + while i < number_of_messages { sum += po.recv(); i = i + 1; } } for t: task_id in tasks { task::join_id(t); } log "Completed: Final number is: "; assert (sum == - number_of_messages * - (number_of_tasks * number_of_tasks + number_of_tasks) / 2); + number_of_messages * + (number_of_tasks * number_of_tasks + number_of_tasks) / + 2); } fn test01() { @@ -96,11 +97,7 @@ fn test04_start() { fn test04() { log "Spawning lots of tasks."; let i: int = 4; - while i > 0 { - i = i - 1; - let f = test04_start; - task::spawn(f); - } + while i > 0 { i = i - 1; let f = test04_start; task::spawn(f); } log "Finishing up."; } @@ -138,7 +135,9 @@ fn test06() { let tasks = []; while i < number_of_tasks { - i = i + 1; tasks += [task::spawn(bind test06_start(i))]; } + i = i + 1; + tasks += [task::spawn(bind test06_start(i))]; + } for t: task_id in tasks { task::join_id(t); } diff --git a/src/test/run-pass/task-pin.rs b/src/test/run-pass/task-pin.rs index a6592b885eb..407914dba2d 100644 --- a/src/test/run-pass/task-pin.rs +++ b/src/test/run-pass/task-pin.rs @@ -7,4 +7,4 @@ use std; import std::task; -fn main() { task::pin(); task::unpin(); } \ No newline at end of file +fn main() { task::pin(); task::unpin(); } diff --git a/src/test/run-pass/ternary.rs b/src/test/run-pass/ternary.rs index 9c2aaf4ac4e..6adfada2c90 100644 --- a/src/test/run-pass/ternary.rs +++ b/src/test/run-pass/ternary.rs @@ -40,4 +40,4 @@ fn main() { test_associativity(); test_lval(); test_as_stmt(); -} \ No newline at end of file +} diff --git a/src/test/run-pass/test-runner-hides-main.rs b/src/test/run-pass/test-runner-hides-main.rs index 2edf36d1762..997664aa9c0 100644 --- a/src/test/run-pass/test-runner-hides-main.rs +++ b/src/test/run-pass/test-runner-hides-main.rs @@ -5,4 +5,4 @@ use std; // Building as a test runner means that a synthetic main will be run, // not ours -fn main() { fail; } \ No newline at end of file +fn main() { fail; } diff --git a/src/test/run-pass/threads.rs b/src/test/run-pass/threads.rs index 47982d12b90..aa999eb420d 100644 --- a/src/test/run-pass/threads.rs +++ b/src/test/run-pass/threads.rs @@ -4,15 +4,10 @@ use std; import std::task; fn main() { - let i = 10; - while (i > 0) { - task::_spawn(bind child(i)); - i = i - 1; - } - log "main thread exiting"; + let i = 10; + while i > 0 { task::_spawn(bind child(i)); i = i - 1; } + log "main thread exiting"; } -fn child(x : int) { - log x; -} +fn child(x: int) { log x; } diff --git a/src/test/run-pass/tup.rs b/src/test/run-pass/tup.rs index ab34e75a460..b12099b414a 100644 --- a/src/test/run-pass/tup.rs +++ b/src/test/run-pass/tup.rs @@ -15,4 +15,4 @@ fn main() { let p2: point = p; f(p, 10, 20); f(p2, 10, 20); -} \ No newline at end of file +} diff --git a/src/test/run-pass/type-in-nested-module.rs b/src/test/run-pass/type-in-nested-module.rs index 2c91b35099e..059f22ba15c 100644 --- a/src/test/run-pass/type-in-nested-module.rs +++ b/src/test/run-pass/type-in-nested-module.rs @@ -8,4 +8,4 @@ mod a { } } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/type-namespace.rs b/src/test/run-pass/type-namespace.rs index f173ec0a69d..03c8ce0972a 100644 --- a/src/test/run-pass/type-namespace.rs +++ b/src/test/run-pass/type-namespace.rs @@ -2,4 +2,4 @@ type a = {a: int}; fn a(a: a) -> int { ret a.a; } -fn main() { let x: a = {a: 1}; assert (a(x) == 1); } \ No newline at end of file +fn main() { let x: a = {a: 1}; assert (a(x) == 1); } diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index e1c80d31fb7..a5ea4c223d4 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -1,6 +1,6 @@ -fn p_foo<T>(pinned: &T) { } -fn s_foo<@T>(shared: &T) { } -fn u_foo<~T>(unique: &T) { } +fn p_foo<T>(pinned: &T) { } +fn s_foo<@T>(shared: &T) { } +fn u_foo<~T>(unique: &T) { } resource r(i: int) { } diff --git a/src/test/run-pass/type-param.rs b/src/test/run-pass/type-param.rs index 36ef46420a9..be55ba86cac 100644 --- a/src/test/run-pass/type-param.rs +++ b/src/test/run-pass/type-param.rs @@ -1,5 +1,5 @@ -type lteq<T> = fn(&T) -> bool ; +type lteq<T> = fn(&T) -> bool; fn main(args: [str]) { } diff --git a/src/test/run-pass/type-params-in-for-each.rs b/src/test/run-pass/type-params-in-for-each.rs index b8e2f5fc8a8..760e5dadfa1 100644 --- a/src/test/run-pass/type-params-in-for-each.rs +++ b/src/test/run-pass/type-params-in-for-each.rs @@ -5,8 +5,8 @@ iter range(lo: uint, hi: uint) -> uint { while lo_ < hi { put lo_; lo_ += 1u; } } -fn create_index<T>(index: &[{a: T, b: uint}], hash_fn: fn(&T) -> uint ) { - for each i: uint in range(0u, 256u) { let bucket: [T] = ~[]; } +fn create_index<T>(index: &[{a: T, b: uint}], hash_fn: fn(&T) -> uint) { + for each i: uint in range(0u, 256u) { let bucket: [T] = []; } } fn main() { } diff --git a/src/test/run-pass/typestate-cfg-nesting.rs b/src/test/run-pass/typestate-cfg-nesting.rs index 52702922764..ccde41545d9 100644 --- a/src/test/run-pass/typestate-cfg-nesting.rs +++ b/src/test/run-pass/typestate-cfg-nesting.rs @@ -6,4 +6,4 @@ fn main() { let x = 10; let y = 11; if true { while false { y = x; } } else { } -} \ No newline at end of file +} diff --git a/src/test/run-pass/typestate-multi-decl.rs b/src/test/run-pass/typestate-multi-decl.rs index b0da5a7b226..18698226379 100644 --- a/src/test/run-pass/typestate-multi-decl.rs +++ b/src/test/run-pass/typestate-multi-decl.rs @@ -1,5 +1 @@ -fn main() { - let x = 10, y = 20; - let z = x + y; - assert (z == 30); -} +fn main() { let x = 10, y = 20; let z = x + y; assert (z == 30); } diff --git a/src/test/run-pass/typestate-transitive.rs b/src/test/run-pass/typestate-transitive.rs index f2eda37e0d0..021dd7554b7 100644 --- a/src/test/run-pass/typestate-transitive.rs +++ b/src/test/run-pass/typestate-transitive.rs @@ -4,4 +4,4 @@ fn f(i: int) : p(i) -> int { i } fn g(i: int) : p(i) -> int { f(i) } -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/u32-decr.rs b/src/test/run-pass/u32-decr.rs index ba7af14dbce..d258effa663 100644 --- a/src/test/run-pass/u32-decr.rs +++ b/src/test/run-pass/u32-decr.rs @@ -6,4 +6,4 @@ fn main() { let word: u32 = 200000u32; word = word - 1u32; assert (word == 199999u32); -} \ No newline at end of file +} diff --git a/src/test/run-pass/u8-incr-decr.rs b/src/test/run-pass/u8-incr-decr.rs index 8562a87c1a0..91bf0f9945e 100644 --- a/src/test/run-pass/u8-incr-decr.rs +++ b/src/test/run-pass/u8-incr-decr.rs @@ -15,4 +15,4 @@ fn main() { y = y - 9u8; // 0x9 assert (x == y); -} \ No newline at end of file +} diff --git a/src/test/run-pass/u8-incr.rs b/src/test/run-pass/u8-incr.rs index c1f0ee37c13..66304d33072 100644 --- a/src/test/run-pass/u8-incr.rs +++ b/src/test/run-pass/u8-incr.rs @@ -11,4 +11,4 @@ fn main() { // x = 14u8; // x = x + 1u8; -} \ No newline at end of file +} diff --git a/src/test/run-pass/uint.rs b/src/test/run-pass/uint.rs index 8e5795e0b6d..2083979b0ac 100644 --- a/src/test/run-pass/uint.rs +++ b/src/test/run-pass/uint.rs @@ -2,4 +2,4 @@ // -*- rust -*- -fn main() { let x: uint = 10 as uint; } \ No newline at end of file +fn main() { let x: uint = 10 as uint; } diff --git a/src/test/run-pass/unify-return-ty.rs b/src/test/run-pass/unify-return-ty.rs index 0538618ff88..5bfdeb33847 100644 --- a/src/test/run-pass/unify-return-ty.rs +++ b/src/test/run-pass/unify-return-ty.rs @@ -6,6 +6,4 @@ import std::unsafe; fn null<T>() -> *T { unsafe::reinterpret_cast(0) } -fn main() { - null::<int>(); -} +fn main() { null::<int>(); } diff --git a/src/test/run-pass/unit.rs b/src/test/run-pass/unit.rs index 6b944d59c5d..815c760dfaa 100644 --- a/src/test/run-pass/unit.rs +++ b/src/test/run-pass/unit.rs @@ -4,4 +4,4 @@ // -*- rust -*- fn f(u: ()) { ret u; } -fn main() { let u1: () = (); let u2: () = f(u1); u2 = (); ret (); } \ No newline at end of file +fn main() { let u1: () = (); let u2: () = f(u1); u2 = (); ret (); } diff --git a/src/test/run-pass/use-import-export.rs b/src/test/run-pass/use-import-export.rs index 56b99e2c95f..99b87578d8d 100644 --- a/src/test/run-pass/use-import-export.rs +++ b/src/test/run-pass/use-import-export.rs @@ -8,4 +8,4 @@ mod bar { fn y() -> int { ret 1; } } -fn main() { foo::x(); bar::y(); } \ No newline at end of file +fn main() { foo::x(); bar::y(); } diff --git a/src/test/run-pass/utf8.rs b/src/test/run-pass/utf8.rs index e7dc2780612..c27d7a23c0a 100644 --- a/src/test/run-pass/utf8.rs +++ b/src/test/run-pass/utf8.rs @@ -34,7 +34,7 @@ fn main() { for ab: u8 in a { log i; log ab; - let bb: u8 = b.(i); + let bb: u8 = b[i]; log bb; assert (ab == bb); i += 1; diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index c94cef4bba3..e7f7f9a1524 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -4,7 +4,7 @@ import std::vec; fn main() { // Chars of 1, 2, 3, and 4 bytes - let chs: [char] = ~['e', 'é', '€', 0x10000 as char]; + let chs: [char] = ['e', 'é', '€', 0x10000 as char]; let s: str = str::from_chars(chs); assert (str::byte_len(s) == 10u); @@ -15,9 +15,9 @@ fn main() { assert (str::char_at(s, 1u) == 'é'); assert (str::is_utf8(str::bytes(s))); - assert (!str::is_utf8(~[0x80_u8])); - assert (!str::is_utf8(~[0xc0_u8])); - assert (!str::is_utf8(~[0xc0_u8, 0x10_u8])); + assert (!str::is_utf8([0x80_u8])); + assert (!str::is_utf8([0xc0_u8])); + assert (!str::is_utf8([0xc0_u8, 0x10_u8])); let stack = "a×c€"; assert (str::pop_char(stack) == '€'); diff --git a/src/test/run-pass/vec-append.rs b/src/test/run-pass/vec-append.rs index 68076d41287..c045aa1e49f 100644 --- a/src/test/run-pass/vec-append.rs +++ b/src/test/run-pass/vec-append.rs @@ -10,26 +10,26 @@ import std::vec; const const_refcount: uint = 0x7bad_face_u; fn fast_growth() { - let v: [int] = ~[1, 2, 3, 4, 5]; - v += ~[6, 7, 8, 9, 0]; - log v.(9); - assert (v.(0) == 1); - assert (v.(7) == 8); - assert (v.(9) == 0); + let v: [int] = [1, 2, 3, 4, 5]; + v += [6, 7, 8, 9, 0]; + log v[9]; + assert (v[0] == 1); + assert (v[7] == 8); + assert (v[9] == 0); } fn slow_growth() { - let v: [int] = ~[]; + let v: [int] = []; let u: [int] = v; - v += ~[17]; - log v.(0); - assert (v.(0) == 17); + v += [17]; + log v[0]; + assert (v[0] == 17); } fn slow_growth2_helper(s: str) { // ref up: s obj acc(mutable v: [str]) { - fn add(s: &str) { v += ~[s]; } + fn add(s: &str) { v += [s]; } } let ss: str = s; // ref up: s @@ -46,7 +46,7 @@ fn slow_growth2_helper(s: str) { // ref up: s * mumble, the existing str in the originally- shared vec. */ - let v: [str] = ~[mumble]; // ref up: mumble + let v: [str] = [mumble]; // ref up: mumble let a: acc = acc(v); @@ -56,9 +56,9 @@ fn slow_growth2_helper(s: str) { // ref up: s log str::refcount(mumble); assert (str::refcount(s) == const_refcount); assert (str::refcount(mumble) == const_refcount); - log v.(0); + log v[0]; log vec::len::<str>(v); - assert (str::eq(v.(0), mumble)); + assert (str::eq(v[0], mumble)); assert (vec::len::<str>(v) == 1u); } // ref down: mumble, s, diff --git a/src/test/run-pass/vec-concat.rs b/src/test/run-pass/vec-concat.rs index 2804f8c0f10..e107d861a2a 100644 --- a/src/test/run-pass/vec-concat.rs +++ b/src/test/run-pass/vec-concat.rs @@ -3,11 +3,11 @@ // -*- rust -*- fn main() { - let a: [int] = ~[1, 2, 3, 4, 5]; - let b: [int] = ~[6, 7, 8, 9, 0]; + let a: [int] = [1, 2, 3, 4, 5]; + let b: [int] = [6, 7, 8, 9, 0]; let v: [int] = a + b; - log v.(9); - assert (v.(0) == 1); - assert (v.(7) == 8); - assert (v.(9) == 0); + log v[9]; + assert (v[0] == 1); + assert (v[7] == 8); + assert (v[9] == 0); } diff --git a/src/test/run-pass/vec-drop.rs b/src/test/run-pass/vec-drop.rs index dbd0bbcd82c..499b24d43f0 100644 --- a/src/test/run-pass/vec-drop.rs +++ b/src/test/run-pass/vec-drop.rs @@ -4,5 +4,5 @@ fn main() { // This just tests whether the vec leaks its members. let pvec: [@{x: int, y: int}] = - ~[@{x: 1, y: 2}, @{x: 3, y: 4}, @{x: 5, y: 6}]; + [@{x: 1, y: 2}, @{x: 3, y: 4}, @{x: 5, y: 6}]; } diff --git a/src/test/run-pass/vec-growth.rs b/src/test/run-pass/vec-growth.rs index c91d360c88b..7835b82c4d7 100644 --- a/src/test/run-pass/vec-growth.rs +++ b/src/test/run-pass/vec-growth.rs @@ -1,14 +1,14 @@ fn main() { - let v = ~[1]; - v += ~[2]; - v += ~[3]; - v += ~[4]; - v += ~[5]; - assert (v.(0) == 1); - assert (v.(1) == 2); - assert (v.(2) == 3); - assert (v.(3) == 4); - assert (v.(4) == 5); -} \ No newline at end of file + let v = [1]; + v += [2]; + v += [3]; + v += [4]; + v += [5]; + assert (v[0] == 1); + assert (v[1] == 2); + assert (v[2] == 3); + assert (v[3] == 4); + assert (v[4] == 5); +} diff --git a/src/test/run-pass/vec-ivec-deadlock.rs b/src/test/run-pass/vec-ivec-deadlock.rs index 2dae6e3fcb4..7c0515ce48b 100644 --- a/src/test/run-pass/vec-ivec-deadlock.rs +++ b/src/test/run-pass/vec-ivec-deadlock.rs @@ -1 +1 @@ -fn main() { let a = ~[1, 2, 3, 4, 5]; let b = ~[a, a]; b += b; } \ No newline at end of file +fn main() { let a = [1, 2, 3, 4, 5]; let b = [a, a]; b += b; } diff --git a/src/test/run-pass/vec-late-init.rs b/src/test/run-pass/vec-late-init.rs index c1f180ed237..6a84317747c 100644 --- a/src/test/run-pass/vec-late-init.rs +++ b/src/test/run-pass/vec-late-init.rs @@ -2,6 +2,6 @@ fn main() { let later: [int]; - if true { later = ~[1]; } else { later = ~[2]; } - log later.(0); + if true { later = [1]; } else { later = [2]; } + log later[0]; } diff --git a/src/test/run-pass/vec-push.rs b/src/test/run-pass/vec-push.rs index 6e54bd7467e..c2f49311b1e 100644 --- a/src/test/run-pass/vec-push.rs +++ b/src/test/run-pass/vec-push.rs @@ -1,5 +1,5 @@ -fn push<T>(v: &mutable [mutable? T], t: &T) { v += ~[t]; } +fn push<T>(v: &mutable [mutable? T], t: &T) { v += [t]; } -fn main() { let v = ~[1, 2, 3]; push(v, 1); } +fn main() { let v = [1, 2, 3]; push(v, 1); } diff --git a/src/test/run-pass/vec.rs b/src/test/run-pass/vec.rs index eef478a372e..95025f5b3cb 100644 --- a/src/test/run-pass/vec.rs +++ b/src/test/run-pass/vec.rs @@ -3,8 +3,8 @@ // -*- rust -*- fn main() { - let v: [int] = ~[10, 20]; - assert (v[0]== 10); + let v: [int] = [10, 20]; + assert (v[0] == 10); assert (v[1] == 20); let x: int = 0; assert (v[x] == 10); diff --git a/src/test/run-pass/vector-no-ann-2.rs b/src/test/run-pass/vector-no-ann-2.rs index d2555618281..10a9cd9c6b8 100644 --- a/src/test/run-pass/vector-no-ann-2.rs +++ b/src/test/run-pass/vector-no-ann-2.rs @@ -1 +1 @@ -fn main() { let quux: @[uint] = @~[]; } +fn main() { let quux: @[uint] = @[]; } diff --git a/src/test/run-pass/while-and-do-while.rs b/src/test/run-pass/while-and-do-while.rs index 3287791a7c0..c5b09cb8149 100644 --- a/src/test/run-pass/while-and-do-while.rs +++ b/src/test/run-pass/while-and-do-while.rs @@ -5,4 +5,4 @@ fn main() { let y: int = 0; while y < x { log y; log "hello"; y = y + 1; } do { log "goodbye"; x = x - 1; log x; } while x > 0 -} \ No newline at end of file +} diff --git a/src/test/run-pass/while-flow-graph.rs b/src/test/run-pass/while-flow-graph.rs index bf1840638de..2813cee0cd0 100644 --- a/src/test/run-pass/while-flow-graph.rs +++ b/src/test/run-pass/while-flow-graph.rs @@ -1,3 +1,3 @@ -fn main() { let x: int = 10; while x == 10 && x == 11 { let y = 0xf00; } } \ No newline at end of file +fn main() { let x: int = 10; while x == 10 && x == 11 { let y = 0xf00; } } diff --git a/src/test/run-pass/while-loop-constraints-2.rs b/src/test/run-pass/while-loop-constraints-2.rs index e124ed58042..29ab411b31b 100644 --- a/src/test/run-pass/while-loop-constraints-2.rs +++ b/src/test/run-pass/while-loop-constraints-2.rs @@ -5,4 +5,4 @@ fn main() { let x: int; while z < 50 { z += 1; while false { x <- y; y = z; } log y; } assert (y == 42 && z == 50); -} \ No newline at end of file +} diff --git a/src/test/run-pass/while-prelude-drop.rs b/src/test/run-pass/while-prelude-drop.rs index badd2ae10bf..9688c436370 100644 --- a/src/test/run-pass/while-prelude-drop.rs +++ b/src/test/run-pass/while-prelude-drop.rs @@ -16,4 +16,4 @@ fn main() { // The auto slot for the result of make(i) should not leak. while make(i) != a { i += 1; } -} \ No newline at end of file +} diff --git a/src/test/run-pass/while-with-break.rs b/src/test/run-pass/while-with-break.rs index 3dcbb96b040..f8050e3d3eb 100644 --- a/src/test/run-pass/while-with-break.rs +++ b/src/test/run-pass/while-with-break.rs @@ -9,7 +9,7 @@ fn main() { i = i + 1; if i == 95 { let v: [int] = - ~[1, 2, 3, 4, 5]; // we check that it is freed by break + [1, 2, 3, 4, 5]; // we check that it is freed by break log "breaking"; break; diff --git a/src/test/run-pass/wierd-exprs.rs b/src/test/run-pass/wierd-exprs.rs index a8276c92bb6..de1613c4363 100644 --- a/src/test/run-pass/wierd-exprs.rs +++ b/src/test/run-pass/wierd-exprs.rs @@ -1,11 +1,9 @@ // Just a grab bug of stuff that you wouldn't want to actualy write -fn strange() -> bool { - let _x = ret true; -} +fn strange() -> bool { let _x = ret true; } fn funny() { - fn f(_x: ()) {} + fn f(_x: ()) { } f(ret); } @@ -15,21 +13,16 @@ fn odd() { } fn what() { - fn the(x: @mutable bool){ - ret while !*x { *x = true }; - } + fn the(x: @mutable bool) { ret while !*x { *x = true }; } let i = @mutable false; let dont = bind the(i); dont(); - assert *i; + assert (*i); } fn zombiejesus() { - do { while (ret) { if (ret) { - alt (ret) { _ { - ret ? ret : ret - }} - }}} while ret; + do { while (ret) { if (ret) { alt (ret) { _ { ret ? ret : ret } } } } } + while ret } fn notsure() { @@ -48,27 +41,18 @@ fn hammertime() -> int { fn canttouchthis() -> uint { pred p() -> bool { true } - let _a = (assert true) == (check p()); - let _c = (check p()) == (); + let _a = (assert (true)) == (check (p())); + let _c = (check (p())) == (); let _b = (log 0) == (ret 0u); } fn angrydome() { - while true { - if (break) { } - } + while true { if break { } } let i = 0; - do { - i += 1; - if i == 1 { - alt cont { _ { } } - } - } while false; + do { i += 1; if i == 1 { alt cont { _ { } } } } while false } -fn evil_lincoln() { - let evil <- log "lincoln"; -} +fn evil_lincoln() { let evil <- log "lincoln"; } fn main() { strange(); diff --git a/src/test/run-pass/writealias.rs b/src/test/run-pass/writealias.rs index 0f779478533..fb7bf4c163a 100644 --- a/src/test/run-pass/writealias.rs +++ b/src/test/run-pass/writealias.rs @@ -10,4 +10,4 @@ fn main() { let x: point = {x: 10, y: 11, mutable z: 12}; f(x); assert (x.z == 13); -} \ No newline at end of file +} diff --git a/src/test/run-pass/x86stdcall.rs b/src/test/run-pass/x86stdcall.rs index dcc525d652f..52f9d47cd78 100644 --- a/src/test/run-pass/x86stdcall.rs +++ b/src/test/run-pass/x86stdcall.rs @@ -14,4 +14,4 @@ fn main() { #[cfg(target_os = "macos")] #[cfg(target_os = "linux")] -fn main() { } \ No newline at end of file +fn main() { } diff --git a/src/test/run-pass/yield.rs b/src/test/run-pass/yield.rs index 8de4b6c411f..dd8d2a046b7 100644 --- a/src/test/run-pass/yield.rs +++ b/src/test/run-pass/yield.rs @@ -14,4 +14,4 @@ fn main() { join_id(other); } -fn child() { log_err "4"; yield(); log_err "5"; yield(); log_err "6"; } \ No newline at end of file +fn child() { log_err "4"; yield(); log_err "5"; yield(); log_err "6"; } diff --git a/src/test/run-pass/yield1.rs b/src/test/run-pass/yield1.rs index e53591dbe1a..9f5c326cc38 100644 --- a/src/test/run-pass/yield1.rs +++ b/src/test/run-pass/yield1.rs @@ -6,7 +6,8 @@ import std::task::*; fn main() { let c = child; let other = task::spawn(c); - log_err "1"; yield(); + log_err "1"; + yield(); join_id(other); } diff --git a/src/test/stdtest/bitv.rs b/src/test/stdtest/bitv.rs index 7666063239d..249a43be13b 100644 --- a/src/test/stdtest/bitv.rs +++ b/src/test/stdtest/bitv.rs @@ -18,9 +18,9 @@ fn test_0_elements() { fn test_1_element() { let act; act = bitv::create(1u, false); - assert (bitv::eq_vec(act, ~[0u])); + assert (bitv::eq_vec(act, [0u])); act = bitv::create(1u, true); - assert (bitv::eq_vec(act, ~[1u])); + assert (bitv::eq_vec(act, [1u])); } #[test] @@ -29,11 +29,11 @@ fn test_10_elements() { // all 0 act = bitv::create(10u, false); - assert (bitv::eq_vec(act, ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u])); + assert (bitv::eq_vec(act, [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u])); // all 1 act = bitv::create(10u, true); - assert (bitv::eq_vec(act, ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u])); + assert (bitv::eq_vec(act, [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(10u, false); @@ -42,7 +42,7 @@ fn test_10_elements() { bitv::set(act, 2u, true); bitv::set(act, 3u, true); bitv::set(act, 4u, true); - assert (bitv::eq_vec(act, ~[1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u])); + assert (bitv::eq_vec(act, [1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(10u, false); @@ -51,7 +51,7 @@ fn test_10_elements() { bitv::set(act, 7u, true); bitv::set(act, 8u, true); bitv::set(act, 9u, true); - assert (bitv::eq_vec(act, ~[0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u])); + assert (bitv::eq_vec(act, [0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(10u, false); @@ -59,7 +59,7 @@ fn test_10_elements() { bitv::set(act, 3u, true); bitv::set(act, 6u, true); bitv::set(act, 9u, true); - assert (bitv::eq_vec(act, ~[1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u])); + assert (bitv::eq_vec(act, [1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u])); } #[test] @@ -69,16 +69,16 @@ fn test_31_elements() { act = bitv::create(31u, false); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u])); // all 1 act = bitv::create(31u, true); assert (bitv::eq_vec(act, - ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u])); + [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(31u, false); @@ -91,9 +91,9 @@ fn test_31_elements() { bitv::set(act, 6u, true); bitv::set(act, 7u, true); assert (bitv::eq_vec(act, - ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u])); + [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(31u, false); @@ -106,9 +106,9 @@ fn test_31_elements() { bitv::set(act, 22u, true); bitv::set(act, 23u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(31u, false); @@ -120,9 +120,9 @@ fn test_31_elements() { bitv::set(act, 29u, true); bitv::set(act, 30u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(31u, false); @@ -130,9 +130,9 @@ fn test_31_elements() { bitv::set(act, 17u, true); bitv::set(act, 30u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 1u])); + [0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 1u])); } #[test] @@ -142,16 +142,16 @@ fn test_32_elements() { act = bitv::create(32u, false); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u])); // all 1 act = bitv::create(32u, true); assert (bitv::eq_vec(act, - ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u])); + [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(32u, false); @@ -164,9 +164,9 @@ fn test_32_elements() { bitv::set(act, 6u, true); bitv::set(act, 7u, true); assert (bitv::eq_vec(act, - ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u])); + [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(32u, false); @@ -179,9 +179,9 @@ fn test_32_elements() { bitv::set(act, 22u, true); bitv::set(act, 23u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(32u, false); @@ -194,9 +194,9 @@ fn test_32_elements() { bitv::set(act, 30u, true); bitv::set(act, 31u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(32u, false); @@ -205,9 +205,9 @@ fn test_32_elements() { bitv::set(act, 30u, true); bitv::set(act, 31u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 1u, 1u])); + [0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 1u, 1u])); } #[test] @@ -217,16 +217,16 @@ fn test_33_elements() { act = bitv::create(33u, false); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u])); // all 1 act = bitv::create(33u, true); assert (bitv::eq_vec(act, - ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u, 1u])); + [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u, 1u])); // mixed act = bitv::create(33u, false); @@ -239,9 +239,9 @@ fn test_33_elements() { bitv::set(act, 6u, true); bitv::set(act, 7u, true); assert (bitv::eq_vec(act, - ~[1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u])); + [1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(33u, false); @@ -254,9 +254,9 @@ fn test_33_elements() { bitv::set(act, 22u, true); bitv::set(act, 23u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 1u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u])); // mixed act = bitv::create(33u, false); @@ -269,9 +269,9 @@ fn test_33_elements() { bitv::set(act, 30u, true); bitv::set(act, 31u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, - 1u, 1u, 1u, 1u, 1u, 1u, 0u])); + [0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, + 1u, 1u, 1u, 1u, 1u, 1u, 0u])); // mixed act = bitv::create(33u, false); @@ -281,8 +281,8 @@ fn test_33_elements() { bitv::set(act, 31u, true); bitv::set(act, 32u, true); assert (bitv::eq_vec(act, - ~[0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, - 0u, 0u, 0u, 0u, 1u, 1u, 1u])); + [0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 1u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, 0u, + 0u, 0u, 0u, 0u, 1u, 1u, 1u])); } diff --git a/src/test/stdtest/comm.rs b/src/test/stdtest/comm.rs index 7d20042e866..6b67acc51ea 100644 --- a/src/test/stdtest/comm.rs +++ b/src/test/stdtest/comm.rs @@ -15,7 +15,7 @@ fn send_recv() { comm::send(c, 42); let v = p.recv(); log_err v; - assert(42 == v); + assert (42 == v); } #[test] @@ -23,7 +23,7 @@ fn send_recv_fn() { let p = comm::port::<int>(); let c = comm::chan::<int>(p); comm::send(c, 42); - assert(comm::recv(p) == 42); + assert (comm::recv(p) == 42); } #[test] @@ -31,7 +31,7 @@ fn send_recv_fn_infer() { let p = comm::port(); let c = comm::chan(p); comm::send(c, 42); - assert(comm::recv(p) == 42); + assert (comm::recv(p) == 42); } #[test] diff --git a/src/test/stdtest/deque.rs b/src/test/stdtest/deque.rs index d751bd5c45d..acdde57b86e 100644 --- a/src/test/stdtest/deque.rs +++ b/src/test/stdtest/deque.rs @@ -79,7 +79,7 @@ fn test_boxes(a: @int, b: @int, c: @int, d: @int) { assert (deq.get(3) == d); } -type eqfn<T> = fn(&T, &T) -> bool ; +type eqfn<T> = fn(&T, &T) -> bool; fn test_parameterized<@T>(e: eqfn<T>, a: &T, b: &T, c: &T, d: &T) { let deq: deque::t<T> = deque::create::<T>(); @@ -175,15 +175,14 @@ fn test() { log "test parameterized: taggy"; let eq3: eqfn<taggy> = taggyeq; test_parameterized::<taggy>(eq3, one(1), two(1, 2), three(1, 2, 3), - two(17, 42)); + two(17, 42)); log "*** test parameterized: taggypar<int>"; let eq4: eqfn<taggypar<int>> = taggypareq::<int>; - test_parameterized::<taggypar<int>>(eq4, - onepar::<int>(1), - twopar::<int>(1, 2), - threepar::<int>(1, 2, 3), - twopar::<int>(17, 42)); + test_parameterized::<taggypar<int>>(eq4, onepar::<int>(1), + twopar::<int>(1, 2), + threepar::<int>(1, 2, 3), + twopar::<int>(17, 42)); log "*** end test parameterized: taggypar::<int>"; log "*** test parameterized: reccy"; diff --git a/src/test/stdtest/either.rs b/src/test/stdtest/either.rs index 21b8184f496..82724b1c09a 100644 --- a/src/test/stdtest/either.rs +++ b/src/test/stdtest/either.rs @@ -20,60 +20,60 @@ fn test_either_right() { #[test] fn test_lefts() { - let input = ~[left(10), right(11), left(12), right(13), left(14)]; + let input = [left(10), right(11), left(12), right(13), left(14)]; let result = lefts(input); - assert (result == ~[10, 12, 14]); + assert (result == [10, 12, 14]); } #[test] fn test_lefts_none() { - let input: [t<int, int>] = ~[right(10), right(10)]; + let input: [t<int, int>] = [right(10), right(10)]; let result = lefts(input); assert (len(result) == 0u); } #[test] fn test_lefts_empty() { - let input: [t<int, int>] = ~[]; + let input: [t<int, int>] = []; let result = lefts(input); assert (len(result) == 0u); } #[test] fn test_rights() { - let input = ~[left(10), right(11), left(12), right(13), left(14)]; + let input = [left(10), right(11), left(12), right(13), left(14)]; let result = rights(input); - assert (result == ~[11, 13]); + assert (result == [11, 13]); } #[test] fn test_rights_none() { - let input: [t<int, int>] = ~[left(10), left(10)]; + let input: [t<int, int>] = [left(10), left(10)]; let result = rights(input); assert (len(result) == 0u); } #[test] fn test_rights_empty() { - let input: [t<int, int>] = ~[]; + let input: [t<int, int>] = []; let result = rights(input); assert (len(result) == 0u); } #[test] fn test_partition() { - let input = ~[left(10), right(11), left(12), right(13), left(14)]; + let input = [left(10), right(11), left(12), right(13), left(14)]; let result = partition(input); - assert (result.lefts.(0) == 10); - assert (result.lefts.(1) == 12); - assert (result.lefts.(2) == 14); - assert (result.rights.(0) == 11); - assert (result.rights.(1) == 13); + assert (result.lefts[0] == 10); + assert (result.lefts[1] == 12); + assert (result.lefts[2] == 14); + assert (result.rights[0] == 11); + assert (result.rights[1] == 13); } #[test] fn test_partition_no_lefts() { - let input: [t<int, int>] = ~[right(10), right(11)]; + let input: [t<int, int>] = [right(10), right(11)]; let result = partition(input); assert (len(result.lefts) == 0u); assert (len(result.rights) == 2u); @@ -81,7 +81,7 @@ fn test_partition_no_lefts() { #[test] fn test_partition_no_rights() { - let input: [t<int, int>] = ~[left(10), left(11)]; + let input: [t<int, int>] = [left(10), left(11)]; let result = partition(input); assert (len(result.lefts) == 2u); assert (len(result.rights) == 0u); @@ -89,7 +89,7 @@ fn test_partition_no_rights() { #[test] fn test_partition_empty() { - let input: [t<int, int>] = ~[]; + let input: [t<int, int>] = []; let result = partition(input); assert (len(result.lefts) == 0u); assert (len(result.rights) == 0u); diff --git a/src/test/stdtest/getopts.rs b/src/test/stdtest/getopts.rs index 10acbafcb12..55d67729129 100644 --- a/src/test/stdtest/getopts.rs +++ b/src/test/stdtest/getopts.rs @@ -27,8 +27,8 @@ fn check_fail_type(f: opt::fail_, ft: fail_type) { // Tests for reqopt #[test] fn test_reqopt_long() { - let args = ~["--test=20"]; - let opts = ~[opt::reqopt("test")]; + let args = ["--test=20"]; + let opts = [opt::reqopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { @@ -41,8 +41,8 @@ fn test_reqopt_long() { #[test] fn test_reqopt_long_missing() { - let args = ~["blah"]; - let opts = ~[opt::reqopt("test")]; + let args = ["blah"]; + let opts = [opt::reqopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_missing); } @@ -52,8 +52,8 @@ fn test_reqopt_long_missing() { #[test] fn test_reqopt_long_no_arg() { - let args = ~["--test"]; - let opts = ~[opt::reqopt("test")]; + let args = ["--test"]; + let opts = [opt::reqopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, argument_missing); } @@ -63,8 +63,8 @@ fn test_reqopt_long_no_arg() { #[test] fn test_reqopt_long_multi() { - let args = ~["--test=20", "--test=30"]; - let opts = ~[opt::reqopt("test")]; + let args = ["--test=20", "--test=30"]; + let opts = [opt::reqopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_duplicated); } @@ -74,8 +74,8 @@ fn test_reqopt_long_multi() { #[test] fn test_reqopt_short() { - let args = ~["-t", "20"]; - let opts = ~[opt::reqopt("t")]; + let args = ["-t", "20"]; + let opts = [opt::reqopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { @@ -88,8 +88,8 @@ fn test_reqopt_short() { #[test] fn test_reqopt_short_missing() { - let args = ~["blah"]; - let opts = ~[opt::reqopt("t")]; + let args = ["blah"]; + let opts = [opt::reqopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_missing); } @@ -99,8 +99,8 @@ fn test_reqopt_short_missing() { #[test] fn test_reqopt_short_no_arg() { - let args = ~["-t"]; - let opts = ~[opt::reqopt("t")]; + let args = ["-t"]; + let opts = [opt::reqopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, argument_missing); } @@ -110,8 +110,8 @@ fn test_reqopt_short_no_arg() { #[test] fn test_reqopt_short_multi() { - let args = ~["-t", "20", "-t", "30"]; - let opts = ~[opt::reqopt("t")]; + let args = ["-t", "20", "-t", "30"]; + let opts = [opt::reqopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_duplicated); } @@ -123,8 +123,8 @@ fn test_reqopt_short_multi() { // Tests for optopt #[test] fn test_optopt_long() { - let args = ~["--test=20"]; - let opts = ~[opt::optopt("test")]; + let args = ["--test=20"]; + let opts = [opt::optopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { @@ -137,8 +137,8 @@ fn test_optopt_long() { #[test] fn test_optopt_long_missing() { - let args = ~["blah"]; - let opts = ~[opt::optopt("test")]; + let args = ["blah"]; + let opts = [opt::optopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (!opt::opt_present(m, "test")); } @@ -148,8 +148,8 @@ fn test_optopt_long_missing() { #[test] fn test_optopt_long_no_arg() { - let args = ~["--test"]; - let opts = ~[opt::optopt("test")]; + let args = ["--test"]; + let opts = [opt::optopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, argument_missing); } @@ -159,8 +159,8 @@ fn test_optopt_long_no_arg() { #[test] fn test_optopt_long_multi() { - let args = ~["--test=20", "--test=30"]; - let opts = ~[opt::optopt("test")]; + let args = ["--test=20", "--test=30"]; + let opts = [opt::optopt("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_duplicated); } @@ -170,8 +170,8 @@ fn test_optopt_long_multi() { #[test] fn test_optopt_short() { - let args = ~["-t", "20"]; - let opts = ~[opt::optopt("t")]; + let args = ["-t", "20"]; + let opts = [opt::optopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { @@ -184,8 +184,8 @@ fn test_optopt_short() { #[test] fn test_optopt_short_missing() { - let args = ~["blah"]; - let opts = ~[opt::optopt("t")]; + let args = ["blah"]; + let opts = [opt::optopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (!opt::opt_present(m, "t")); } @@ -195,8 +195,8 @@ fn test_optopt_short_missing() { #[test] fn test_optopt_short_no_arg() { - let args = ~["-t"]; - let opts = ~[opt::optopt("t")]; + let args = ["-t"]; + let opts = [opt::optopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, argument_missing); } @@ -206,8 +206,8 @@ fn test_optopt_short_no_arg() { #[test] fn test_optopt_short_multi() { - let args = ~["-t", "20", "-t", "30"]; - let opts = ~[opt::optopt("t")]; + let args = ["-t", "20", "-t", "30"]; + let opts = [opt::optopt("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_duplicated); } @@ -219,8 +219,8 @@ fn test_optopt_short_multi() { // Tests for optflag #[test] fn test_optflag_long() { - let args = ~["--test"]; - let opts = ~[opt::optflag("test")]; + let args = ["--test"]; + let opts = [opt::optflag("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (opt::opt_present(m, "test")); } @@ -230,8 +230,8 @@ fn test_optflag_long() { #[test] fn test_optflag_long_missing() { - let args = ~["blah"]; - let opts = ~[opt::optflag("test")]; + let args = ["blah"]; + let opts = [opt::optflag("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (!opt::opt_present(m, "test")); } @@ -241,8 +241,8 @@ fn test_optflag_long_missing() { #[test] fn test_optflag_long_arg() { - let args = ~["--test=20"]; - let opts = ~[opt::optflag("test")]; + let args = ["--test=20"]; + let opts = [opt::optflag("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { @@ -255,8 +255,8 @@ fn test_optflag_long_arg() { #[test] fn test_optflag_long_multi() { - let args = ~["--test", "--test"]; - let opts = ~[opt::optflag("test")]; + let args = ["--test", "--test"]; + let opts = [opt::optflag("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_duplicated); } @@ -266,8 +266,8 @@ fn test_optflag_long_multi() { #[test] fn test_optflag_short() { - let args = ~["-t"]; - let opts = ~[opt::optflag("t")]; + let args = ["-t"]; + let opts = [opt::optflag("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (opt::opt_present(m, "t")); } @@ -277,8 +277,8 @@ fn test_optflag_short() { #[test] fn test_optflag_short_missing() { - let args = ~["blah"]; - let opts = ~[opt::optflag("t")]; + let args = ["blah"]; + let opts = [opt::optflag("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (!opt::opt_present(m, "t")); } @@ -288,14 +288,14 @@ fn test_optflag_short_missing() { #[test] fn test_optflag_short_arg() { - let args = ~["-t", "20"]; - let opts = ~[opt::optflag("t")]; + let args = ["-t", "20"]; + let opts = [opt::optflag("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { // The next variable after the flag is just a free argument - assert (m.free.(0) == "20"); + assert (m.free[0] == "20"); } _ { fail; } } @@ -303,8 +303,8 @@ fn test_optflag_short_arg() { #[test] fn test_optflag_short_multi() { - let args = ~["-t", "-t"]; - let opts = ~[opt::optflag("t")]; + let args = ["-t", "-t"]; + let opts = [opt::optflag("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, option_duplicated); } @@ -316,8 +316,8 @@ fn test_optflag_short_multi() { // Tests for optmulti #[test] fn test_optmulti_long() { - let args = ~["--test=20"]; - let opts = ~[opt::optmulti("test")]; + let args = ["--test=20"]; + let opts = [opt::optmulti("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { @@ -330,8 +330,8 @@ fn test_optmulti_long() { #[test] fn test_optmulti_long_missing() { - let args = ~["blah"]; - let opts = ~[opt::optmulti("test")]; + let args = ["blah"]; + let opts = [opt::optmulti("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (!opt::opt_present(m, "test")); } @@ -341,8 +341,8 @@ fn test_optmulti_long_missing() { #[test] fn test_optmulti_long_no_arg() { - let args = ~["--test"]; - let opts = ~[opt::optmulti("test")]; + let args = ["--test"]; + let opts = [opt::optmulti("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, argument_missing); } @@ -352,15 +352,15 @@ fn test_optmulti_long_no_arg() { #[test] fn test_optmulti_long_multi() { - let args = ~["--test=20", "--test=30"]; - let opts = ~[opt::optmulti("test")]; + let args = ["--test=20", "--test=30"]; + let opts = [opt::optmulti("test")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (opt::opt_present(m, "test")); assert (opt::opt_str(m, "test") == "20"); - assert (opt::opt_strs(m, "test").(0) == "20"); - assert (opt::opt_strs(m, "test").(1) == "30"); + assert (opt::opt_strs(m, "test")[0] == "20"); + assert (opt::opt_strs(m, "test")[1] == "30"); } _ { fail; } } @@ -368,8 +368,8 @@ fn test_optmulti_long_multi() { #[test] fn test_optmulti_short() { - let args = ~["-t", "20"]; - let opts = ~[opt::optmulti("t")]; + let args = ["-t", "20"]; + let opts = [opt::optmulti("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { @@ -382,8 +382,8 @@ fn test_optmulti_short() { #[test] fn test_optmulti_short_missing() { - let args = ~["blah"]; - let opts = ~[opt::optmulti("t")]; + let args = ["blah"]; + let opts = [opt::optmulti("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (!opt::opt_present(m, "t")); } @@ -393,8 +393,8 @@ fn test_optmulti_short_missing() { #[test] fn test_optmulti_short_no_arg() { - let args = ~["-t"]; - let opts = ~[opt::optmulti("t")]; + let args = ["-t"]; + let opts = [opt::optmulti("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, argument_missing); } @@ -404,15 +404,15 @@ fn test_optmulti_short_no_arg() { #[test] fn test_optmulti_short_multi() { - let args = ~["-t", "20", "-t", "30"]; - let opts = ~[opt::optmulti("t")]; + let args = ["-t", "20", "-t", "30"]; + let opts = [opt::optmulti("t")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { assert (opt::opt_present(m, "t")); assert (opt::opt_str(m, "t") == "20"); - assert (opt::opt_strs(m, "t").(0) == "20"); - assert (opt::opt_strs(m, "t").(1) == "30"); + assert (opt::opt_strs(m, "t")[0] == "20"); + assert (opt::opt_strs(m, "t")[1] == "30"); } _ { fail; } } @@ -420,8 +420,8 @@ fn test_optmulti_short_multi() { #[test] fn test_unrecognized_option_long() { - let args = ~["--untest"]; - let opts = ~[opt::optmulti("t")]; + let args = ["--untest"]; + let opts = [opt::optmulti("t")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, unrecognized_option); } @@ -431,8 +431,8 @@ fn test_unrecognized_option_long() { #[test] fn test_unrecognized_option_short() { - let args = ~["-t"]; - let opts = ~[opt::optmulti("test")]; + let args = ["-t"]; + let opts = [opt::optmulti("test")]; let rs = opt::getopts(args, opts); alt rs { opt::failure(f) { check_fail_type(f, unrecognized_option); } @@ -443,23 +443,23 @@ fn test_unrecognized_option_short() { #[test] fn test_combined() { let args = - ~["prog", "free1", "-s", "20", "free2", "--flag", "--long=30", "-f", + ["prog", "free1", "-s", "20", "free2", "--flag", "--long=30", "-f", "-m", "40", "-m", "50"]; let opts = - ~[opt::optopt("s"), opt::optflag("flag"), opt::reqopt("long"), + [opt::optopt("s"), opt::optflag("flag"), opt::reqopt("long"), opt::optflag("f"), opt::optmulti("m"), opt::optopt("notpresent")]; let rs = opt::getopts(args, opts); alt rs { opt::success(m) { - assert (m.free.(0) == "prog"); - assert (m.free.(1) == "free1"); + assert (m.free[0] == "prog"); + assert (m.free[1] == "free1"); assert (opt::opt_str(m, "s") == "20"); - assert (m.free.(2) == "free2"); + assert (m.free[2] == "free2"); assert (opt::opt_present(m, "flag")); assert (opt::opt_str(m, "long") == "30"); assert (opt::opt_present(m, "f")); - assert (opt::opt_strs(m, "m").(0) == "40"); - assert (opt::opt_strs(m, "m").(1) == "50"); + assert (opt::opt_strs(m, "m")[0] == "40"); + assert (opt::opt_strs(m, "m")[1] == "50"); assert (!opt::opt_present(m, "notpresent")); } _ { fail; } diff --git a/src/test/stdtest/int.rs b/src/test/stdtest/int.rs index 936b1fa91d3..61d3448a175 100644 --- a/src/test/stdtest/int.rs +++ b/src/test/stdtest/int.rs @@ -22,4 +22,4 @@ fn test_pow() { assert (int::pow(-3, 2u) == 9); assert (int::pow(-3, 3u) == -27); assert (int::pow(4, 9u) == 262144); -} \ No newline at end of file +} diff --git a/src/test/stdtest/io.rs b/src/test/stdtest/io.rs index 002592d9020..08330c619fc 100644 --- a/src/test/stdtest/io.rs +++ b/src/test/stdtest/io.rs @@ -13,7 +13,7 @@ fn test_simple() { log frood; { let out: io::writer = - io::file_writer(tmpfile, ~[io::create, io::truncate]); + io::file_writer(tmpfile, [io::create, io::truncate]); out.write_str(frood); } let inp: io::reader = io::file_reader(tmpfile); diff --git a/src/test/stdtest/list.rs b/src/test/stdtest/list.rs index 4a44508efc4..9e05115a4f8 100644 --- a/src/test/stdtest/list.rs +++ b/src/test/stdtest/list.rs @@ -8,7 +8,7 @@ import std::option; #[test] fn test_from_vec() { - let l = from_vec(~[0, 1, 2]); + let l = from_vec([0, 1, 2]); assert (car(l) == 0); assert (car(cdr(l)) == 1); assert (car(cdr(cdr(l))) == 2); @@ -16,7 +16,7 @@ fn test_from_vec() { #[test] fn test_foldl() { - let l = from_vec(~[0, 1, 2, 3, 4]); + let l = from_vec([0, 1, 2, 3, 4]); fn add(a: &int, b: &uint) -> uint { ret (a as uint) + b; } let rs = list::foldl(l, 0u, add); assert (rs == 10u); @@ -24,7 +24,7 @@ fn test_foldl() { #[test] fn test_find_success() { - let l = from_vec(~[0, 1, 2]); + let l = from_vec([0, 1, 2]); fn match(i: &int) -> option::t<int> { ret if i == 2 { option::some(i) } else { option::none::<int> }; } @@ -34,7 +34,7 @@ fn test_find_success() { #[test] fn test_find_fail() { - let l = from_vec(~[0, 1, 2]); + let l = from_vec([0, 1, 2]); fn match(i: &int) -> option::t<int> { ret option::none::<int>; } let rs = list::find(l, match); assert (rs == option::none::<int>); @@ -42,7 +42,7 @@ fn test_find_fail() { #[test] fn test_has() { - let l = from_vec(~[5, 8, 6]); + let l = from_vec([5, 8, 6]); let empty = list::nil::<int>; assert (list::has(l, 5)); assert (!list::has(l, 7)); @@ -52,7 +52,7 @@ fn test_has() { #[test] fn test_length() { - let l = from_vec(~[0, 1, 2]); + let l = from_vec([0, 1, 2]); assert (list::length(l) == 3u); } diff --git a/src/test/stdtest/net.rs b/src/test/stdtest/net.rs index c1a26cb747d..9da7a12a060 100644 --- a/src/test/stdtest/net.rs +++ b/src/test/stdtest/net.rs @@ -3,10 +3,10 @@ import std::net; #[test] fn test_format_ip() { - assert(net::format_addr(net::ipv4(127u8,0u8,0u8,1u8)) == "127.0.0.1") + assert (net::format_addr(net::ipv4(127u8, 0u8, 0u8, 1u8)) == "127.0.0.1") } #[test] fn test_parse_ip() { - assert(net::parse_addr("127.0.0.1") == net::ipv4(127u8,0u8,0u8,1u8)); + assert (net::parse_addr("127.0.0.1") == net::ipv4(127u8, 0u8, 0u8, 1u8)); } diff --git a/src/test/stdtest/path.rs b/src/test/stdtest/path.rs index 5f7c34c5e05..911bc6b0dd9 100644 --- a/src/test/stdtest/path.rs +++ b/src/test/stdtest/path.rs @@ -14,4 +14,4 @@ fn test() { log fs::make_absolute("test-path"); log fs::make_absolute("/usr/bin"); -} \ No newline at end of file +} diff --git a/src/test/stdtest/ptr.rs b/src/test/stdtest/ptr.rs index 269febfc6b7..ef0ffa54a04 100644 --- a/src/test/stdtest/ptr.rs +++ b/src/test/stdtest/ptr.rs @@ -9,10 +9,10 @@ fn test() { let p = {mutable fst: 10, mutable snd: 20}; let pptr: *mutable pair = ptr::addr_of(p); let iptr: *mutable int = unsafe::reinterpret_cast(pptr); - assert (*iptr == 10); + assert (*iptr == 10);; *iptr = 30; assert (*iptr == 30); - assert (p.fst == 30); + assert (p.fst == 30);; *pptr = {mutable fst: 50, mutable snd: 60}; assert (*iptr == 50); diff --git a/src/test/stdtest/qsort.rs b/src/test/stdtest/qsort.rs index 4e557b533a4..250d77a4593 100644 --- a/src/test/stdtest/qsort.rs +++ b/src/test/stdtest/qsort.rs @@ -11,30 +11,30 @@ fn check_sort(v1: &[mutable int], v2: &[mutable int]) { let f = ltequal; std::sort::quick_sort::<int>(f, v1); let i = 0u; - while i < len { log v2.(i); assert (v2.(i) == v1.(i)); i += 1u; } + while i < len { log v2[i]; assert (v2[i] == v1[i]); i += 1u; } } #[test] fn test() { { - let v1 = ~[mutable 3, 7, 4, 5, 2, 9, 5, 8]; - let v2 = ~[mutable 2, 3, 4, 5, 5, 7, 8, 9]; + let v1 = [mutable 3, 7, 4, 5, 2, 9, 5, 8]; + let v2 = [mutable 2, 3, 4, 5, 5, 7, 8, 9]; check_sort(v1, v2); } { - let v1 = ~[mutable 1, 1, 1]; - let v2 = ~[mutable 1, 1, 1]; + let v1 = [mutable 1, 1, 1]; + let v2 = [mutable 1, 1, 1]; check_sort(v1, v2); } { - let v1: [mutable int] = ~[mutable ]; - let v2: [mutable int] = ~[mutable ]; + let v1: [mutable int] = [mutable]; + let v2: [mutable int] = [mutable]; check_sort(v1, v2); } - { let v1 = ~[mutable 9]; let v2 = ~[mutable 9]; check_sort(v1, v2); } + { let v1 = [mutable 9]; let v2 = [mutable 9]; check_sort(v1, v2); } { - let v1 = ~[mutable 9, 3, 3, 3, 9]; - let v2 = ~[mutable 3, 3, 3, 9, 9]; + let v1 = [mutable 9, 3, 3, 3, 9]; + let v2 = [mutable 3, 3, 3, 9, 9]; check_sort(v1, v2); } } @@ -42,18 +42,15 @@ fn test() { // Regression test for #705 #[test] fn test_simple() { - let names = ~[mutable 2, 1, 3]; + let names = [mutable 2, 1, 3]; - let expected = ~[1, 2, 3]; + let expected = [1, 2, 3]; fn lteq(a: &int, b: &int) -> bool { int::le(a, b) } sort::quick_sort(lteq, names); let pairs = vec::zip(expected, vec::from_mut(names)); - for (a, b) in pairs { - log #fmt("%d %d", a, b); - assert (a == b); - } + for (a, b) in pairs { log #fmt["%d %d", a, b]; assert (a == b); } } // Local Variables: diff --git a/src/test/stdtest/qsort3.rs b/src/test/stdtest/qsort3.rs index 21f43218806..6c8df212218 100644 --- a/src/test/stdtest/qsort3.rs +++ b/src/test/stdtest/qsort3.rs @@ -9,30 +9,30 @@ fn check_sort(v1: &[mutable int], v2: &[mutable int]) { let f2 = equal; std::sort::quick_sort3::<int>(f1, f2, v1); let i = 0u; - while i < len { log v2.(i); assert (v2.(i) == v1.(i)); i += 1u; } + while i < len { log v2[i]; assert (v2[i] == v1[i]); i += 1u; } } #[test] fn test() { { - let v1 = ~[mutable 3, 7, 4, 5, 2, 9, 5, 8]; - let v2 = ~[mutable 2, 3, 4, 5, 5, 7, 8, 9]; + let v1 = [mutable 3, 7, 4, 5, 2, 9, 5, 8]; + let v2 = [mutable 2, 3, 4, 5, 5, 7, 8, 9]; check_sort(v1, v2); } { - let v1 = ~[mutable 1, 1, 1]; - let v2 = ~[mutable 1, 1, 1]; + let v1 = [mutable 1, 1, 1]; + let v2 = [mutable 1, 1, 1]; check_sort(v1, v2); } { - let v1: [mutable int] = ~[mutable ]; - let v2: [mutable int] = ~[mutable ]; + let v1: [mutable int] = [mutable]; + let v2: [mutable int] = [mutable]; check_sort(v1, v2); } - { let v1 = ~[mutable 9]; let v2 = ~[mutable 9]; check_sort(v1, v2); } + { let v1 = [mutable 9]; let v2 = [mutable 9]; check_sort(v1, v2); } { - let v1 = ~[mutable 9, 3, 3, 3, 9]; - let v2 = ~[mutable 3, 3, 3, 9, 9]; + let v1 = [mutable 9, 3, 3, 3, 9]; + let v2 = [mutable 3, 3, 3, 9, 9]; check_sort(v1, v2); } } diff --git a/src/test/stdtest/rand.rs b/src/test/stdtest/rand.rs index bf394602fab..a8f13ed6704 100644 --- a/src/test/stdtest/rand.rs +++ b/src/test/stdtest/rand.rs @@ -26,4 +26,4 @@ fn test() { } log r1.next(); log r1.next(); -} \ No newline at end of file +} diff --git a/src/test/stdtest/run.rs b/src/test/stdtest/run.rs index 7476cb6621b..b60a3935500 100644 --- a/src/test/stdtest/run.rs +++ b/src/test/stdtest/run.rs @@ -11,9 +11,9 @@ import std::vec; #[cfg(target_os = "macos")] #[test] fn test_leaks() { - run::run_program("echo", ~[]); - run::start_program("echo", ~[]); - run::program_output("echo", ~[]); + run::run_program("echo", []); + run::start_program("echo", []); + run::program_output("echo", []); } // FIXME @@ -28,8 +28,8 @@ fn test_pipes() { let pipe_out = os::pipe(); let pipe_err = os::pipe(); - let pid = run::spawn_process("cat", ~[], - pipe_in.in, pipe_out.out, pipe_err.out); + let pid = + run::spawn_process("cat", [], pipe_in.in, pipe_out.out, pipe_err.out); os::libc::close(pipe_in.in); os::libc::close(pipe_out.out); os::libc::close(pipe_err.out); @@ -43,11 +43,10 @@ fn test_pipes() { log expected; log actual; - assert expected == actual; + assert (expected == actual); fn writeclose(fd: int, s: &str) { - let writer = io::new_writer( - io::fd_buf_writer(fd, option::none)); + let writer = io::new_writer(io::fd_buf_writer(fd, option::none)); writer.write_str(s); os::libc::close(fd); @@ -56,8 +55,7 @@ fn test_pipes() { fn readclose(fd: int) -> str { // Copied from run::program_output let file = os::fd_FILE(fd); - let reader = io::new_reader( - io::FILE_buf_reader(file, option::none)); + let reader = io::new_reader(io::FILE_buf_reader(file, option::none)); let buf = ""; while !reader.eof() { let bytes = reader.read_bytes(4096u); @@ -66,4 +64,4 @@ fn test_pipes() { os::libc::fclose(file); ret buf; } -} \ No newline at end of file +} diff --git a/src/test/stdtest/sha1.rs b/src/test/stdtest/sha1.rs index 74729fa52ae..6b72be20dd5 100644 --- a/src/test/stdtest/sha1.rs +++ b/src/test/stdtest/sha1.rs @@ -20,53 +20,43 @@ fn test() { // Test messages from FIPS 180-1 let fips_180_1_tests: [test] = - ~[{input: "abc", + [{input: "abc", output: - ~[0xA9u8, 0x99u8, 0x3Eu8, 0x36u8, - 0x47u8, 0x06u8, 0x81u8, 0x6Au8, - 0xBAu8, 0x3Eu8, 0x25u8, 0x71u8, - 0x78u8, 0x50u8, 0xC2u8, 0x6Cu8, - 0x9Cu8, 0xD0u8, 0xD8u8, 0x9Du8]}, + [0xA9u8, 0x99u8, 0x3Eu8, 0x36u8, 0x47u8, 0x06u8, 0x81u8, 0x6Au8, + 0xBAu8, 0x3Eu8, 0x25u8, 0x71u8, 0x78u8, 0x50u8, 0xC2u8, 0x6Cu8, + 0x9Cu8, 0xD0u8, 0xD8u8, 0x9Du8]}, {input: "abcdbcdecdefdefgefghfghighij" + "hijkijkljklmklmnlmnomnopnopq", output: - ~[0x84u8, 0x98u8, 0x3Eu8, 0x44u8, - 0x1Cu8, 0x3Bu8, 0xD2u8, 0x6Eu8, - 0xBAu8, 0xAEu8, 0x4Au8, 0xA1u8, - 0xF9u8, 0x51u8, 0x29u8, 0xE5u8, - 0xE5u8, 0x46u8, 0x70u8, 0xF1u8]}, + [0x84u8, 0x98u8, 0x3Eu8, 0x44u8, 0x1Cu8, 0x3Bu8, 0xD2u8, 0x6Eu8, + 0xBAu8, 0xAEu8, 0x4Au8, 0xA1u8, 0xF9u8, 0x51u8, 0x29u8, 0xE5u8, + 0xE5u8, 0x46u8, 0x70u8, 0xF1u8]}, {input: a_million_letter_a(), output: - ~[0x34u8, 0xAAu8, 0x97u8, 0x3Cu8, - 0xD4u8, 0xC4u8, 0xDAu8, 0xA4u8, - 0xF6u8, 0x1Eu8, 0xEBu8, 0x2Bu8, - 0xDBu8, 0xADu8, 0x27u8, 0x31u8, - 0x65u8, 0x34u8, 0x01u8, 0x6Fu8]}]; + [0x34u8, 0xAAu8, 0x97u8, 0x3Cu8, 0xD4u8, 0xC4u8, 0xDAu8, 0xA4u8, + 0xF6u8, 0x1Eu8, 0xEBu8, 0x2Bu8, 0xDBu8, 0xADu8, 0x27u8, 0x31u8, + 0x65u8, 0x34u8, 0x01u8, 0x6Fu8]}]; // Examples from wikipedia let wikipedia_tests: [test] = - ~[{input: "The quick brown fox jumps over the lazy dog", + [{input: "The quick brown fox jumps over the lazy dog", output: - ~[0x2fu8, 0xd4u8, 0xe1u8, 0xc6u8, - 0x7au8, 0x2du8, 0x28u8, 0xfcu8, - 0xedu8, 0x84u8, 0x9eu8, 0xe1u8, - 0xbbu8, 0x76u8, 0xe7u8, 0x39u8, - 0x1bu8, 0x93u8, 0xebu8, 0x12u8]}, + [0x2fu8, 0xd4u8, 0xe1u8, 0xc6u8, 0x7au8, 0x2du8, 0x28u8, 0xfcu8, + 0xedu8, 0x84u8, 0x9eu8, 0xe1u8, 0xbbu8, 0x76u8, 0xe7u8, 0x39u8, + 0x1bu8, 0x93u8, 0xebu8, 0x12u8]}, {input: "The quick brown fox jumps over the lazy cog", output: - ~[0xdeu8, 0x9fu8, 0x2cu8, 0x7fu8, - 0xd2u8, 0x5eu8, 0x1bu8, 0x3au8, - 0xfau8, 0xd3u8, 0xe8u8, 0x5au8, - 0x0bu8, 0xd1u8, 0x7du8, 0x9bu8, - 0x10u8, 0x0du8, 0xb4u8, 0xb3u8]}]; + [0xdeu8, 0x9fu8, 0x2cu8, 0x7fu8, 0xd2u8, 0x5eu8, 0x1bu8, 0x3au8, + 0xfau8, 0xd3u8, 0xe8u8, 0x5au8, 0x0bu8, 0xd1u8, 0x7du8, 0x9bu8, + 0x10u8, 0x0du8, 0xb4u8, 0xb3u8]}]; let tests = fips_180_1_tests + wikipedia_tests; fn check_vec_eq(v0: &[u8], v1: &[u8]) { assert (vec::len::<u8>(v0) == vec::len::<u8>(v1)); let len = vec::len::<u8>(v0); let i = 0u; while i < len { - let a = v0.(i); - let b = v1.(i); + let a = v0[i]; + let b = v1[i]; assert (a == b); i += 1u; } diff --git a/src/test/stdtest/sort.rs b/src/test/stdtest/sort.rs index be15881e65a..c42f950ce6b 100644 --- a/src/test/stdtest/sort.rs +++ b/src/test/stdtest/sort.rs @@ -7,22 +7,22 @@ fn check_sort(v1: &[int], v2: &[int]) { let f = lteq; let v3 = std::sort::merge_sort::<int>(f, v1); let i = 0u; - while i < len { log v3.(i); assert (v3.(i) == v2.(i)); i += 1u; } + while i < len { log v3[i]; assert (v3[i] == v2[i]); i += 1u; } } #[test] fn test() { { - let v1 = ~[3, 7, 4, 5, 2, 9, 5, 8]; - let v2 = ~[2, 3, 4, 5, 5, 7, 8, 9]; + let v1 = [3, 7, 4, 5, 2, 9, 5, 8]; + let v2 = [2, 3, 4, 5, 5, 7, 8, 9]; check_sort(v1, v2); } - { let v1 = ~[1, 1, 1]; let v2 = ~[1, 1, 1]; check_sort(v1, v2); } - { let v1: [int] = ~[]; let v2: [int] = ~[]; check_sort(v1, v2); } - { let v1 = ~[9]; let v2 = ~[9]; check_sort(v1, v2); } + { let v1 = [1, 1, 1]; let v2 = [1, 1, 1]; check_sort(v1, v2); } + { let v1: [int] = []; let v2: [int] = []; check_sort(v1, v2); } + { let v1 = [9]; let v2 = [9]; check_sort(v1, v2); } { - let v1 = ~[9, 3, 3, 3, 9]; - let v2 = ~[3, 3, 3, 9, 9]; + let v1 = [9, 3, 3, 3, 9]; + let v2 = [3, 3, 3, 9, 9]; check_sort(v1, v2); } } diff --git a/src/test/stdtest/str.rs b/src/test/stdtest/str.rs index 8124e565f6a..ef225c82fd8 100644 --- a/src/test/stdtest/str.rs +++ b/src/test/stdtest/str.rs @@ -30,8 +30,8 @@ fn test_split() { let v = str::split(s, c as u8); log "split to: "; for z: str in v { log z; } - log "comparing: " + v.(i) + " vs. " + k; - assert (str::eq(v.(i), k)); + log "comparing: " + v[i] + " vs. " + k; + assert (str::eq(v[i], k)); } t("abc.hello.there", '.', 0, "abc"); t("abc.hello.there", '.', 1, "hello"); @@ -70,10 +70,10 @@ fn test_substr() { #[test] fn test_concat() { fn t(v: &[str], s: &str) { assert (str::eq(str::concat(v), s)); } - t(~["you", "know", "I'm", "no", "good"], "youknowI'mnogood"); - let v: [str] = ~[]; + t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood"); + let v: [str] = []; t(v, ""); - t(~["hi"], "hi"); + t(["hi"], "hi"); } #[test] @@ -81,10 +81,10 @@ fn test_connect() { fn t(v: &[str], sep: &str, s: &str) { assert (str::eq(str::connect(v, sep), s)); } - t(~["you", "know", "I'm", "no", "good"], " ", "you know I'm no good"); - let v: [str] = ~[]; + t(["you", "know", "I'm", "no", "good"], " ", "you know I'm no good"); + let v: [str] = []; t(v, " ", ""); - t(~["hi"], " ", "hi"); + t(["hi"], " ", "hi"); } #[test] @@ -164,41 +164,41 @@ fn test_char_slice() { #[test] fn trim_left() { - assert str::trim_left("") == ""; - assert str::trim_left("a") == "a"; - assert str::trim_left(" ") == ""; - assert str::trim_left(" blah") == "blah"; - assert str::trim_left(" \u3000 wut") == "wut"; - assert str::trim_left("hey ") == "hey "; + assert (str::trim_left("") == ""); + assert (str::trim_left("a") == "a"); + assert (str::trim_left(" ") == ""); + assert (str::trim_left(" blah") == "blah"); + assert (str::trim_left(" \u3000 wut") == "wut"); + assert (str::trim_left("hey ") == "hey "); } #[test] fn trim_right() { - assert str::trim_right("") == ""; - assert str::trim_right("a") == "a"; - assert str::trim_right(" ") == ""; - assert str::trim_right("blah ") == "blah"; - assert str::trim_right("wut \u3000 ") == "wut"; - assert str::trim_right(" hey") == " hey"; + assert (str::trim_right("") == ""); + assert (str::trim_right("a") == "a"); + assert (str::trim_right(" ") == ""); + assert (str::trim_right("blah ") == "blah"); + assert (str::trim_right("wut \u3000 ") == "wut"); + assert (str::trim_right(" hey") == " hey"); } #[test] fn trim() { - assert str::trim("") == ""; - assert str::trim("a") == "a"; - assert str::trim(" ") == ""; - assert str::trim(" blah ") == "blah"; - assert str::trim("\nwut \u3000 ") == "wut"; - assert str::trim(" hey dude ") == "hey dude"; + assert (str::trim("") == ""); + assert (str::trim("a") == "a"); + assert (str::trim(" ") == ""); + assert (str::trim(" blah ") == "blah"); + assert (str::trim("\nwut \u3000 ") == "wut"); + assert (str::trim(" hey dude ") == "hey dude"); } #[test] fn is_whitespace() { - assert str::is_whitespace(""); - assert str::is_whitespace(" "); - assert str::is_whitespace("\u2009"); // Thin space - assert str::is_whitespace(" \n\t "); - assert !str::is_whitespace(" _ "); + assert (str::is_whitespace("")); + assert (str::is_whitespace(" ")); + assert (str::is_whitespace("\u2009")); // Thin space + assert (str::is_whitespace(" \n\t ")); + assert (!str::is_whitespace(" _ ")); } // Local Variables: diff --git a/src/test/stdtest/str_buf.rs b/src/test/stdtest/str_buf.rs index 6b013ed8db2..8bb040dde9c 100644 --- a/src/test/stdtest/str_buf.rs +++ b/src/test/stdtest/str_buf.rs @@ -12,4 +12,4 @@ fn test() { assert (str::eq(s_cstr, s)); let s_buf = str::str_from_buf(sb, 5u); assert (str::eq(s_buf, s)); -} \ No newline at end of file +} diff --git a/src/test/stdtest/task.rs b/src/test/stdtest/task.rs index 517210b9c56..d30d6addd0b 100644 --- a/src/test/stdtest/task.rs +++ b/src/test/stdtest/task.rs @@ -37,7 +37,7 @@ fn test_lib_spawn() { #[test] fn test_lib_spawn2() { - fn foo(x : int) { assert(x == 42); } + fn foo(x: int) { assert (x == 42); } task::_spawn(bind foo(42)); } @@ -52,7 +52,7 @@ fn test_join_chan() { log_err "received task status message"; log_err s; alt s { - task::exit(_, task::tr_success.) { /* yay! */ } + task::exit(_, task::tr_success.) {/* yay! */ } _ { fail "invalid task status received" } } } @@ -68,7 +68,7 @@ fn test_join_chan_fail() { log_err "received task status message"; log_err s; alt s { - task::exit(_, task::tr_failure.) { /* yay! */ } + task::exit(_, task::tr_failure.) {/* yay! */ } _ { fail "invalid task status received" } } } @@ -78,5 +78,5 @@ fn test_join_convenient() { fn winner() { } let f = winner; let handle = task::spawn_joinable(f); - assert(task::tr_success == task::join(handle)); + assert (task::tr_success == task::join(handle)); } diff --git a/src/test/stdtest/test.rs b/src/test/stdtest/test.rs index e85829b4477..e32105c2f0a 100644 --- a/src/test/stdtest/test.rs +++ b/src/test/stdtest/test.rs @@ -26,7 +26,7 @@ fn ignored_tests_result_in_ignored() { #[test] fn first_free_arg_should_be_a_filter() { - let args = ~["progname", "filter"]; + let args = ["progname", "filter"]; check (vec::is_not_empty(args)); let opts = alt test::parse_opts(args) { either::left(o) { o } }; assert (str::eq("filter", option::get(opts.filter))); @@ -34,7 +34,7 @@ fn first_free_arg_should_be_a_filter() { #[test] fn parse_ignored_flag() { - let args = ~["progname", "filter", "--ignored"]; + let args = ["progname", "filter", "--ignored"]; check (vec::is_not_empty(args)); let opts = alt test::parse_opts(args) { either::left(o) { o } }; assert (opts.run_ignored); @@ -47,13 +47,13 @@ fn filter_for_ignored_option() { let opts = {filter: option::none, run_ignored: true}; let tests = - ~[{name: "1", fn: fn () { }, ignore: true}, - {name: "2", fn: fn () { }, ignore: false}]; + [{name: "1", fn: fn () { }, ignore: true}, + {name: "2", fn: fn () { }, ignore: false}]; let filtered = test::filter_tests(opts, tests); assert (vec::len(filtered) == 1u); - assert (filtered.(0).name == "1"); - assert (filtered.(0).ignore == false); + assert (filtered[0].name == "1"); + assert (filtered[0].ignore == false); } #[test] @@ -61,37 +61,35 @@ fn sort_tests() { let opts = {filter: option::none, run_ignored: false}; let names = - ~["sha1::test", "int::test_to_str", "int::test_pow", - "test::do_not_run_ignored_tests", - "test::ignored_tests_result_in_ignored", - "test::first_free_arg_should_be_a_filter", - "test::parse_ignored_flag", "test::filter_for_ignored_option", - "test::sort_tests"]; + ["sha1::test", "int::test_to_str", "int::test_pow", + "test::do_not_run_ignored_tests", + "test::ignored_tests_result_in_ignored", + "test::first_free_arg_should_be_a_filter", + "test::parse_ignored_flag", "test::filter_for_ignored_option", + "test::sort_tests"]; let tests = { let testfn = fn () { }; - let tests = ~[]; + let tests = []; for name: str in names { let test = {name: name, fn: testfn, ignore: false}; - tests += ~[test]; + tests += [test]; } tests }; let filtered = test::filter_tests(opts, tests); let expected = - ~["int::test_pow", "int::test_to_str", "sha1::test", - "test::do_not_run_ignored_tests", "test::filter_for_ignored_option", - "test::first_free_arg_should_be_a_filter", - "test::ignored_tests_result_in_ignored", "test::parse_ignored_flag", - "test::sort_tests"]; + ["int::test_pow", "int::test_to_str", "sha1::test", + "test::do_not_run_ignored_tests", "test::filter_for_ignored_option", + "test::first_free_arg_should_be_a_filter", + "test::ignored_tests_result_in_ignored", "test::parse_ignored_flag", + "test::sort_tests"]; let pairs = vec::zip(expected, filtered); - for (a, b) in pairs { - assert (a == b.name); - } + for (a, b) in pairs { assert (a == b.name); } } // Local Variables: diff --git a/src/test/stdtest/uint.rs b/src/test/stdtest/uint.rs index 8b450b8a5ff..7361c76b70b 100644 --- a/src/test/stdtest/uint.rs +++ b/src/test/stdtest/uint.rs @@ -46,4 +46,4 @@ fn test_next_power_of_two() { assert (uint::next_power_of_two(37u) == 64u); assert (uint::next_power_of_two(38u) == 64u); assert (uint::next_power_of_two(39u) == 64u); -} \ No newline at end of file +} diff --git a/src/test/stdtest/vec.rs b/src/test/stdtest/vec.rs index 75b3998e28c..1ffe3982cd2 100644 --- a/src/test/stdtest/vec.rs +++ b/src/test/stdtest/vec.rs @@ -20,7 +20,7 @@ fn add(x: &uint, y: &uint) -> uint { ret x + y; } #[test] fn test_reserve_and_on_heap() { - let v: [int] = ~[1, 2]; + let v: [int] = [1, 2]; assert (!vec::on_heap(v)); vec::reserve(v, 8u); assert (vec::on_heap(v)); @@ -29,26 +29,26 @@ fn test_reserve_and_on_heap() { #[test] fn test_unsafe_ptrs() { // Test on-stack copy-from-buf. - let a = ~[1, 2, 3]; + let a = [1, 2, 3]; let ptr = vec::to_ptr(a); - let b = ~[]; + let b = []; vec::unsafe::copy_from_buf(b, ptr, 3u); assert (vec::len(b) == 3u); - assert (b.(0) == 1); - assert (b.(1) == 2); - assert (b.(2) == 3); + assert (b[0] == 1); + assert (b[1] == 2); + assert (b[2] == 3); // Test on-heap copy-from-buf. - let c = ~[1, 2, 3, 4, 5]; + let c = [1, 2, 3, 4, 5]; ptr = vec::to_ptr(c); - let d = ~[]; + let d = []; vec::unsafe::copy_from_buf(d, ptr, 5u); assert (vec::len(d) == 5u); - assert (d.(0) == 1); - assert (d.(1) == 2); - assert (d.(2) == 3); - assert (d.(3) == 4); - assert (d.(4) == 5); + assert (d[0] == 1); + assert (d[1] == 2); + assert (d[2] == 3); + assert (d[3] == 4); + assert (d[4] == 5); } #[test] @@ -56,18 +56,18 @@ fn test_init_fn() { // Test on-stack init_fn. let v = vec::init_fn(square, 3u); assert (vec::len(v) == 3u); - assert (v.(0) == 0u); - assert (v.(1) == 1u); - assert (v.(2) == 4u); + assert (v[0] == 0u); + assert (v[1] == 1u); + assert (v[2] == 4u); // Test on-heap init_fn. v = vec::init_fn(square, 5u); assert (vec::len(v) == 5u); - assert (v.(0) == 0u); - assert (v.(1) == 1u); - assert (v.(2) == 4u); - assert (v.(3) == 9u); - assert (v.(4) == 16u); + assert (v[0] == 0u); + assert (v[1] == 1u); + assert (v[2] == 4u); + assert (v[3] == 9u); + assert (v[4] == 16u); } #[test] @@ -75,194 +75,194 @@ fn test_init_elt() { // Test on-stack init_elt. let v = vec::init_elt(10u, 2u); assert (vec::len(v) == 2u); - assert (v.(0) == 10u); - assert (v.(1) == 10u); + assert (v[0] == 10u); + assert (v[1] == 10u); // Test on-heap init_elt. v = vec::init_elt(20u, 6u); - assert (v.(0) == 20u); - assert (v.(1) == 20u); - assert (v.(2) == 20u); - assert (v.(3) == 20u); - assert (v.(4) == 20u); - assert (v.(5) == 20u); + assert (v[0] == 20u); + assert (v[1] == 20u); + assert (v[2] == 20u); + assert (v[3] == 20u); + assert (v[4] == 20u); + assert (v[5] == 20u); } #[test] fn test_is_empty() { - assert (vec::is_empty::<int>(~[])); - assert (!vec::is_empty(~[0])); + assert (vec::is_empty::<int>([])); + assert (!vec::is_empty([0])); } #[test] fn test_is_not_empty() { - assert (vec::is_not_empty(~[0])); - assert (!vec::is_not_empty::<int>(~[])); + assert (vec::is_not_empty([0])); + assert (!vec::is_not_empty::<int>([])); } #[test] fn test_head() { - let a = ~[11, 12]; + let a = [11, 12]; check (vec::is_not_empty(a)); assert (vec::head(a) == 11); } #[test] fn test_tail() { - let a = ~[11]; + let a = [11]; check (vec::is_not_empty(a)); - assert (vec::tail(a) == ~[]); + assert (vec::tail(a) == []); - a = ~[11, 12]; + a = [11, 12]; check (vec::is_not_empty(a)); - assert (vec::tail(a) == ~[12]); + assert (vec::tail(a) == [12]); } #[test] fn test_last() { - let n = vec::last(~[]); + let n = vec::last([]); assert (n == none); - n = vec::last(~[1, 2, 3]); + n = vec::last([1, 2, 3]); assert (n == some(3)); - n = vec::last(~[1, 2, 3, 4, 5]); + n = vec::last([1, 2, 3, 4, 5]); assert (n == some(5)); } #[test] fn test_slice() { // Test on-stack -> on-stack slice. - let v = vec::slice(~[1, 2, 3], 1u, 3u); + let v = vec::slice([1, 2, 3], 1u, 3u); assert (vec::len(v) == 2u); - assert (v.(0) == 2); - assert (v.(1) == 3); + assert (v[0] == 2); + assert (v[1] == 3); // Test on-heap -> on-stack slice. - v = vec::slice(~[1, 2, 3, 4, 5], 0u, 3u); + v = vec::slice([1, 2, 3, 4, 5], 0u, 3u); assert (vec::len(v) == 3u); - assert (v.(0) == 1); - assert (v.(1) == 2); - assert (v.(2) == 3); + assert (v[0] == 1); + assert (v[1] == 2); + assert (v[2] == 3); // Test on-heap -> on-heap slice. - v = vec::slice(~[1, 2, 3, 4, 5, 6], 1u, 6u); + v = vec::slice([1, 2, 3, 4, 5, 6], 1u, 6u); assert (vec::len(v) == 5u); - assert (v.(0) == 2); - assert (v.(1) == 3); - assert (v.(2) == 4); - assert (v.(3) == 5); - assert (v.(4) == 6); + assert (v[0] == 2); + assert (v[1] == 3); + assert (v[2] == 4); + assert (v[3] == 5); + assert (v[4] == 6); } #[test] fn test_pop() { // Test on-stack pop. - let v = ~[1, 2, 3]; + let v = [1, 2, 3]; let e = vec::pop(v); assert (vec::len(v) == 2u); - assert (v.(0) == 1); - assert (v.(1) == 2); + assert (v[0] == 1); + assert (v[1] == 2); assert (e == 3); // Test on-heap pop. - v = ~[1, 2, 3, 4, 5]; + v = [1, 2, 3, 4, 5]; e = vec::pop(v); assert (vec::len(v) == 4u); - assert (v.(0) == 1); - assert (v.(1) == 2); - assert (v.(2) == 3); - assert (v.(3) == 4); + assert (v[0] == 1); + assert (v[1] == 2); + assert (v[2] == 3); + assert (v[3] == 4); assert (e == 5); } #[test] fn test_grow() { // Test on-stack grow(). - let v = ~[]; + let v = []; vec::grow(v, 2u, 1); assert (vec::len(v) == 2u); - assert (v.(0) == 1); - assert (v.(1) == 1); + assert (v[0] == 1); + assert (v[1] == 1); // Test on-heap grow(). vec::grow(v, 3u, 2); assert (vec::len(v) == 5u); - assert (v.(0) == 1); - assert (v.(1) == 1); - assert (v.(2) == 2); - assert (v.(3) == 2); - assert (v.(4) == 2); + assert (v[0] == 1); + assert (v[1] == 1); + assert (v[2] == 2); + assert (v[3] == 2); + assert (v[4] == 2); } #[test] fn test_grow_fn() { - let v = ~[]; + let v = []; vec::grow_fn(v, 3u, square); assert (vec::len(v) == 3u); - assert (v.(0) == 0u); - assert (v.(1) == 1u); - assert (v.(2) == 4u); + assert (v[0] == 0u); + assert (v[1] == 1u); + assert (v[2] == 4u); } #[test] fn test_grow_set() { - let v = ~[mutable 1, 2, 3]; + let v = [mutable 1, 2, 3]; vec::grow_set(v, 4u, 4, 5); assert (vec::len(v) == 5u); - assert (v.(0) == 1); - assert (v.(1) == 2); - assert (v.(2) == 3); - assert (v.(3) == 4); - assert (v.(4) == 5); + assert (v[0] == 1); + assert (v[1] == 2); + assert (v[2] == 3); + assert (v[3] == 4); + assert (v[4] == 5); } #[test] fn test_map() { // Test on-stack map. - let v = ~[1u, 2u, 3u]; + let v = [1u, 2u, 3u]; let w = vec::map(square_alias, v); assert (vec::len(w) == 3u); - assert (w.(0) == 1u); - assert (w.(1) == 4u); - assert (w.(2) == 9u); + assert (w[0] == 1u); + assert (w[1] == 4u); + assert (w[2] == 9u); // Test on-heap map. - v = ~[1u, 2u, 3u, 4u, 5u]; + v = [1u, 2u, 3u, 4u, 5u]; w = vec::map(square_alias, v); assert (vec::len(w) == 5u); - assert (w.(0) == 1u); - assert (w.(1) == 4u); - assert (w.(2) == 9u); - assert (w.(3) == 16u); - assert (w.(4) == 25u); + assert (w[0] == 1u); + assert (w[1] == 4u); + assert (w[2] == 9u); + assert (w[3] == 16u); + assert (w[4] == 25u); } #[test] fn test_map2() { fn times(x: &int, y: &int) -> int { ret x * y; } let f = times; - let v0 = ~[1, 2, 3, 4, 5]; - let v1 = ~[5, 4, 3, 2, 1]; + let v0 = [1, 2, 3, 4, 5]; + let v1 = [5, 4, 3, 2, 1]; let u = vec::map2::<int, int, int>(f, v0, v1); let i = 0; - while i < 5 { assert (v0.(i) * v1.(i) == u.(i)); i += 1; } + while i < 5 { assert (v0[i] * v1[i] == u[i]); i += 1; } } #[test] fn test_filter_map() { // Test on-stack filter-map. - let v = ~[1u, 2u, 3u]; + let v = [1u, 2u, 3u]; let w = vec::filter_map(square_if_odd, v); assert (vec::len(w) == 2u); - assert (w.(0) == 1u); - assert (w.(1) == 9u); + assert (w[0] == 1u); + assert (w[1] == 9u); // Test on-heap filter-map. - v = ~[1u, 2u, 3u, 4u, 5u]; + v = [1u, 2u, 3u, 4u, 5u]; w = vec::filter_map(square_if_odd, v); assert (vec::len(w) == 3u); - assert (w.(0) == 1u); - assert (w.(1) == 9u); - assert (w.(2) == 25u); + assert (w[0] == 1u); + assert (w[1] == 9u); + assert (w[2] == 25u); fn halve(i: &int) -> option::t<int> { if i % 2 == 0 { @@ -270,14 +270,14 @@ fn test_filter_map() { } else { ret option::none::<int>; } } fn halve_for_sure(i: &int) -> int { ret i / 2; } - let all_even: [int] = ~[0, 2, 8, 6]; - let all_odd1: [int] = ~[1, 7, 3]; - let all_odd2: [int] = ~[]; - let mix: [int] = ~[9, 2, 6, 7, 1, 0, 0, 3]; - let mix_dest: [int] = ~[1, 3, 0, 0]; + let all_even: [int] = [0, 2, 8, 6]; + let all_odd1: [int] = [1, 7, 3]; + let all_odd2: [int] = []; + let mix: [int] = [9, 2, 6, 7, 1, 0, 0, 3]; + let mix_dest: [int] = [1, 3, 0, 0]; assert (filter_map(halve, all_even) == map(halve_for_sure, all_even)); - assert (filter_map(halve, all_odd1) == ~[]); - assert (filter_map(halve, all_odd2) == ~[]); + assert (filter_map(halve, all_odd1) == []); + assert (filter_map(halve, all_odd2) == []); assert (filter_map(halve, mix) == mix_dest); } @@ -285,49 +285,49 @@ fn test_filter_map() { #[test] fn test_foldl() { // Test on-stack fold. - let v = ~[1u, 2u, 3u]; + let v = [1u, 2u, 3u]; let sum = vec::foldl(add, 0u, v); assert (sum == 6u); // Test on-heap fold. - v = ~[1u, 2u, 3u, 4u, 5u]; + v = [1u, 2u, 3u, 4u, 5u]; sum = vec::foldl(add, 0u, v); assert (sum == 15u); } #[test] fn test_any_and_all() { - assert (vec::any(is_three, ~[1u, 2u, 3u])); - assert (!vec::any(is_three, ~[0u, 1u, 2u])); - assert (vec::any(is_three, ~[1u, 2u, 3u, 4u, 5u])); - assert (!vec::any(is_three, ~[1u, 2u, 4u, 5u, 6u])); - - assert (vec::all(is_three, ~[3u, 3u, 3u])); - assert (!vec::all(is_three, ~[3u, 3u, 2u])); - assert (vec::all(is_three, ~[3u, 3u, 3u, 3u, 3u])); - assert (!vec::all(is_three, ~[3u, 3u, 0u, 1u, 2u])); + assert (vec::any(is_three, [1u, 2u, 3u])); + assert (!vec::any(is_three, [0u, 1u, 2u])); + assert (vec::any(is_three, [1u, 2u, 3u, 4u, 5u])); + assert (!vec::any(is_three, [1u, 2u, 4u, 5u, 6u])); + + assert (vec::all(is_three, [3u, 3u, 3u])); + assert (!vec::all(is_three, [3u, 3u, 2u])); + assert (vec::all(is_three, [3u, 3u, 3u, 3u, 3u])); + assert (!vec::all(is_three, [3u, 3u, 0u, 1u, 2u])); } #[test] fn test_zip_unzip() { - let v1 = ~[1, 2, 3]; - let v2 = ~[4, 5, 6]; + let v1 = [1, 2, 3]; + let v2 = [4, 5, 6]; let z1 = vec::zip(v1, v2); - assert ((1, 4) == z1.(0)); - assert ((2, 5) == z1.(1)); - assert ((3, 6) == z1.(2)); + assert ((1, 4) == z1[0]); + assert ((2, 5) == z1[1]); + assert ((3, 6) == z1[2]); let (left, right) = vec::unzip(z1); - assert ((1, 4) == (left.(0), right.(0))); - assert ((2, 5) == (left.(1), right.(1))); - assert ((3, 6) == (left.(2), right.(2))); + assert ((1, 4) == (left[0], right[0])); + assert ((2, 5) == (left[1], right[1])); + assert ((3, 6) == (left[2], right[2])); } #[test] fn test_position() { - let v1: [int] = ~[1, 2, 3, 3, 2, 5]; + let v1: [int] = [1, 2, 3, 3, 2, 5]; assert (position(1, v1) == option::some::<uint>(0u)); assert (position(2, v1) == option::some::<uint>(1u)); assert (position(5, v1) == option::some::<uint>(5u)); @@ -338,28 +338,28 @@ fn test_position() { fn test_position_pred() { fn less_than_three(i: &int) -> bool { ret i < 3; } fn is_eighteen(i: &int) -> bool { ret i == 18; } - let v1: [int] = ~[5, 4, 3, 2, 1]; + let v1: [int] = [5, 4, 3, 2, 1]; assert (position_pred(less_than_three, v1) == option::some::<uint>(3u)); assert (position_pred(is_eighteen, v1) == option::none::<uint>); } #[test] fn reverse_and_reversed() { - let v: [mutable int] = ~[mutable 10, 20]; - assert (v.(0) == 10); - assert (v.(1) == 20); + let v: [mutable int] = [mutable 10, 20]; + assert (v[0] == 10); + assert (v[1] == 20); vec::reverse(v); - assert (v.(0) == 20); - assert (v.(1) == 10); - let v2 = vec::reversed::<int>(~[10, 20]); - assert (v2.(0) == 20); - assert (v2.(1) == 10); - v.(0) = 30; - assert (v2.(0) == 20); + assert (v[0] == 20); + assert (v[1] == 10); + let v2 = vec::reversed::<int>([10, 20]); + assert (v2[0] == 20); + assert (v2[1] == 10); + v[0] = 30; + assert (v2[0] == 20); // Make sure they work with 0-length vectors too. - let v4 = vec::reversed::<int>(~[]); - let v3: [mutable int] = ~[mutable]; + let v4 = vec::reversed::<int>([]); + let v3: [mutable int] = [mutable]; vec::reverse::<int>(v3); } diff --git a/src/test/stdtest/vec_str_conversions.rs b/src/test/stdtest/vec_str_conversions.rs index cc52ec80e95..8e245db256f 100644 --- a/src/test/stdtest/vec_str_conversions.rs +++ b/src/test/stdtest/vec_str_conversions.rs @@ -16,8 +16,8 @@ fn test_simple() { let n2: uint = vec::len::<u8>(v); assert (n1 == n2); while i < n1 { - let a: u8 = s1.(i); - let b: u8 = s2.(i); + let a: u8 = s1[i]; + let b: u8 = s2[i]; log a; log b; assert (a == b); |
