test: Make all the run-pass tests use `pub fn main`

This commit is contained in:
Patrick Walton 2014-01-03 15:30:54 -08:00
parent 82a09b9a04
commit 02c1d2ff52
73 changed files with 73 additions and 73 deletions

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() {
struct A {
a: int,
w: B,

View File

@ -24,7 +24,7 @@ impl Foo {
}
}
fn main() {
pub fn main() {
let mut f = Foo {a: 22, b: 23};
f.inc_a(f.next_b());
assert_eq!(f.a, 22+23);

View File

@ -28,7 +28,7 @@ fn foo<T: RequiresRequiresFreezeAndSend>(val: T, chan: Chan<T>) {
chan.send(val);
}
fn main() {
pub fn main() {
let (p,c) = Chan::new();
foo(X(31337), c);
assert!(p.recv() == X(31337));

View File

@ -26,4 +26,4 @@ impl <T:Freeze+Send> RequiresRequiresFreezeAndSend for X<T> { }
impl <T:Pod> RequiresPod for X<T> { }
fn main() { }
pub fn main() { }

View File

@ -32,6 +32,6 @@ mod foo {
}
}
fn main() {
pub fn main() {
assert!(bar!())
}

View File

@ -32,6 +32,6 @@ mod foo {
}
}
fn main() {
pub fn main() {
assert!(!bar!())
}

View File

@ -13,6 +13,6 @@
extern mod cfg_inner_static;
fn main() {
pub fn main() {
cfg_inner_static::foo();
}

View File

@ -25,7 +25,7 @@ fn foo2() -> int { 2 }
fn foo2() -> int { 3 }
fn main() {
pub fn main() {
assert_eq!(1, foo1());
assert_eq!(3, foo2());
}

View File

@ -12,7 +12,7 @@
// compile-flags: --cfg ndebug
// exec-env:RUST_LOG=conditional-debug-macro-off=4
fn main() {
pub fn main() {
// only fails if debug! evaluates its argument.
debug!("{:?}", { if true { fail!() } });
}

View File

@ -11,7 +11,7 @@
// xfail-fast compile-flags directive doesn't work for check-fast
// exec-env:RUST_LOG=conditional-debug-macro-on=4
fn main() {
pub fn main() {
// exits early if debug! evaluates its arguments, otherwise it
// will hit the fail.
debug!("{:?}", { if true { return; } });

View File

@ -16,7 +16,7 @@ static foo: &'static str = cci_const::foopy;
static a: uint = cci_const::uint_val;
static b: uint = cci_const::uint_expr + 5;
fn main() {
pub fn main() {
assert_eq!(a, 12);
let foo2 = a;
assert_eq!(foo2, cci_const::uint_val);

View File

@ -13,7 +13,7 @@
extern mod cci_const;
fn main() {
pub fn main() {
let x = cci_const::uint_val;
match x {
cci_const::uint_val => {}

View File

@ -13,7 +13,7 @@
extern mod newtype_struct_xc;
fn main() {
pub fn main() {
let x = newtype_struct_xc::Au(21);
match x {
newtype_struct_xc::Au(n) => assert_eq!(n, 21)

View File

@ -39,4 +39,4 @@ mod submod {
}
fn main() {}
pub fn main() {}

View File

@ -32,7 +32,7 @@ enum D {
D2 { x: (), y: () }
}
fn main() {
pub fn main() {
// check there's no segfaults
20.times(|| {
rand::random::<A>();

View File

@ -26,4 +26,4 @@ mod hello;
#[cfg(target_os = "android")]
mod hello;
fn main() { }
pub fn main() { }

View File

@ -15,6 +15,6 @@ extern mod extern_calling_convention;
use extern_calling_convention::foo;
fn main() {
pub fn main() {
foo(1, 2, 3, 4);
}

View File

@ -27,7 +27,7 @@ pub mod bar {
#[no_mangle] pub fn fun5() {}
fn main() {
pub fn main() {
unsafe {
let a = DynamicLibrary::open(None).unwrap();
assert!(a.symbol::<int>("fun1").is_ok());

View File

@ -5,6 +5,6 @@ extern mod extern_mod_ordering_lib;
use extern_mod_ordering_lib::extern_mod_ordering_lib;
fn main() {
pub fn main() {
extern_mod_ordering_lib::f();
}

View File

@ -16,7 +16,7 @@
use std::os;
use std::io::process;
fn main () {
pub fn main () {
let args = os::args();
if args.len() > 1 && args[1] == ~"child" {
for _ in range(0, 1000) {

View File

@ -38,7 +38,7 @@ pub mod waldo {
}
}
fn main() {
pub fn main() {
let _x = baz::quux();
let _y = grault::garply();
let _z = waldo::plugh();

View File

@ -43,7 +43,7 @@ enum Bar3 {
}
}
fn main() {
pub fn main() {
let _f = Foo { foo: 3 };
let _f = Foo2 { foo: 3 };

View File

@ -13,4 +13,4 @@
extern mod unused = "issue-11224";
fn main() {}
pub fn main() {}

View File

@ -13,6 +13,6 @@
extern mod foo = "issue-11225-1";
fn main() {
pub fn main() {
foo::foo(1);
}

View File

@ -13,6 +13,6 @@
extern mod foo = "issue-11225-2";
fn main() {
pub fn main() {
foo::foo(1);
}

View File

@ -9,7 +9,7 @@
// except according to those terms.
// xfail-test FIXME #3290
fn main() {
pub fn main() {
let mut x = ~3;
x = x;
assert_eq!(*x, 3);

View File

@ -10,7 +10,7 @@
// xfail-test FIXME #3796
#[deny(dead_assignment)];
fn main() {
pub fn main() {
let mut x = 1;
let f: || -> int = || { x + 20 };
assert_eq!(f(), 21);

View File

@ -16,4 +16,4 @@ use numeric::{sin, Angle};
fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }
fn main() {}
pub fn main() {}

View File

@ -127,5 +127,5 @@ fn query2(cmd: ~[~str]) -> Result {
}
fn main() {
pub fn main() {
}

View File

@ -31,7 +31,7 @@ impl<T: X> Drop for Z<T> {
}
}
fn main() {
pub fn main() {
let y = Y;
let _z = Z{x: y};
}

View File

@ -12,4 +12,4 @@
// aux-build:issue-4545.rs
extern mod somelib = "issue-4545";
fn main() { somelib::mk::<int>(); }
pub fn main() { somelib::mk::<int>(); }

View File

@ -14,4 +14,4 @@ pub use local_alias = local;
mod local { }
fn main() {}
pub fn main() {}

View File

@ -48,7 +48,7 @@ fn use_c<S:C, T:B+A>(s: &S, t: &T) -> uint {
s.combine(t)
}
fn main() {
pub fn main() {
let foo = Foo;
let bar = Bar;
let r = use_c(&bar, &foo);

View File

@ -13,6 +13,6 @@
extern mod cross_crate_self = "issue-7178";
fn main() {
pub fn main() {
let _ = cross_crate_self::Foo::new(&1i);
}

View File

@ -14,6 +14,6 @@
extern mod minimal = "issue-8044";
use minimal::{BTree, leaf};
fn main() {
pub fn main() {
BTree::<int> { node: leaf(1) };
}

View File

@ -14,4 +14,4 @@
extern mod other = "issue-8259";
static a: other::Foo<'static> = other::A;
fn main() {}
pub fn main() {}

View File

@ -10,7 +10,7 @@
// xfail-test
fn main() {
pub fn main() {
// This is ok
match &[(~5,~7)] {
ps => {

View File

@ -13,7 +13,7 @@
extern mod issue_9188;
fn main() {
pub fn main() {
let a = issue_9188::bar();
let b = issue_9188::foo::<int>();
assert_eq!(*a, *b);

View File

@ -13,7 +13,7 @@
extern mod testmod = "issue-9906";
fn main() {
pub fn main() {
testmod::foo();
testmod::FooBar::new(1);
}

View File

@ -15,7 +15,7 @@ extern mod lib = "issue-9968";
use lib::{Trait, Struct};
fn main()
pub fn main()
{
Struct::init().test();
}

View File

@ -15,6 +15,6 @@ extern mod issue_9155;
struct Baz;
fn main() {
pub fn main() {
issue_9155::Foo::new(Baz);
}

View File

@ -15,7 +15,7 @@
extern mod foo = "linkage-visibility";
fn main() {
pub fn main() {
foo::test();
foo::foo2::<int>();
foo::foo();

View File

@ -14,7 +14,7 @@
use std::logging;
fn main() {
pub fn main() {
if log_enabled!(logging::DEBUG) {
fail!("what?! debugging?");
}

View File

@ -13,7 +13,7 @@
use std::logging;
fn main() {
pub fn main() {
if log_enabled!(logging::DEBUG) {
fail!("what?! debugging?");
}

View File

@ -24,7 +24,7 @@
extern mod logging_right_crate;
fn main() {
pub fn main() {
// this function fails if logging is turned on
logging_right_crate::foo::<int>();
}

View File

@ -17,4 +17,4 @@
// this test will trigger "output during runtime initialization" to make sure
// that the bug isn't re-introduced.
fn main() {}
pub fn main() {}

View File

@ -19,6 +19,6 @@ macro_rules! foo( () => (1) )
#[cfg(not(foo))]
macro_rules! foo( () => (2) )
fn main() {
pub fn main() {
assert_eq!(foo!(), 1);
}

View File

@ -13,7 +13,7 @@
#[no_uv];
#[start]
fn main(_: int, _: **u8) -> int {
pub fn main(_: int, _: **u8) -> int {
println!("hello");
0
}

View File

@ -16,6 +16,6 @@
extern mod no_std_crate;
fn main() {
pub fn main() {
no_std_crate::foo();
}

View File

@ -29,7 +29,7 @@ pub mod linkhack {
}
#[start]
fn main(_: int, _: **u8, _: *u8) -> int {
pub fn main(_: int, _: **u8, _: *u8) -> int {
no_std_crate::foo();
0
}

View File

@ -20,7 +20,7 @@ fn foo(blk: proc()) {
blk();
}
fn main() {
pub fn main() {
let x = arc::Arc::new(true);
do foo {
assert!(*x.get());

View File

@ -20,7 +20,7 @@ fn foo(blk: once ||) {
blk();
}
fn main() {
pub fn main() {
let x = arc::Arc::new(true);
foo(|| {
assert!(*x.get());

View File

@ -17,7 +17,7 @@ extern {
}
#[cfg(target_os = "macos")]
fn main() {
pub fn main() {
unsafe { CFRunLoopGetTypeID(); }
}

View File

@ -5,6 +5,6 @@ extern mod packed;
use std::mem;
fn main() {
pub fn main() {
assert_eq!(mem::size_of::<packed::S>(), 5);
}

View File

@ -13,7 +13,7 @@
extern mod bar = "priv-impl-prim-ty";
fn main() {
pub fn main() {
bar::frob(1i);
}

View File

@ -13,6 +13,6 @@
extern mod privacy_reexport;
fn main() {
pub fn main() {
privacy_reexport::bar::frob();
}

View File

@ -13,6 +13,6 @@
extern mod foo = "reexport-should-still-link";
fn main() {
pub fn main() {
foo::bar();
}

View File

@ -55,4 +55,4 @@ fn rename_directory() {
}
}
fn main() { rename_directory() }
pub fn main() { rename_directory() }

View File

@ -13,7 +13,7 @@
use std::{os, run};
use std::io::process;
fn main() {
pub fn main() {
let args = os::args();
if args.len() >= 2 && args[1] == ~"signal" {
// Raise a segfault.

View File

@ -32,7 +32,7 @@ extern "rust-intrinsic" {
}
#[start]
fn main(_: int, _: **u8, _: *u8) -> int {
pub fn main(_: int, _: **u8, _: *u8) -> int {
unsafe {
let (ptr, _): (*u8, uint) = transmute("Hello!");
puts(ptr);

View File

@ -15,7 +15,7 @@
use std::task;
fn main() {
pub fn main() {
let mut t = task::task();
t.spawn(proc() ());
}

View File

@ -14,7 +14,7 @@ extern mod aux = "static-function-pointer-aux";
fn f(x: int) -> int { x }
fn main() {
pub fn main() {
assert_eq!(aux::F(42), -42);
unsafe {
assert_eq!(aux::MutF(42), -42);

View File

@ -14,6 +14,6 @@ extern mod struct_variant_xc_aux;
use struct_variant_xc_aux::Variant;
fn main() {
pub fn main() {
let _ = Variant { arg: 1 };
}

View File

@ -11,7 +11,7 @@
// xfail-fast compile-flags doesn't work with fast-check
// compile-flags: --cfg foo --cfg bar(baz) --cfg qux="foo"
fn main() {
pub fn main() {
// check
if ! cfg!(foo) { fail!() }
if cfg!(not(foo)) { fail!() }

View File

@ -141,7 +141,7 @@ fn in_tmpdir(f: ||) {
f();
}
fn main() {
pub fn main() {
in_tmpdir(test_tempdir);
in_tmpdir(test_rm_tempdir);
in_tmpdir(recursive_mkdir_rel);

View File

@ -60,7 +60,7 @@ impl Pet for Goldfyshe {
fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 }
}
fn main() {
pub fn main() {
let catte = Catte { num_whiskers: 7, name: ~"alonzo_church" };
let dogge1 = Dogge { bark_decibels: 100, tricks_known: 42, name: ~"alan_turing" };
let dogge2 = Dogge { bark_decibels: 55, tricks_known: 11, name: ~"albert_einstein" };

View File

@ -9,7 +9,7 @@ use aux::A;
use aux2::{a_struct, welp};
fn main () {
pub fn main () {
let a = a_struct { x: 0 };
let b = a_struct { x: 1 };

View File

@ -44,7 +44,7 @@ impl TestEquality for stuff::thing {
}
fn main () {
pub fn main () {
// Some tests of random things
f(0);

View File

@ -16,7 +16,7 @@ struct Foo<T> {
x: T
}
fn main() {
pub fn main() {
unsafe {
assert_eq!((*get_tydesc::<int>()).name, "int");
assert_eq!((*get_tydesc::<~[int]>()).name, "~[int]");

View File

@ -21,7 +21,7 @@ use std::unstable::intrinsics::TypeId;
struct A;
struct Test;
fn main() {
pub fn main() {
unsafe {
assert_eq!(intrinsics::type_id::<other1::A>(), other1::id_A());
assert_eq!(intrinsics::type_id::<other1::B>(), other1::id_B());

View File

@ -13,6 +13,6 @@
extern mod inline_dtor;
fn main() {
pub fn main() {
let _x = inline_dtor::Foo;
}

View File

@ -13,6 +13,6 @@
extern mod foo = "xcrate_address_insignificant";
fn main() {
pub fn main() {
assert_eq!(foo::foo::<f64>(), foo::bar());
}

View File

@ -21,7 +21,7 @@ static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Argument(s1);
fn f1(_: xcrate_unit_struct::Struct) {}
fn f2(_: xcrate_unit_struct::Unit) {}
fn main() {
pub fn main() {
f1(xcrate_unit_struct::Struct);
f2(xcrate_unit_struct::Unit);
f2(xcrate_unit_struct::Argument(xcrate_unit_struct::Struct));