提交 02c1d2ff 编写于 作者: P Patrick Walton

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

上级 82a09b9a
......@@ -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,
......
......@@ -24,7 +24,7 @@ pub fn next_b(&mut self) -> uint {
}
}
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);
......
......@@ -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));
......
......@@ -26,4 +26,4 @@ impl <T:Freeze+Send> RequiresRequiresFreezeAndSend for X<T> { }
impl <T:Pod> RequiresPod for X<T> { }
fn main() { }
pub fn main() { }
......@@ -32,6 +32,6 @@ mod foo {
}
}
fn main() {
pub fn main() {
assert!(bar!())
}
......@@ -32,6 +32,6 @@ mod foo {
}
}
fn main() {
pub fn main() {
assert!(!bar!())
}
......@@ -13,6 +13,6 @@
extern mod cfg_inner_static;
fn main() {
pub fn main() {
cfg_inner_static::foo();
}
......@@ -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());
}
......@@ -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!() } });
}
......@@ -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; } });
......
......@@ -16,7 +16,7 @@
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);
......
......@@ -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 => {}
......
......@@ -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)
......
......@@ -39,4 +39,4 @@ struct B { x: uint, y: int }
}
fn main() {}
pub fn main() {}
......@@ -32,7 +32,7 @@ enum D {
D2 { x: (), y: () }
}
fn main() {
pub fn main() {
// check there's no segfaults
20.times(|| {
rand::random::<A>();
......
......@@ -26,4 +26,4 @@ mod hello;
#[cfg(target_os = "android")]
mod hello;
fn main() { }
\ No newline at end of file
pub fn main() { }
......@@ -15,6 +15,6 @@
use extern_calling_convention::foo;
fn main() {
pub fn main() {
foo(1, 2, 3, 4);
}
......@@ -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());
......
......@@ -5,6 +5,6 @@
use extern_mod_ordering_lib::extern_mod_ordering_lib;
fn main() {
pub fn main() {
extern_mod_ordering_lib::f();
}
......@@ -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) {
......
......@@ -38,7 +38,7 @@ pub fn plugh() -> int {
}
}
fn main() {
pub fn main() {
let _x = baz::quux();
let _y = grault::garply();
let _z = waldo::plugh();
......
......@@ -43,7 +43,7 @@ enum Bar3 {
}
}
fn main() {
pub fn main() {
let _f = Foo { foo: 3 };
let _f = Foo2 { foo: 3 };
......
......@@ -13,4 +13,4 @@
extern mod unused = "issue-11224";
fn main() {}
pub fn main() {}
......@@ -13,6 +13,6 @@
extern mod foo = "issue-11225-1";
fn main() {
pub fn main() {
foo::foo(1);
}
......@@ -13,6 +13,6 @@
extern mod foo = "issue-11225-2";
fn main() {
pub fn main() {
foo::foo(1);
}
......@@ -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);
......
......@@ -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);
......
......@@ -16,4 +16,4 @@
fn foo<T, A:Angle<T>>(theta: A) -> T { sin(&theta) }
fn main() {}
pub fn main() {}
......@@ -127,5 +127,5 @@ fn query2(cmd: ~[~str]) -> Result {
}
fn main() {
pub fn main() {
}
......@@ -31,7 +31,7 @@ fn drop(&mut self) {
}
}
fn main() {
pub fn main() {
let y = Y;
let _z = Z{x: y};
}
......@@ -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>(); }
......@@ -14,4 +14,4 @@
mod local { }
fn main() {}
pub fn main() {}
......@@ -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);
......
......@@ -13,6 +13,6 @@
extern mod cross_crate_self = "issue-7178";
fn main() {
pub fn main() {
let _ = cross_crate_self::Foo::new(&1i);
}
......@@ -14,6 +14,6 @@
extern mod minimal = "issue-8044";
use minimal::{BTree, leaf};
fn main() {
pub fn main() {
BTree::<int> { node: leaf(1) };
}
......@@ -14,4 +14,4 @@
extern mod other = "issue-8259";
static a: other::Foo<'static> = other::A;
fn main() {}
pub fn main() {}
......@@ -10,7 +10,7 @@
// xfail-test
fn main() {
pub fn main() {
// This is ok
match &[(~5,~7)] {
ps => {
......
......@@ -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);
......
......@@ -13,7 +13,7 @@
extern mod testmod = "issue-9906";
fn main() {
pub fn main() {
testmod::foo();
testmod::FooBar::new(1);
}
......@@ -15,7 +15,7 @@
use lib::{Trait, Struct};
fn main()
pub fn main()
{
Struct::init().test();
}
......@@ -15,6 +15,6 @@
struct Baz;
fn main() {
pub fn main() {
issue_9155::Foo::new(Baz);
}
......@@ -15,7 +15,7 @@
extern mod foo = "linkage-visibility";
fn main() {
pub fn main() {
foo::test();
foo::foo2::<int>();
foo::foo();
......
......@@ -14,7 +14,7 @@
use std::logging;
fn main() {
pub fn main() {
if log_enabled!(logging::DEBUG) {
fail!("what?! debugging?");
}
......
......@@ -13,7 +13,7 @@
use std::logging;
fn main() {
pub fn main() {
if log_enabled!(logging::DEBUG) {
fail!("what?! debugging?");
}
......
......@@ -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>();
}
......@@ -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() {}
......@@ -19,6 +19,6 @@
#[cfg(not(foo))]
macro_rules! foo( () => (2) )
fn main() {
pub fn main() {
assert_eq!(foo!(), 1);
}
......@@ -13,7 +13,7 @@
#[no_uv];
#[start]
fn main(_: int, _: **u8) -> int {
pub fn main(_: int, _: **u8) -> int {
println!("hello");
0
}
......@@ -16,6 +16,6 @@
extern mod no_std_crate;
fn main() {
pub fn main() {
no_std_crate::foo();
}
......@@ -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
}
......@@ -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());
......
......@@ -20,7 +20,7 @@ fn foo(blk: once ||) {
blk();
}
fn main() {
pub fn main() {
let x = arc::Arc::new(true);
foo(|| {
assert!(*x.get());
......
......@@ -17,7 +17,7 @@
}
#[cfg(target_os = "macos")]
fn main() {
pub fn main() {
unsafe { CFRunLoopGetTypeID(); }
}
......
......@@ -5,6 +5,6 @@
use std::mem;
fn main() {
pub fn main() {
assert_eq!(mem::size_of::<packed::S>(), 5);
}
......@@ -13,7 +13,7 @@
extern mod bar = "priv-impl-prim-ty";
fn main() {
pub fn main() {
bar::frob(1i);
}
......@@ -13,6 +13,6 @@
extern mod privacy_reexport;
fn main() {
pub fn main() {
privacy_reexport::bar::frob();
}
......@@ -13,6 +13,6 @@
extern mod foo = "reexport-should-still-link";
fn main() {
pub fn main() {
foo::bar();
}
......@@ -55,4 +55,4 @@ fn rename_directory() {
}
}
fn main() { rename_directory() }
pub fn main() { rename_directory() }
......@@ -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.
......
......@@ -32,7 +32,7 @@ pub mod linkhack {
}
#[start]
fn main(_: int, _: **u8, _: *u8) -> int {
pub fn main(_: int, _: **u8, _: *u8) -> int {
unsafe {
let (ptr, _): (*u8, uint) = transmute("Hello!");
puts(ptr);
......
......@@ -15,7 +15,7 @@
use std::task;
fn main() {
pub fn main() {
let mut t = task::task();
t.spawn(proc() ());
}
......@@ -14,7 +14,7 @@
fn f(x: int) -> int { x }
fn main() {
pub fn main() {
assert_eq!(aux::F(42), -42);
unsafe {
assert_eq!(aux::MutF(42), -42);
......
......@@ -14,6 +14,6 @@
use struct_variant_xc_aux::Variant;
fn main() {
pub fn main() {
let _ = Variant { arg: 1 };
}
......@@ -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!() }
......
......@@ -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);
......
......@@ -60,7 +60,7 @@ fn num_legs(&self) -> uint { 0 }
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" };
......
......@@ -9,7 +9,7 @@
use aux2::{a_struct, welp};
fn main () {
pub fn main () {
let a = a_struct { x: 0 };
let b = a_struct { x: 1 };
......
......@@ -44,7 +44,7 @@ fn test_eq(&self, rhs: &stuff::thing) -> bool {
}
fn main () {
pub fn main () {
// Some tests of random things
f(0);
......
......@@ -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]");
......
......@@ -21,7 +21,7 @@
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());
......
......@@ -13,6 +13,6 @@
extern mod inline_dtor;
fn main() {
pub fn main() {
let _x = inline_dtor::Foo;
}
......@@ -13,6 +13,6 @@
extern mod foo = "xcrate_address_insignificant";
fn main() {
pub fn main() {
assert_eq!(foo::foo::<f64>(), foo::bar());
}
......@@ -21,7 +21,7 @@
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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册