Fix run-pass tests to have 'pub fn main'

This is required by the check-fast target because each test is slurped up into a
submodule.
This commit is contained in:
Alex Crichton 2013-09-25 00:43:37 -07:00
parent 10a583ce1a
commit 30862a64c2
137 changed files with 145 additions and 143 deletions

View File

@ -29,6 +29,8 @@ for t in os.listdir(run_pass):
if not ("xfail-test" in s or
"xfail-fast" in s or
"xfail-win32" in s):
if not "pub fn main" in s and "fn main" in s:
print("Warning: no public entry point in " + t)
stage2_tests.append(t)
f.close()

View File

@ -20,6 +20,6 @@ impl<T> Drop for Test<T> {
fn drop(&mut self) { }
}
fn main() {
pub fn main() {
assert_eq!(size_of::<int>(), size_of::<Test<int>>());
}

View File

@ -26,4 +26,4 @@ impl Foo {
fn check_id(&mut self, s: int) { fail!() }
}
fn main() { }
pub fn main() { }

View File

@ -43,5 +43,5 @@ fn match_mut_reg(v: &mut Option<int>) {
}
}
fn main() {
pub fn main() {
}

View File

@ -10,6 +10,6 @@
// Regression test for issue #7740
fn main() {
pub fn main() {
static A: &'static char = &'A';
}

View File

@ -26,7 +26,7 @@ fn noncopyable() -> noncopyable {
struct wrapper(noncopyable);
fn main() {
pub fn main() {
let x1 = wrapper(noncopyable());
let _x2 = *x1;
}

View File

@ -50,5 +50,5 @@ fn box_imm_recs(v: &Outer) {
borrow(v.f.g.h); // OK
}
fn main() {
pub fn main() {
}

View File

@ -27,7 +27,7 @@
// run-fail/borrowck-wg-autoderef-and-autoborrowvec-combined-fail-issue-6272.rs
fn main() {
pub fn main() {
let a = @mut 3i;
let b = @mut [a];
let c = @mut [3];

View File

@ -33,7 +33,7 @@ impl<T: Speak> Speak for Option<T> {
}
fn main() {
pub fn main() {
assert_eq!(3.hi(), ~"hello: 3");
assert_eq!(Some(Some(3)).hi(), ~"something!something!hello: 3");
assert_eq!(None::<int>.hi(), ~"hello - none");

View File

@ -26,7 +26,7 @@ fn foo<T: Foo>(val: T, chan: comm::Chan<T>) {
chan.send(val);
}
fn main() {
pub fn main() {
let (p,c) = comm::stream();
foo(31337, c);
assert!(p.recv() == 31337);

View File

@ -22,7 +22,7 @@ fn foo<T: Foo>(val: T, chan: comm::Chan<T>) {
chan.send(val);
}
fn main() {
pub fn main() {
let (p,c) = comm::stream();
foo(31337, c);
assert!(p.recv() == 31337);

View File

@ -18,4 +18,4 @@ struct X<T>(());
impl <T> Foo for X<T> { }
fn main() { }
pub fn main() { }

View File

@ -21,7 +21,7 @@ trait Foo : Send {
impl <T: Send> Foo for T { }
fn main() {
pub fn main() {
let (p,c) = comm::stream();
1193182.foo(c);
assert!(p.recv() == 1193182);

View File

@ -14,4 +14,4 @@ trait Foo : Send { }
impl Foo for int { }
fn main() { }
pub fn main() { }

View File

@ -15,4 +15,4 @@ trait Foo : Send { }
impl <T: Send> Foo for T { }
fn main() { }
pub fn main() { }

View File

@ -25,10 +25,10 @@ fn bar(t: @mut T) {
t.foo();
}
fn main() {
pub fn main() {
let s = @mut S { unused: 0 };
let s2 = s as @mut T;
s2.foo();
bar(s2);
bar(s as @mut T);
}
}

View File

@ -14,7 +14,7 @@ fn foo(blk: ~fn:Send()) {
blk();
}
fn main() {
pub fn main() {
let (p,c) = comm::stream();
do foo {
c.send(());

View File

@ -56,7 +56,7 @@ static am: bool = 2 > 1;
static an: bool = 2 > -2;
static ao: bool = 1.0 > -2.0;
fn main() {
pub fn main() {
assert_eq!(a, -1);
assert_eq!(a2, 6);
assert_approx_eq!(b, 5.7);

View File

@ -10,4 +10,4 @@ struct Bar {
static bar: Bar = Bar { i: 0, v: IntVal(0) };
fn main() {}
pub fn main() {}

View File

@ -12,4 +12,4 @@ trait Foo {
fn m(&self, _:int) { }
}
fn main() { }
pub fn main() { }

View File

@ -31,6 +31,6 @@ impl Y for int {
impl Z for int;
fn main() {
pub fn main() {
assert_eq!(12.x(), 12);
}

View File

@ -15,7 +15,7 @@ enum E<T,U> {
C
}
fn main() {
pub fn main() {
let _ = A::<int, int>(1i).clone();
let _ = B(1i, 1.234).deep_clone();
}

View File

@ -11,6 +11,6 @@
#[deriving(Clone, DeepClone)]
struct S<T>(T, ());
fn main() {
pub fn main() {
let _ = S(1i, ()).clone().deep_clone();
}

View File

@ -31,4 +31,4 @@ struct S {
_nil: ()
}
fn main() {}
pub fn main() {}

View File

@ -35,7 +35,7 @@ struct ShortCircuit {
y: FailCmp
}
fn main() {
pub fn main() {
let a = ShortCircuit { x: 1, y: FailCmp };
let b = ShortCircuit { x: 2, y: FailCmp };

View File

@ -13,7 +13,7 @@ struct A<'self> {
x: &'self int
}
fn main() {
pub fn main() {
let a = A { x: &1 };
let b = A { x: &2 };

View File

@ -34,7 +34,7 @@ impl ToStr for Custom {
fn to_str(&self) -> ~str { ~"yay" }
}
fn main() {
pub fn main() {
assert_eq!(B1.to_str(), ~"B1");
assert_eq!(B2.to_str(), ~"B2");
assert_eq!(C1(3).to_str(), ~"C1(3)");

View File

@ -33,7 +33,7 @@ struct Lots {
j: (),
}
fn main() {
pub fn main() {
let lots: Lots = Zero::zero();
assert!(lots.is_zero());
}

View File

@ -12,7 +12,7 @@ enum Hero {
Spiderman = -4
}
fn main() {
pub fn main() {
let pet: Animal = Snake;
let hero: Hero = Superman;
assert!(pet as uint == 3);

View File

@ -15,7 +15,7 @@ enum Flopsy {
static BAR:uint = Bunny as uint;
static BAR2:uint = BAR;
fn main() {
pub fn main() {
let _v = [0, .. Bunny as uint];
let _v = [0, .. BAR];
let _v = [0, .. BAR2];

View File

@ -1,6 +1,6 @@
use std::io::println;
fn main() {
pub fn main() {
let v: ~[int] = ~[ 1, ..5 ];
println(v[0].to_str());
println(v[1].to_str());

View File

@ -12,7 +12,7 @@
extern fn f(x: uint) -> uint { x * 2 }
fn main() {
pub fn main() {
#[fixed_stack_segment];
let x = f(22);

View File

@ -19,7 +19,7 @@ extern fn uintvoidret(_x: uint) {}
extern fn uintuintuintuintret(x: uint, y: uint, z: uint) -> uint { x+y+z }
fn main() {
pub fn main() {
assert_eq!(voidret1, voidret1);
assert!(voidret1 != voidret2);

View File

@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
assert!(option_env!("__HOPEFULLY_DOESNT_EXIST__").is_none());
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
// Make sure that this view item is filtered out because otherwise it would
// trigger a compilation error
#[cfg(not_present)] use foo = bar;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
let x = [1,..100];
let mut y = 0;
for i in x.iter() {

View File

@ -14,7 +14,7 @@ use std::hashmap::HashMap;
// outside the loop, breaks, then _picks back up_ and continues
// iterating with it.
fn main() {
pub fn main() {
let mut h = HashMap::new();
let kvs = [(1, 10), (2, 20), (3, 30)];
for &(k,v) in kvs.iter() {
@ -38,4 +38,4 @@ fn main() {
assert_eq!(x, 6);
assert_eq!(y, 60);
}
}

View File

@ -10,7 +10,7 @@
use std::hashmap::HashMap;
fn main() {
pub fn main() {
let mut h = HashMap::new();
let kvs = [(1, 10), (2, 20), (3, 30)];
for &(k,v) in kvs.iter() {
@ -24,4 +24,4 @@ fn main() {
}
assert_eq!(x, 6);
assert_eq!(y, 60);
}
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
let x = [1,..100];
let mut y = 0;
for (n,i) in x.iter().enumerate() {

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
let x = [1,..100];
let y = [2,..100];
let mut p = 0;

View File

@ -8,11 +8,11 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
let x = [1,..100];
let mut y = 0;
for i in x.iter() {
y += *i
}
assert!(y == 100);
}
}

View File

@ -11,10 +11,10 @@ fn foo(Foo {x, _}: Foo) -> *uint {
addr
}
fn main() {
pub fn main() {
let obj = ~1;
let objptr: *uint = &*obj;
let f = Foo {x: obj, y: ~2};
let xptr = foo(f);
assert_eq!(objptr, xptr);
}
}

View File

@ -13,7 +13,7 @@ fn checkval(~ref x: ~uint) -> uint {
*x
}
fn main() {
pub fn main() {
let obj = ~1;
let objptr: *uint = &*obj;
let xptr = getaddr(obj);

View File

@ -5,6 +5,6 @@ fn foo((x, _): (int, int)) -> int {
x
}
fn main() {
pub fn main() {
assert_eq!(foo((22, 23)), 22);
}

View File

@ -22,6 +22,6 @@ impl<T> vec_utils<T> for ~[T] {
}
}
fn main() {
pub fn main() {
assert_eq!(vec_utils::map_(&~[1,2,3], |&x| x+1), ~[2,3,4]);
}

View File

@ -12,7 +12,7 @@ mod x {
pub fn g() -> uint {14}
}
fn main(){
pub fn main(){
// should *not* shadow the module x:
let x = 9;
// use it to avoid warnings:

View File

@ -23,4 +23,4 @@ impl A for E {
fn b<F,G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 1 bound, but
}
fn main() {}
pub fn main() {}

View File

@ -18,4 +18,4 @@ impl HasNested {
}
}
fn main() {}
pub fn main() {}

View File

@ -10,7 +10,7 @@
use std::io;
fn main() {
pub fn main() {
let stdout = &io::stdout() as &io::WriterUtil;
stdout.write_line("Hello!");
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
let (port, chan) = stream();
do spawn {

View File

@ -21,7 +21,7 @@ impl Drop for NonCopyable {
}
}
fn main() {
pub fn main() {
let t = ~0;
let p = unsafe { transmute::<~int, *c_void>(t) };
let _z = NonCopyable(p);

View File

@ -37,7 +37,7 @@ fn print_name(x: &Debuggable)
println(fmt!("debug_name = %s", x.debug_name()));
}
fn main() {
pub fn main() {
let thing = Thing::new();
print_name(&thing as &Debuggable);
}

View File

@ -22,7 +22,7 @@ macro_rules! print_hd_tl (
})
)
fn main() {
pub fn main() {
print_hd_tl!(x, y, z, w)
}

View File

@ -39,6 +39,6 @@ impl Scheduler {
}
}
fn main() {
pub fn main() {
let _sched = Scheduler::new(~UvEventLoop::new() as ~EventLoop);
}

View File

@ -10,7 +10,7 @@
// Regression test for issue #5239
fn main() {
pub fn main() {
let _f: &fn(int) -> int = |ref x: int| { *x };
let foo = 10;
assert!(_f(foo) == 10);

View File

@ -20,6 +20,6 @@ impl FontTableTagConversions for FontTableTag {
}
}
fn main() {
pub fn main() {
5.tag_to_str();
}

View File

@ -10,7 +10,7 @@
struct A(bool);
fn main() {
pub fn main() {
let f = A;
f(true);
}

View File

@ -20,6 +20,6 @@ impl Fooable for uint {
}
}
fn main() {
pub fn main() {
2.yes();
}

View File

@ -21,4 +21,4 @@ fn gl_err_str(err: u32) -> ~str
}
}
fn main() {}
pub fn main() {}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
pub fn main() {
let box1 = @mut 42;
let _x = *(&mut *box1) == 42 || *(&mut *box1) == 31337;
}

View File

@ -10,7 +10,7 @@
#[allow(dead_assignment)];
fn main() {
pub fn main() {
let s: ~str = ~"foobar";
let mut t: &str = s;
t = t.slice(0, 3); // for master: str::view(t, 0, 3) maybe

View File

@ -1,3 +1,3 @@
fn foo<T: ::std::cmp::Eq>(_t: T) { }
fn main() { }
pub fn main() { }

View File

@ -19,7 +19,7 @@ failed to typecheck correctly.
struct X { vec: &'static [int] }
static V: &'static [X] = &[X { vec: &[1, 2, 3] }];
fn main() {
pub fn main() {
for &v in V.iter() {
println(fmt!("%?", v.vec));
}

View File

@ -39,7 +39,7 @@ impl<'self> Outer<'self> {
}
}
fn main() {
pub fn main() {
let inner = 5;
let outer = Outer::new(&inner as &Inner);
outer.inner.print();

View File

@ -12,7 +12,7 @@
use std::io;
fn main() {
pub fn main() {
return;
while io::stdin().read_line() != ~"quit" { };
}

View File

@ -10,6 +10,6 @@
struct T (&'static [int]);
static t : T = T (&'static [5, 4, 3]);
fn main () {
pub fn main () {
assert_eq!(t[0], 5);
}

View File

@ -21,7 +21,7 @@ impl<E> Graph<int, E> for HashMap<int, int> {
}
}
fn main() {
pub fn main() {
let g : ~HashMap<int, int> = ~HashMap::new();
let _g2 : ~Graph<int,int> = g as ~Graph<int,int>;
}

View File

@ -10,7 +10,7 @@
#[deny(type_limits)];
fn main() {
pub fn main() {
let i: uint = 0;
assert!(i <= 0xFFFF_FFFF_u);

View File

@ -2,7 +2,7 @@ fn run(f: &fn()) {
f()
}
fn main() {
pub fn main() {
let f: ~fn() = || ();
run(f);
}
}

View File

@ -13,7 +13,7 @@ fn swap(f: &fn(~[int]) -> ~[int]) -> ~[int] {
f(x)
}
fn main() {
pub fn main() {
let v = swap(|mut x| { x.push(4); x });
let w = do swap |mut x| { x.push(4); x };
assert_eq!(v, w);

View File

@ -15,4 +15,4 @@ impl Drop for A {
fn drop(&mut self) {}
}
fn main() {}
pub fn main() {}

View File

@ -13,7 +13,7 @@ impl Drop for A {
fn drop(&mut self) {}
}
fn main() {
pub fn main() {
let a = A { x: 0 };
let A { x: ref x } = a;

View File

@ -13,7 +13,7 @@ impl Drop for A {
fn drop(&mut self) {}
}
fn main() {
pub fn main() {
let a = A { x: 0 };
match a {

View File

@ -21,7 +21,7 @@ static test1: signature<'static> = signature {
pattern: &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32]
};
fn main() {
pub fn main() {
let test = &[0x243f6a88u32,0x85a308d3u32,0x13198a2eu32,0x03707344u32,0xa4093822u32,0x299f31d0u32];
println(fmt!("%b",test==test1.pattern));
}

View File

@ -22,7 +22,7 @@ fn baz() {
if "" == "" {}
}
fn main() {
pub fn main() {
bar();
baz();
}

View File

@ -14,6 +14,6 @@
fn foo(():()) { }
fn main() {
pub fn main() {
foo(());
}

View File

@ -14,7 +14,7 @@
*/
fn main() {}
pub fn main() {}
trait A {}
impl<T: 'static> A for T {}

View File

@ -20,6 +20,6 @@ struct MyStruct;
impl TraitWithDefaultMethod for MyStruct { }
fn main() {
pub fn main() {
MyStruct.method();
}

View File

@ -22,4 +22,4 @@ trait TragicallySelfIsNotSend: Send {
}
}
fn main(){}
pub fn main(){}

View File

@ -14,7 +14,7 @@ impl A for B {}
fn foo(_: &mut A) {}
fn main() {
pub fn main() {
let mut b = B;
foo(&mut b as &mut A);
}

View File

@ -20,6 +20,6 @@ fn foo(a: &mut A) {
C{ foo: a };
}
fn main() {
pub fn main() {
}

View File

@ -14,5 +14,5 @@ fn foo(a: &mut io::Writer) {
a.write([])
}
fn main(){}
pub fn main(){}

View File

@ -16,4 +16,4 @@ fn decode() -> ~str {
~""
}
fn main() {}
pub fn main() {}

View File

@ -19,4 +19,4 @@ macro_rules! silly_macro(
silly_macro!()
fn main() {}
pub fn main() {}

View File

@ -1,4 +1,4 @@
fn main() {
pub fn main() {
let x = ~"hello";
let ref y = x;
assert_eq!(x.slice(0, x.len()), y.slice(0, y.len()));

View File

@ -10,7 +10,7 @@
// shouldn't affect evaluation of $ex:
macro_rules! bad_macro (($ex:expr) => ({let _x = 9; $ex}))
fn main() {
pub fn main() {
let _x = 8;
assert_eq!(bad_macro!(_x),8)
}

View File

@ -26,7 +26,7 @@ static magic: uint = 42;
#[link_section="__DATA,__mut"]
static mut frobulator: uint = 0xdeadbeef;
fn main() {
pub fn main() {
unsafe {
frobulator = 0xcafebabe;
printfln!("%? %? %?", i_live_in_more_text(), magic, frobulator);

View File

@ -23,5 +23,5 @@ trait A {
}
}
fn main() {
pub fn main() {
}

View File

@ -18,4 +18,4 @@ struct ヒ;
static : uint = 0;
fn main() {}
pub fn main() {}

View File

@ -14,4 +14,4 @@
static mut bar: int = 2;
fn main() {}
pub fn main() {}

View File

@ -16,7 +16,7 @@ mod bar {
local_data_key!(pub baz: float)
}
fn main() {
pub fn main() {
local_data::get(foo, |x| assert!(x.is_none()));
local_data::get(bar::baz, |y| assert!(y.is_none()));

View File

@ -22,6 +22,6 @@ fn parse_args() -> ~str {
return ~""
}
fn main() {
pub fn main() {
io::println(parse_args());
}

View File

@ -20,6 +20,6 @@ macro_rules! match_inside_expansion(
)
)
fn main() {
pub fn main() {
assert_eq!(match_inside_expansion!(),129);
}

View File

@ -59,7 +59,7 @@ fn test5() {
}
}
fn main() {
pub fn main() {
test1();
test2();
test3();

View File

@ -1,7 +1,7 @@
static s: int = 1;
static e: int = 42;
fn main() {
pub fn main() {
match 7 {
s..e => (),
_ => (),

View File

@ -1,6 +1,6 @@
// Tests that matching rvalues with drops does not crash.
fn main() {
pub fn main() {
match ~[1, 2, 3] {
x => {
assert_eq!(x.len(), 3);

View File

@ -26,7 +26,7 @@ impl Trait<int> for S2 {
}
}
fn main() {
pub fn main() {
let _ = S::<int>::new::<float>(1, 1.0);
let _: S2 = Trait::<int>::new::<float>(1, 1.0);
}

View File

@ -12,7 +12,7 @@ fn to_str(sb: StringBuffer) -> ~str {
sb.s
}
fn main() {
pub fn main() {
let mut sb = StringBuffer {s: ~""};
sb.append("Hello, ");
sb.append("World!");

View File

@ -9,6 +9,6 @@
// except according to those terms.
// Test that multibyte characters don't crash the compiler
fn main() {
pub fn main() {
println("마이너스 사인이 없으면");
}

View File

@ -30,4 +30,4 @@ impl Foo {
}
}
fn main() {}
pub fn main() {}

Some files were not shown because too many files have changed in this diff Show More