Large diffs are not rendered by default.

@@ -14,6 +14,7 @@ export test_opts;
export tr_ok;
export tr_failed;
export tr_ignored;
export run_tests_console;
export run_test;
export filter_tests;
export parse_opts;
@@ -51,7 +52,7 @@ fn test_main(&vec[str] args, &test_desc[] tests) {
either::left(?o) { o }
either::right(?m) { fail m }
};
if (!run_tests(opts, tests)) {
if (!run_tests_console(opts, tests)) {
fail "Some tests failed";
}
}
@@ -94,7 +95,7 @@ tag test_result {
}

// A simple console test runner
fn run_tests(&test_opts opts, &test_desc[] tests) -> bool {
fn run_tests_console(&test_opts opts, &test_desc[] tests) -> bool {

auto filtered_tests = filter_tests(opts, tests);

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -90,9 +90,7 @@ fn stress(int num_tasks) {
fn main(vec[str] argv) {
if(vec::len(argv) == 1u) {
assert (fib(8) == 21);
assert (fib(15) == 610);
log fib(8);
log fib(15);
}
else {
// Interactive mode! Wooo!!!!

This file was deleted.

@@ -1,3 +1,6 @@
// xfail-stage1
// xfail-stage2
// xfail-stage3
/**
A parallel word-frequency counting program.
@@ -1,5 +1,5 @@
// xfail-stage0
// error-pattern:expecting \]
// error-pattern:expecting ]

// asterisk is bogus
#[attr*]
@@ -1,5 +1,5 @@
// xfail-stage0
// error-pattern:\^ cannot be applied to type `str`
// error-pattern:^ cannot be applied to type `str`

fn main() {
auto x = "a" ^ "b";
@@ -1,5 +1,5 @@
// xfail-stage0
// error-pattern:>> cannot be applied to type `port\[int\]`
// error-pattern:>> cannot be applied to type `port[int]`

fn main() {
let port[int] p1 = port();
@@ -1,5 +1,5 @@
// xfail-stage0
// error-pattern:\- cannot be applied to type `obj
// error-pattern:- cannot be applied to type `obj

fn main() {
auto x = obj(){} - obj(){};
@@ -1,5 +1,5 @@
// xfail-stage0
// error-pattern:expecting \[, found fmt
// error-pattern:expecting [, found fmt

// Don't know how to deal with a syntax extension appearing after an
// item attribute. Probably could use a better error message.
@@ -0,0 +1,8 @@
// Checking that the compiler reports multiple type errors at once
// error-pattern:mismatched types: expected bool
// error-pattern:mismatched types: expected int

fn main() {
let bool a = 1;
let int b = true;
}
@@ -1,5 +1,5 @@
// xfail-stage0
// error-pattern:attempted field access on type vec\[int\]
// error-pattern:attempted field access on type vec[int]
// issue #367

fn f() {
@@ -0,0 +1,11 @@
use std;

mod compiletest;

// Local Variables:
// fill-column: 78;
// indent-tabs-mode: nil
// c-basic-offset: 4
// buffer-file-coding-system: utf-8-unix
// compile-command: "make -k -C $RBUILD 2>&1 | sed -e 's/\\/x\\//x:\\//g'";
// End:

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,10 @@
// compile-flags:--test
// xfail-fast

use std;

// Building as a test runner means that a synthetic main will be run,
// not ours
fn main() {
fail;
}
@@ -3,6 +3,7 @@ use std;
import std::vec;
import std::bitv;

#[test]
fn test_0_elements() {
auto act;
auto exp;
@@ -13,6 +14,7 @@ fn test_0_elements() {
assert (bitv::eq_vec(act, exp));
}

#[test]
fn test_1_element() {
auto act;
act = bitv::create(1u, false);
@@ -21,6 +23,7 @@ fn test_1_element() {
assert (bitv::eq_vec(act, [1u]));
}

#[test]
fn test_10_elements() {
auto act;
// all 0
@@ -59,6 +62,7 @@ fn test_10_elements() {
assert (bitv::eq_vec(act, [1u, 0u, 0u, 1u, 0u, 0u, 1u, 0u, 0u, 1u]));
}

#[test]
fn test_31_elements() {
auto act;
// all 0
@@ -131,6 +135,7 @@ fn test_31_elements() {
0u, 0u, 0u, 0u, 1u]));
}

#[test]
fn test_32_elements() {
auto act;
// all 0
@@ -205,6 +210,7 @@ fn test_32_elements() {
0u, 0u, 0u, 0u, 1u, 1u]));
}

#[test]
fn test_33_elements() {
auto act;
// all 0
@@ -280,11 +286,3 @@ fn test_33_elements() {
0u, 0u, 0u, 0u, 1u, 1u, 1u]));
}

fn main() {
test_0_elements();
test_1_element();
test_10_elements();
test_31_elements();
test_32_elements();
test_33_elements();
}
@@ -2,7 +2,8 @@
use std;
import std::box;

fn main() {
#[test]
fn test() {
auto x = @3;
auto y = @3;
assert (box::ptr_eq[int](x, x));
@@ -4,6 +4,7 @@
use std;
import std::deque;

#[test]
fn test_simple() {
let deque::t[int] d = deque::create[int]();
assert (d.size() == 0u);
@@ -116,7 +117,8 @@ tag taggypar[T] { onepar(int); twopar(int, int); threepar(int, int, int); }

type reccy = rec(int x, int y, taggy t);

fn main() {
#[test]
fn test() {
fn inteq(&int a, &int b) -> bool { ret a == b; }
fn intboxeq(&@int a, &@int b) -> bool { ret a == b; }
fn taggyeq(&taggy a, &taggy b) -> bool {
@@ -170,10 +172,6 @@ fn main() {
fn reccyeq(&reccy a, &reccy b) -> bool {
ret a.x == b.x && a.y == b.y && taggyeq(a.t, b.t);
}
log "*** starting";
log "*** test simple";
test_simple();
log "*** end test simple";
log "*** test boxes";
test_boxes(@5, @72, @64, @175);
log "*** end test boxes";
@@ -1,23 +1,24 @@
// xfail-stage0

use std;
import std::either::*;
import std::ivec::len;

#[test]
fn test_either_left() {
auto val = left(10);
fn f_left(&int x) -> bool { x == 10 }
fn f_right(&uint x) -> bool { false }
assert (either(f_left, f_right, val));
}

#[test]
fn test_either_right() {
auto val = right(10u);
fn f_left(&int x) -> bool { false }
fn f_right(&uint x) -> bool { x == 10u }
assert (either(f_left, f_right, val));
}

#[test]
fn test_lefts() {
auto input = ~[left(10),
right(11),
@@ -28,19 +29,22 @@ fn test_lefts() {
assert (result == ~[10, 12, 14]);
}

#[test]
fn test_lefts_none() {
let (t[int, int])[] input = ~[right(10),
right(10)];
auto result = lefts(input);
assert (len(result) == 0u);
}

#[test]
fn test_lefts_empty() {
let (t[int, int])[] input = ~[];
auto result = lefts(input);
assert (len(result) == 0u);
}

#[test]
fn test_rights() {
auto input = ~[left(10),
right(11),
@@ -51,19 +55,22 @@ fn test_rights() {
assert (result == ~[11, 13]);
}

#[test]
fn test_rights_none() {
let (t[int, int])[] input = ~[left(10),
left(10)];
auto result = rights(input);
assert (len(result) == 0u);
}

#[test]
fn test_rights_empty() {
let (t[int, int])[] input = ~[];
auto result = rights(input);
assert (len(result) == 0u);
}

#[test]
fn test_partition() {
auto input = ~[left(10),
right(11),
@@ -78,6 +85,7 @@ fn test_partition() {
assert (result._1.(1) == 13);
}

#[test]
fn test_partition_no_lefts() {
let (t[int, int])[] input = ~[right(10),
right(11)];
@@ -86,6 +94,7 @@ fn test_partition_no_lefts() {
assert (len(result._1) == 2u);
}

#[test]
fn test_partition_no_rights() {
let (t[int, int])[] input = ~[left(10),
left(11)];
@@ -94,24 +103,10 @@ fn test_partition_no_rights() {
assert (len(result._1) == 0u);
}

#[test]
fn test_partition_empty() {
let (t[int, int])[] input = ~[];
auto result = partition(input);
assert (len(result._0) == 0u);
assert (len(result._1) == 0u);
}

fn main() {
test_either_left();
test_either_right();
test_lefts();
test_lefts_none();
test_lefts_empty();
test_rights();
test_rights_none();
test_rights_empty();
test_partition();
test_partition_no_lefts();
test_partition_no_rights();
test_partition_empty();
}
@@ -2,6 +2,7 @@
use std;
import std::fs;

#[test]
fn test_connect() {
auto slash = fs::path_sep();
log_err fs::connect("a", "b");
@@ -10,11 +11,8 @@ fn test_connect() {
}

// Issue #712
#[test]
fn test_list_dir_no_invalid_memory_access() {
fs::list_dir(".");
}

fn main() {
test_connect();
test_list_dir_no_invalid_memory_access();
}
@@ -29,6 +29,7 @@ fn check_fail_type(opt::fail_ f, fail_type ft) {


// Tests for reqopt
#[test]
fn test_reqopt_long() {
auto args = ["--test=20"];
auto opts = [opt::reqopt("test")];
@@ -42,6 +43,7 @@ fn test_reqopt_long() {
}
}

#[test]
fn test_reqopt_long_missing() {
auto args = ["blah"];
auto opts = [opt::reqopt("test")];
@@ -52,6 +54,7 @@ fn test_reqopt_long_missing() {
}
}

#[test]
fn test_reqopt_long_no_arg() {
auto args = ["--test"];
auto opts = [opt::reqopt("test")];
@@ -62,6 +65,7 @@ fn test_reqopt_long_no_arg() {
}
}

#[test]
fn test_reqopt_long_multi() {
auto args = ["--test=20", "--test=30"];
auto opts = [opt::reqopt("test")];
@@ -72,6 +76,7 @@ fn test_reqopt_long_multi() {
}
}

#[test]
fn test_reqopt_short() {
auto args = ["-t", "20"];
auto opts = [opt::reqopt("t")];
@@ -85,6 +90,7 @@ fn test_reqopt_short() {
}
}

#[test]
fn test_reqopt_short_missing() {
auto args = ["blah"];
auto opts = [opt::reqopt("t")];
@@ -95,6 +101,7 @@ fn test_reqopt_short_missing() {
}
}

#[test]
fn test_reqopt_short_no_arg() {
auto args = ["-t"];
auto opts = [opt::reqopt("t")];
@@ -105,6 +112,7 @@ fn test_reqopt_short_no_arg() {
}
}

#[test]
fn test_reqopt_short_multi() {
auto args = ["-t", "20", "-t", "30"];
auto opts = [opt::reqopt("t")];
@@ -117,6 +125,7 @@ fn test_reqopt_short_multi() {


// Tests for optopt
#[test]
fn test_optopt_long() {
auto args = ["--test=20"];
auto opts = [opt::optopt("test")];
@@ -130,6 +139,7 @@ fn test_optopt_long() {
}
}

#[test]
fn test_optopt_long_missing() {
auto args = ["blah"];
auto opts = [opt::optopt("test")];
@@ -140,6 +150,7 @@ fn test_optopt_long_missing() {
}
}

#[test]
fn test_optopt_long_no_arg() {
auto args = ["--test"];
auto opts = [opt::optopt("test")];
@@ -150,6 +161,7 @@ fn test_optopt_long_no_arg() {
}
}

#[test]
fn test_optopt_long_multi() {
auto args = ["--test=20", "--test=30"];
auto opts = [opt::optopt("test")];
@@ -160,6 +172,7 @@ fn test_optopt_long_multi() {
}
}

#[test]
fn test_optopt_short() {
auto args = ["-t", "20"];
auto opts = [opt::optopt("t")];
@@ -173,6 +186,7 @@ fn test_optopt_short() {
}
}

#[test]
fn test_optopt_short_missing() {
auto args = ["blah"];
auto opts = [opt::optopt("t")];
@@ -183,6 +197,7 @@ fn test_optopt_short_missing() {
}
}

#[test]
fn test_optopt_short_no_arg() {
auto args = ["-t"];
auto opts = [opt::optopt("t")];
@@ -193,6 +208,7 @@ fn test_optopt_short_no_arg() {
}
}

#[test]
fn test_optopt_short_multi() {
auto args = ["-t", "20", "-t", "30"];
auto opts = [opt::optopt("t")];
@@ -205,6 +221,7 @@ fn test_optopt_short_multi() {


// Tests for optflag
#[test]
fn test_optflag_long() {
auto args = ["--test"];
auto opts = [opt::optflag("test")];
@@ -215,6 +232,7 @@ fn test_optflag_long() {
}
}

#[test]
fn test_optflag_long_missing() {
auto args = ["blah"];
auto opts = [opt::optflag("test")];
@@ -225,6 +243,7 @@ fn test_optflag_long_missing() {
}
}

#[test]
fn test_optflag_long_arg() {
auto args = ["--test=20"];
auto opts = [opt::optflag("test")];
@@ -238,6 +257,7 @@ fn test_optflag_long_arg() {
}
}

#[test]
fn test_optflag_long_multi() {
auto args = ["--test", "--test"];
auto opts = [opt::optflag("test")];
@@ -248,6 +268,7 @@ fn test_optflag_long_multi() {
}
}

#[test]
fn test_optflag_short() {
auto args = ["-t"];
auto opts = [opt::optflag("t")];
@@ -258,6 +279,7 @@ fn test_optflag_short() {
}
}

#[test]
fn test_optflag_short_missing() {
auto args = ["blah"];
auto opts = [opt::optflag("t")];
@@ -268,6 +290,7 @@ fn test_optflag_short_missing() {
}
}

#[test]
fn test_optflag_short_arg() {
auto args = ["-t", "20"];
auto opts = [opt::optflag("t")];
@@ -282,6 +305,7 @@ fn test_optflag_short_arg() {
}
}

#[test]
fn test_optflag_short_multi() {
auto args = ["-t", "-t"];
auto opts = [opt::optflag("t")];
@@ -294,6 +318,7 @@ fn test_optflag_short_multi() {


// Tests for optmulti
#[test]
fn test_optmulti_long() {
auto args = ["--test=20"];
auto opts = [opt::optmulti("test")];
@@ -307,6 +332,7 @@ fn test_optmulti_long() {
}
}

#[test]
fn test_optmulti_long_missing() {
auto args = ["blah"];
auto opts = [opt::optmulti("test")];
@@ -317,6 +343,7 @@ fn test_optmulti_long_missing() {
}
}

#[test]
fn test_optmulti_long_no_arg() {
auto args = ["--test"];
auto opts = [opt::optmulti("test")];
@@ -327,6 +354,7 @@ fn test_optmulti_long_no_arg() {
}
}

#[test]
fn test_optmulti_long_multi() {
auto args = ["--test=20", "--test=30"];
auto opts = [opt::optmulti("test")];
@@ -342,6 +370,7 @@ fn test_optmulti_long_multi() {
}
}

#[test]
fn test_optmulti_short() {
auto args = ["-t", "20"];
auto opts = [opt::optmulti("t")];
@@ -355,6 +384,7 @@ fn test_optmulti_short() {
}
}

#[test]
fn test_optmulti_short_missing() {
auto args = ["blah"];
auto opts = [opt::optmulti("t")];
@@ -365,6 +395,7 @@ fn test_optmulti_short_missing() {
}
}

#[test]
fn test_optmulti_short_no_arg() {
auto args = ["-t"];
auto opts = [opt::optmulti("t")];
@@ -375,6 +406,7 @@ fn test_optmulti_short_no_arg() {
}
}

#[test]
fn test_optmulti_short_multi() {
auto args = ["-t", "20", "-t", "30"];
auto opts = [opt::optmulti("t")];
@@ -390,6 +422,7 @@ fn test_optmulti_short_multi() {
}
}

#[test]
fn test_unrecognized_option_long() {
auto args = ["--untest"];
auto opts = [opt::optmulti("t")];
@@ -400,6 +433,7 @@ fn test_unrecognized_option_long() {
}
}

#[test]
fn test_unrecognized_option_short() {
auto args = ["-t"];
auto opts = [opt::optmulti("test")];
@@ -410,6 +444,7 @@ fn test_unrecognized_option_short() {
}
}

#[test]
fn test_combined() {
auto args =
["prog", "free1", "-s", "20", "free2", "--flag", "--long=30", "-f",
@@ -435,40 +470,3 @@ fn test_combined() {
}
}

fn main() {
test_reqopt_long();
test_reqopt_long_missing();
test_reqopt_long_no_arg();
test_reqopt_long_multi();
test_reqopt_short();
test_reqopt_short_missing();
test_reqopt_short_no_arg();
test_reqopt_short_multi();
test_optopt_long();
test_optopt_long_missing();
test_optopt_long_no_arg();
test_optopt_long_multi();
test_optopt_short();
test_optopt_short_missing();
test_optopt_short_no_arg();
test_optopt_short_multi();
test_optflag_long();
test_optflag_long_missing();
test_optflag_long_arg();
test_optflag_long_multi();
test_optflag_short();
test_optflag_short_missing();
test_optflag_short_arg();
test_optflag_short_multi();
test_optmulti_long();
test_optmulti_long_missing();
test_optmulti_long_no_arg();
test_optmulti_long_multi();
test_optmulti_short();
test_optmulti_short_missing();
test_optmulti_short_no_arg();
test_optmulti_short_multi();
test_unrecognized_option_long();
test_unrecognized_option_short();
test_combined();
}
@@ -1,3 +1,5 @@

use std;
import std::int;
import std::str::eq;

@@ -1,11 +1,11 @@
// xfail-stage0
// -*- rust -*-
use std;
import std::io;
import std::str;

#[cfg(target_os = "linux")]
#[cfg(target_os = "win32")]
#[test]
fn test_simple() {
let str tmpfile = "test/run-pass/lib-io-test-simple.tmp";
log tmpfile;
@@ -24,8 +24,7 @@ fn test_simple() {

// FIXME (726)
#[cfg(target_os = "macos")]
#[test]
#[ignore]
fn test_simple() {}

fn main() {
test_simple();
}
@@ -1,4 +1,3 @@
// xfail-stage0

use std;
import std::ivec;
@@ -18,13 +17,15 @@ fn square_if_odd(&uint n) -> option::t[uint] {

fn add(&uint x, &uint y) -> uint { ret x + y; }

#[test]
fn test_reserve_and_on_heap() {
let int[] v = ~[ 1, 2 ];
assert (!ivec::on_heap(v));
ivec::reserve(v, 8u);
assert (ivec::on_heap(v));
}

#[test]
fn test_unsafe_ptrs() {
// Test on-stack copy-from-buf.
auto a = ~[ 1, 2, 3 ];
@@ -49,6 +50,7 @@ fn test_unsafe_ptrs() {
assert (d.(4) == 5);
}

#[test]
fn test_init_fn() {
// Test on-stack init_fn.
auto v = ivec::init_fn(square, 3u);
@@ -67,6 +69,7 @@ fn test_init_fn() {
assert (v.(4) == 16u);
}

#[test]
fn test_init_elt() {
// Test on-stack init_elt.
auto v = ivec::init_elt(10u, 2u);
@@ -84,22 +87,26 @@ fn test_init_elt() {
assert (v.(5) == 20u);
}

#[test]
fn test_is_empty() {
assert ivec::is_empty[int](~[]);
assert !ivec::is_empty(~[0]);
}

#[test]
fn test_is_not_empty() {
assert ivec::is_not_empty(~[0]);
assert !ivec::is_not_empty[int](~[]);
}

#[test]
fn test_head() {
auto a = ~[11, 12];
check ivec::is_not_empty(a);
assert ivec::head(a) == 11;
}

#[test]
fn test_tail() {
auto a = ~[11];
check ivec::is_not_empty(a);
@@ -110,6 +117,7 @@ fn test_tail() {
assert ivec::tail(a) == ~[12];
}

#[test]
fn test_last() {
auto n = ivec::last(~[]);
assert (n == none);
@@ -119,6 +127,7 @@ fn test_last() {
assert (n == some(5));
}

#[test]
fn test_slice() {
// Test on-stack -> on-stack slice.
auto v = ivec::slice(~[ 1, 2, 3 ], 1u, 3u);
@@ -143,6 +152,7 @@ fn test_slice() {
assert (v.(4) == 6);
}

#[test]
fn test_pop() {
// Test on-stack pop.
auto v = ~[ 1, 2, 3 ];
@@ -163,6 +173,7 @@ fn test_pop() {
assert (e == 5);
}

#[test]
fn test_grow() {
// Test on-stack grow().
auto v = ~[];
@@ -181,6 +192,7 @@ fn test_grow() {
assert (v.(4) == 2);
}

#[test]
fn test_grow_fn() {
auto v = ~[];
ivec::grow_fn(v, 3u, square);
@@ -190,6 +202,7 @@ fn test_grow_fn() {
assert (v.(2) == 4u);
}

#[test]
fn test_grow_set() {
auto v = ~[ mutable 1, 2, 3 ];
ivec::grow_set(v, 4u, 4, 5);
@@ -201,6 +214,7 @@ fn test_grow_set() {
assert (v.(4) == 5);
}

#[test]
fn test_map() {
// Test on-stack map.
auto v = ~[ 1u, 2u, 3u ];
@@ -221,6 +235,7 @@ fn test_map() {
assert (w.(4) == 25u);
}

#[test]
fn test_filter_map() {
// Test on-stack filter-map.
auto v = ~[ 1u, 2u, 3u ];
@@ -238,6 +253,7 @@ fn test_filter_map() {
assert (w.(2) == 25u);
}

#[test]
fn test_foldl() {
// Test on-stack fold.
auto v = ~[ 1u, 2u, 3u ];
@@ -250,6 +266,7 @@ fn test_foldl() {
assert (sum == 15u);
}

#[test]
fn test_any_and_all() {
assert (ivec::any(is_three, ~[ 1u, 2u, 3u ]));
assert (!ivec::any(is_three, ~[ 0u, 1u, 2u ]));
@@ -279,38 +296,6 @@ fn test_zip_unzip() {
assert tup(3, 6) == tup(u1._0.(2), u1._1.(2));
}

fn main() {
test_reserve_and_on_heap();
test_unsafe_ptrs();

// Predicates
test_is_empty();
test_is_not_empty();

// Accessors
test_init_fn();
test_init_elt();
test_head();
test_tail();
test_last();
test_slice();

// Mutators
test_pop();

// Appending
test_grow();
test_grow_fn();
test_grow_set();

// Functional utilities
test_map();
test_filter_map();
test_foldl();
test_any_and_all();
test_zip_unzip();
}

// Local Variables:
// mode: rust;
// fill-column: 78;
@@ -6,20 +6,23 @@ import std::list::cdr;
import std::list::from_vec;
import std::option;

#[test]
fn test_from_vec() {
auto l = from_vec([0, 1, 2]);
assert (car(l) == 0);
assert (car(cdr(l)) == 1);
assert (car(cdr(cdr(l))) == 2);
}

#[test]
fn test_foldl() {
auto l = from_vec([0, 1, 2, 3, 4]);
fn add(&int a, &uint b) -> uint { ret (a as uint) + b; }
auto rs = list::foldl(l, 0u, add);
assert (rs == 10u);
}

#[test]
fn test_find_success() {
auto l = from_vec([0, 1, 2]);
fn match(&int i) -> option::t[int] {
@@ -29,13 +32,15 @@ fn test_find_success() {
assert (rs == option::some(2));
}

#[test]
fn test_find_fail() {
auto l = from_vec([0, 1, 2]);
fn match(&int i) -> option::t[int] { ret option::none[int]; }
auto rs = list::find(l, match);
assert (rs == option::none[int]);
}

#[test]
fn test_has() {
auto l = from_vec([5, 8, 6]);
auto empty = list::nil[int];
@@ -45,16 +50,9 @@ fn test_has() {
assert (!list::has(empty, 5));
}

#[test]
fn test_length() {
auto l = from_vec([0, 1, 2]);
assert (list::length(l) == 3u);
}

fn main() {
test_from_vec();
test_foldl();
test_find_success();
test_find_fail();
test_length();
test_has();
}
@@ -7,6 +7,7 @@ import std::str;
import std::uint;
import std::util;

#[test]
fn test_simple() {
log "*** starting test_simple";
fn eq_uint(&uint x, &uint y) -> bool { ret x == y; }
@@ -83,6 +84,7 @@ fn test_simple() {
/**
* Force map growth and rehashing.
*/
#[test]
fn test_growth() {
log "*** starting test_growth";
let uint num_to_insert = 64u;
@@ -162,6 +164,7 @@ fn test_growth() {
log "*** finished test_growth";
}

#[test]
fn test_removal() {
log "*** starting test_removal";
let uint num_to_insert = 64u;
@@ -262,6 +265,7 @@ fn test_removal() {
log "*** finished test_removal";
}

#[test]
fn test_contains_key() {
auto key = "k";
auto map = map::mk_hashmap[str, str](str::hash, str::eq);
@@ -270,18 +274,11 @@ fn test_contains_key() {
assert (map.contains_key(key));
}

#[test]
fn test_find() {
auto key = "k";
auto map = map::mk_hashmap[str, str](str::hash, str::eq);
assert (std::option::is_none(map.find(key)));
map.insert(key, "val");
assert (std::option::get(map.find(key)) == "val");
}

fn main() {
test_simple();
test_growth();
test_removal();
test_contains_key();
test_find();
}
@@ -0,0 +1,5 @@

use std;

#[test]
fn test() { auto x = std::option::some[int](10); }
@@ -1,7 +1,3 @@
// xfail-stage0

use std;

import std::generic_os::setenv;
import std::generic_os::getenv;
import std::option;
@@ -33,12 +29,6 @@ fn test_getenv_big() {
assert getenv("NAME") == option::some(s);
}

fn main() {
test_setenv();
test_setenv_overwrite();
test_getenv_big();
}

// Local Variables:
// mode: rust;
// fill-column: 78;
@@ -1,4 +1,3 @@
// xfail-stage0

// Testing a few of the path manipuation functions

@@ -7,7 +6,8 @@ use std;
import std::fs;
import std::os;

fn main() {
#[test]
fn test() {
assert(!fs::path_is_absolute("test-path"));

log "Current working directory: " + os::getcwd();
@@ -1,12 +1,11 @@
// xfail-stage0

use std;
import std::ptr;
import std::unsafe;

type pair = rec(mutable int fst, mutable int snd);

fn main() {
#[test]
fn test() {
auto p = rec(mutable fst=10, mutable snd=20);
let *mutable pair pptr = ptr::addr_of(p);
let *mutable int iptr = unsafe::reinterpret_cast(pptr);
@@ -1,6 +1,10 @@

use std;

import std::sort;
import std::ivec;
import std::int;

fn check_sort(vec[mutable int] v1, vec[mutable int] v2) {
auto len = std::vec::len[int](v1);
fn ltequal(&int a, &int b) -> bool { ret a <= b; }
@@ -10,7 +14,8 @@ fn check_sort(vec[mutable int] v1, vec[mutable int] v2) {
while (i < len) { log v2.(i); assert (v2.(i) == v1.(i)); i += 1u; }
}

fn main() {
#[test]
fn test() {
{
auto v1 = [mutable 3, 7, 4, 5, 2, 9, 5, 8];
auto v2 = [mutable 2, 3, 4, 5, 5, 7, 8, 9];
@@ -33,6 +38,24 @@ fn main() {
check_sort(v1, v2);
}
}

// Regression test for #705
#[test]
fn test_simple() {
auto names = ~[mutable 2, 1, 3];

auto expected = ~[1, 2, 3];

fn lteq(&int a, &int b) -> bool { int::le(a, b) }
sort::ivector::quick_sort(lteq, names);

auto pairs = ivec::zip(expected, ivec::from_mut(names));
for (tup(int, int) p in pairs) {
log #fmt("%d %d", p._0, p._1);
assert p._0 == p._1;
}
}

// Local Variables:
// mode: rust;
// fill-column: 78;
@@ -12,7 +12,8 @@ fn check_sort(vec[mutable int] v1, vec[mutable int] v2) {
while (i < len) { log v2.(i); assert (v2.(i) == v1.(i)); i += 1u; }
}

fn main() {
#[test]
fn test() {
{
auto v1 = [mutable 3, 7, 4, 5, 2, 9, 5, 8];
auto v2 = [mutable 2, 3, 4, 5, 5, 7, 8, 9];
@@ -4,7 +4,8 @@
use std;
import std::rand;

fn main() {
#[test]
fn test() {
let rand::rng r1 = rand::mk_rng();
log r1.next();
log r1.next();
@@ -1,22 +1,18 @@
// xfail-stage0

use std;
import std::run;

// Regression test for memory leaks
// FIXME (714) Why does this fail on win32?

#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
#[test]
fn test_leaks() {
run::run_program("echo", []);
run::start_program("echo", []);
run::program_output("echo", []);
}

// FIXME
#[cfg(target_os = "win32")]
#[test]
#[ignore]
fn test_leaks() {}

fn main() {
test_leaks();
}
@@ -1,3 +1,8 @@


// -*- rust -*-

use std;
import std::sha1;
import std::vec;
import std::str;
@@ -10,7 +10,8 @@ fn check_sort(vec[int] v1, vec[int] v2) {
while (i < len) { log v3.(i); assert (v3.(i) == v2.(i)); i += 1u; }
}

fn main() {
#[test]
fn test() {
{
auto v1 = [3, 7, 4, 5, 2, 9, 5, 8];
auto v2 = [2, 3, 4, 5, 5, 7, 8, 9];
@@ -1,4 +1,3 @@
// xfail-stage0

use std;

@@ -11,7 +10,8 @@ fn check_sort(&int[] v1, &int[] v2) {
while (i < len) { log v3.(i); assert (v3.(i) == v2.(i)); i += 1u; }
}

fn main() {
#[test]
fn test() {
{
auto v1 = ~[3, 7, 4, 5, 2, 9, 5, 8];
auto v2 = ~[2, 3, 4, 5, 5, 7, 8, 9];
@@ -1,8 +1,35 @@
use std;

mod sha1;
mod bitv;
mod box;
mod deque;
mod either;
mod fs;
mod getopts;
mod int;
mod io;
mod ivec;
mod list;
mod map;
mod option;
mod os;
mod path;
mod ptr;
mod qsort3;
mod qsort;
mod rand;
mod run;
mod sha1;
mod sort_ivec;
mod sort;
mod str_buf;
mod str;
mod task;
mod test;
mod uint;
mod vec;
mod vec_str_conversions;

// Local Variables:
// mode: rust
// fill-column: 78;
@@ -1,9 +1,7 @@


// xfail-stage0
use std;
import std::str;

#[test]
fn test_bytes_len() {
assert (str::byte_len("") == 0u);
assert (str::byte_len("hello world") == 11u);
@@ -14,6 +12,7 @@ fn test_bytes_len() {
assert (str::byte_len("\U0001d11e") == 4u);
}

#[test]
fn test_index_and_rindex() {
assert (str::index("hello", 'e' as u8) == 1);
assert (str::index("hello", 'o' as u8) == 4);
@@ -23,6 +22,7 @@ fn test_index_and_rindex() {
assert (str::rindex("hello", 'z' as u8) == -1);
}

#[test]
fn test_split() {
fn t(&str s, char c, int i, &str k) {
log "splitting: " + s;
@@ -42,6 +42,7 @@ fn test_split() {
t("...hello.there.", '.', 5, "");
}

#[test]
fn test_find() {
fn t(&str haystack, &str needle, int i) {
let int j = str::find(haystack, needle);
@@ -56,6 +57,7 @@ fn test_find() {
t("this", "simple", -1);
}

#[test]
fn test_substr() {
fn t(&str a, &str b, int start) {
assert (str::eq(str::substr(a, start as uint, str::byte_len(b)), b));
@@ -65,6 +67,7 @@ fn test_substr() {
t("substr should not be a challenge", "not", 14);
}

#[test]
fn test_concat() {
fn t(&vec[str] v, &str s) { assert (str::eq(str::concat(v), s)); }
t(["you", "know", "I'm", "no", "good"], "youknowI'mnogood");
@@ -73,6 +76,7 @@ fn test_concat() {
t(["hi"], "hi");
}

#[test]
fn test_connect() {
fn t(&vec[str] v, &str sep, &str s) {
assert (str::eq(str::connect(v, sep), s));
@@ -83,6 +87,7 @@ fn test_connect() {
t(["hi"], " ", "hi");
}

#[test]
fn test_to_upper() {
// to_upper doesn't understand unicode yet,
// but we need to at least preserve it
@@ -94,6 +99,7 @@ fn test_to_upper() {
assert (str::eq(expected, actual));
}

#[test]
fn test_slice() {
assert (str::eq("ab", str::slice("abc", 0u, 2u)));
assert (str::eq("bc", str::slice("abc", 1u, 3u)));
@@ -114,6 +120,7 @@ fn test_slice() {
str::slice(a_million_letter_a(), 0u, 500000u)));
}

#[test]
fn test_ends_with() {
assert (str::ends_with("", ""));
assert (str::ends_with("abc", ""));
@@ -122,16 +129,19 @@ fn test_ends_with() {
assert (!str::ends_with("", "abc"));
}

#[test]
fn test_is_empty() {
assert str::is_empty("");
assert !str::is_empty("a");
}

#[test]
fn test_is_not_empty() {
assert str::is_not_empty("a");
assert !str::is_not_empty("");
}

#[test]
fn test_replace() {
auto a = "a";
check str::is_not_empty(a);
@@ -145,22 +155,6 @@ fn test_replace() {
assert str::replace(" test test ", test, "") == " ";
}

fn main() {
test_bytes_len();
test_index_and_rindex();
test_split();
test_find();
test_substr();
test_concat();
test_connect();
test_to_upper();
test_slice();
test_ends_with();
test_is_empty();
test_is_not_empty();
test_replace();
}


// Local Variables:
// mode: rust;
@@ -4,7 +4,8 @@
use std;
import std::str;

fn main() {
#[test]
fn test() {
auto s = "hello";
auto sb = str::buf(s);
auto s_cstr = str::str_from_cstr(sb);
@@ -1,12 +1,11 @@


// xfail-stage0

use std;
import std::task;

#[test]
#[ignore]
fn test_sleep() { task::sleep(1000000u); }

#[test]
fn test_unsupervise() {
fn f() {
task::unsupervise();
@@ -15,6 +14,7 @@ fn test_unsupervise() {
spawn f();
}

#[test]
fn test_join() {
fn winner() {
}
@@ -32,10 +32,3 @@ fn test_join() {

assert task::join(failtask) == task::tr_failure;
}

fn main() {
// FIXME: Why aren't we running this?
//test_sleep();
test_unsupervise();
test_join();
}
@@ -4,7 +4,8 @@
use std;
import std::uint;

fn main() {
#[test]
fn test_next_power_of_two() {
assert (uint::next_power_of_two(0u) == 0u);
assert (uint::next_power_of_two(1u) == 1u);
assert (uint::next_power_of_two(2u) == 2u);
@@ -4,6 +4,7 @@ use std;
import std::vec::*;
import std::option;

#[test]
fn test_init_elt() {
let vec[uint] v = init_elt[uint](5u, 3u);
assert (len[uint](v) == 3u);
@@ -14,6 +15,7 @@ fn test_init_elt() {

fn id(uint x) -> uint { ret x; }

#[test]
fn test_init_fn() {
let fn(uint) -> uint op = id;
let vec[uint] v = init_fn[uint](op, 5u);
@@ -25,6 +27,7 @@ fn test_init_fn() {
assert (v.(4) == 4u);
}

#[test]
fn test_slice() {
let vec[int] v = [1, 2, 3, 4, 5];
auto v2 = slice[int](v, 2u, 4u);
@@ -33,6 +36,7 @@ fn test_slice() {
assert (v2.(1) == 4);
}

#[test]
fn test_map() {
fn square(&int x) -> int { ret x * x; }
let option::operator[int, int] op = square;
@@ -42,6 +46,7 @@ fn test_map() {
while (i < 5) { assert (v.(i) * v.(i) == s.(i)); i += 1; }
}

#[test]
fn test_map2() {
fn times(&int x, &int y) -> int { ret x * y; }
auto f = times;
@@ -52,6 +57,7 @@ fn test_map2() {
while (i < 5) { assert (v0.(i) * v1.(i) == u.(i)); i += 1; }
}

#[test]
fn test_filter_map() {
fn halve(&int i) -> option::t[int] {
if (i % 2 == 0) {
@@ -71,6 +77,7 @@ fn test_filter_map() {
assert (filter_map(halve, mix) == mix_dest);
}

#[test]
fn test_position() {
let vec[int] v1 = [1, 2, 3, 3, 2, 5];
assert (position(1, v1) == option::some[uint](0u));
@@ -79,6 +86,7 @@ fn test_position() {
assert (position(4, v1) == option::none[uint]);
}

#[test]
fn test_position_pred() {
fn less_than_three(&int i) -> bool {
ret i <3;
@@ -90,14 +98,3 @@ fn test_position_pred() {
assert (position_pred(less_than_three, v1) == option::some[uint](3u));
assert (position_pred(is_eighteen, v1) == option::none[uint]);
}

fn main() {
test_init_elt();
test_init_fn();
test_slice();
test_map();
test_map2();
test_filter_map();
test_position();
test_position_pred();
}
@@ -5,6 +5,7 @@ use std;
import std::str;
import std::vec;

#[test]
fn test_simple() {
let str s1 = "All mimsy were the borogoves";
/*
@@ -31,5 +32,3 @@ fn test_simple() {
log "refcnt is";
log str::refcount(s1);
}

fn main() { test_simple(); }