diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-03-27 09:58:28 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-03-27 10:09:03 -0700 |
| commit | fad05591e5e421f0b43a906e18e7a26ebe92d07d (patch) | |
| tree | 6c4cda0923719d4488eea0af4392d5a52d640bb1 | |
| parent | e23fad0e6a9a7104c779d02c8568a81ada37d7cc (diff) | |
| download | rust-fad05591e5e421f0b43a906e18e7a26ebe92d07d.tar.gz rust-fad05591e5e421f0b43a906e18e7a26ebe92d07d.zip | |
testsuite: more `pub fn main`
25 files changed, 126 insertions, 26 deletions
diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index b204e1aba3a..047c339fafb 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -1,7 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #[deriving(Eq)] struct Point { x : int } -fn main() { +pub fn main() { assert_eq!(14,14); assert_eq!(~"abc",~"abc"); assert_eq!(~Point{x:34},~Point{x:34}); diff --git a/src/test/run-pass/const-cast-ptr-int.rs b/src/test/run-pass/const-cast-ptr-int.rs index eefd1aa642e..f6f0e6ef370 100644 --- a/src/test/run-pass/const-cast-ptr-int.rs +++ b/src/test/run-pass/const-cast-ptr-int.rs @@ -10,6 +10,6 @@ static a: *u8 = 0 as *u8; -fn main() { +pub fn main() { fail_unless!(a == ptr::null()); } diff --git a/src/test/run-pass/const-cast.rs b/src/test/run-pass/const-cast.rs index 83f365a6320..981a8a94b09 100644 --- a/src/test/run-pass/const-cast.rs +++ b/src/test/run-pass/const-cast.rs @@ -15,7 +15,7 @@ static y: *libc::c_void = x as *libc::c_void; static a: &'static int = &10; static b: *int = a as *int; -fn main() { +pub fn main() { fail_unless!(x as *libc::c_void == y); fail_unless!(a as *int == b); } diff --git a/src/test/run-pass/const-cross-crate-extern.rs b/src/test/run-pass/const-cross-crate-extern.rs index 723835a46d8..67bae91b26e 100644 --- a/src/test/run-pass/const-cross-crate-extern.rs +++ b/src/test/run-pass/const-cross-crate-extern.rs @@ -15,6 +15,6 @@ extern mod cci_const; use cci_const::bar; static foo: *u8 = bar; -fn main() { +pub fn main() { fail_unless!(foo == cci_const::bar); } diff --git a/src/test/run-pass/const-enum-cast.rs b/src/test/run-pass/const-enum-cast.rs index 20d7a94ccac..800800a307b 100644 --- a/src/test/run-pass/const-enum-cast.rs +++ b/src/test/run-pass/const-enum-cast.rs @@ -11,7 +11,7 @@ enum A { A1, A2 } enum B { B1=0, B2=2 } -fn main () { +pub fn main () { static c1: int = A2 as int; static c2: int = B2 as int; static c3: float = A2 as float; diff --git a/src/test/run-pass/const-enum-structlike.rs b/src/test/run-pass/const-enum-structlike.rs index 86640bcc408..12349eacd29 100644 --- a/src/test/run-pass/const-enum-structlike.rs +++ b/src/test/run-pass/const-enum-structlike.rs @@ -15,7 +15,7 @@ enum E { static C: E = S1 { u: 23 }; -fn main() { +pub fn main() { match C { S0 { _ } => fail!(), S1 { u } => fail_unless!(u == 23) diff --git a/src/test/run-pass/const-expr-in-fixed-length-vec.rs b/src/test/run-pass/const-expr-in-fixed-length-vec.rs index dc97c582219..c593fd39aaa 100644 --- a/src/test/run-pass/const-expr-in-fixed-length-vec.rs +++ b/src/test/run-pass/const-expr-in-fixed-length-vec.rs @@ -11,7 +11,7 @@ // Check that constant expressions can be used for declaring the // type of a fixed length vector. -fn main() { +pub fn main() { static FOO: int = 2; let _v: [int, ..FOO*3]; diff --git a/src/test/run-pass/const-expr-in-vec-repeat.rs b/src/test/run-pass/const-expr-in-vec-repeat.rs index a04c588c07b..be54c6eb7be 100644 --- a/src/test/run-pass/const-expr-in-vec-repeat.rs +++ b/src/test/run-pass/const-expr-in-vec-repeat.rs @@ -10,7 +10,7 @@ // Check that constant expressions can be used in vec repeat syntax. -fn main() { +pub fn main() { static FOO: int = 2; let _v = [0, ..FOO*3*2/2]; diff --git a/src/test/run-pass/const-str-ptr.rs b/src/test/run-pass/const-str-ptr.rs index 1f40c57d851..4163748eaee 100644 --- a/src/test/run-pass/const-str-ptr.rs +++ b/src/test/run-pass/const-str-ptr.rs @@ -12,7 +12,7 @@ static a: [u8, ..3] = ['h' as u8, 'i' as u8, 0 as u8]; static c: &'static [u8, ..3] = &a; static b: *u8 = c as *u8; -fn main() { +pub fn main() { let foo = &a as *u8; fail_unless!(unsafe { str::raw::from_bytes(a) } == ~"hi\x00"); fail_unless!(unsafe { str::raw::from_buf(foo) } == ~"hi"); diff --git a/src/test/run-pass/const-vec-syntax.rs b/src/test/run-pass/const-vec-syntax.rs index ec8e04e41ef..c3e882ac04f 100644 --- a/src/test/run-pass/const-vec-syntax.rs +++ b/src/test/run-pass/const-vec-syntax.rs @@ -1,6 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + fn f(_: &const [int]) {} -fn main() { +pub fn main() { let v = [ 1, 2, 3 ]; f(v); } diff --git a/src/test/run-pass/deriving-clone-enum.rs b/src/test/run-pass/deriving-clone-enum.rs index ee294cb5942..6caceeb2d70 100644 --- a/src/test/run-pass/deriving-clone-enum.rs +++ b/src/test/run-pass/deriving-clone-enum.rs @@ -1,3 +1,13 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #[deriving(Clone)] enum E { A, @@ -5,5 +15,5 @@ enum E { C } -fn main() {} +pub fn main() {} diff --git a/src/test/run-pass/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving-clone-generic-struct.rs index 92721c53435..b157cd321cf 100644 --- a/src/test/run-pass/deriving-clone-generic-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-struct.rs @@ -1,3 +1,13 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #[deriving(Clone)] struct S<T> { foo: (), @@ -5,5 +15,5 @@ struct S<T> { baz: T, } -fn main() {} +pub fn main() {} diff --git a/src/test/run-pass/deriving-clone-tuple-struct.rs b/src/test/run-pass/deriving-clone-tuple-struct.rs index 04ddb439485..c534883f600 100644 --- a/src/test/run-pass/deriving-clone-tuple-struct.rs +++ b/src/test/run-pass/deriving-clone-tuple-struct.rs @@ -1,5 +1,15 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + #[deriving(Clone)] struct S((), ()); -fn main() {} +pub fn main() {} diff --git a/src/test/run-pass/issue-3556.rs b/src/test/run-pass/issue-3556.rs index 3df10cd00a9..1df86da6cb7 100644 --- a/src/test/run-pass/issue-3556.rs +++ b/src/test/run-pass/issue-3556.rs @@ -30,7 +30,7 @@ fn check_strs(actual: &str, expected: &str) -> bool return true; } -fn main() +pub fn main() { // fail_unless!(check_strs(fmt!("%?", Text(@~"foo")), "Text(@~\"foo\")")); // fail_unless!(check_strs(fmt!("%?", ETag(@~[~"foo"], @~"bar")), "ETag(@~[ ~\"foo\" ], @~\"bar\")")); diff --git a/src/test/run-pass/issue-4120.rs b/src/test/run-pass/issue-4120.rs index 82bd48c4aa0..deb8e0a3b07 100644 --- a/src/test/run-pass/issue-4120.rs +++ b/src/test/run-pass/issue-4120.rs @@ -12,7 +12,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() +pub fn main() { unsafe { libc::exit(0); diff --git a/src/test/run-pass/issue-4387.rs b/src/test/run-pass/issue-4387.rs index 8146a4e6b8c..f6ad444f94a 100644 --- a/src/test/run-pass/issue-4387.rs +++ b/src/test/run-pass/issue-4387.rs @@ -8,6 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -fn main() { +pub fn main() { let foo = [0, ..2*4]; } diff --git a/src/test/run-pass/issue-4448.rs b/src/test/run-pass/issue-4448.rs index 0a9c731e9b8..5284fe92ade 100644 --- a/src/test/run-pass/issue-4448.rs +++ b/src/test/run-pass/issue-4448.rs @@ -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) = comm::stream::<&'static str>(); do task::spawn { diff --git a/src/test/run-pass/issue-5243.rs b/src/test/run-pass/issue-5243.rs index 4d286214655..1fc51961b16 100644 --- a/src/test/run-pass/issue-5243.rs +++ b/src/test/run-pass/issue-5243.rs @@ -18,6 +18,6 @@ struct S<'self> { fn f<'lt>(_s: &'lt S<'lt>) {} -fn main() { +pub fn main() { f(& S { v: &42 }); } diff --git a/src/test/run-pass/log-poly.rs b/src/test/run-pass/log-poly.rs index 3588016b8ba..0ae1edeed50 100644 --- a/src/test/run-pass/log-poly.rs +++ b/src/test/run-pass/log-poly.rs @@ -1,8 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + enum Numbers { Three } -fn main() { +pub fn main() { debug!(1); info!(2.0); warn!(Three); diff --git a/src/test/run-pass/new-style-constants.rs b/src/test/run-pass/new-style-constants.rs index f5c691d512e..9a319ea6a5c 100644 --- a/src/test/run-pass/new-style-constants.rs +++ b/src/test/run-pass/new-style-constants.rs @@ -1,8 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + use core::io::println; static FOO: int = 3; -fn main() { +pub fn main() { println(fmt!("%d", FOO)); } diff --git a/src/test/run-pass/new-style-fixed-length-vec.rs b/src/test/run-pass/new-style-fixed-length-vec.rs index 44261458a9a..5d37a42af42 100644 --- a/src/test/run-pass/new-style-fixed-length-vec.rs +++ b/src/test/run-pass/new-style-fixed-length-vec.rs @@ -1,8 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + use core::io::println; static FOO: [int, ..3] = [1, 2, 3]; -fn main() { +pub fn main() { println(fmt!("%d %d %d", FOO[0], FOO[1], FOO[2])); } diff --git a/src/test/run-pass/one-tuple.rs b/src/test/run-pass/one-tuple.rs index fe56dc30af9..0e483390bee 100644 --- a/src/test/run-pass/one-tuple.rs +++ b/src/test/run-pass/one-tuple.rs @@ -10,7 +10,7 @@ // Why one-tuples? Because macros. -fn main() { +pub fn main() { match ('c',) { (x,) => { fail_unless!(x == 'c'); diff --git a/src/test/run-pass/option_addition.rs b/src/test/run-pass/option_addition.rs index 92420562706..f42d3054e5c 100644 --- a/src/test/run-pass/option_addition.rs +++ b/src/test/run-pass/option_addition.rs @@ -1,4 +1,14 @@ -fn main() { +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn main() { let foo = 1; let bar = 2; let foobar = foo + bar; diff --git a/src/test/run-pass/regions-expl-self.rs b/src/test/run-pass/regions-expl-self.rs index 736ed24097c..05f0994c765 100644 --- a/src/test/run-pass/regions-expl-self.rs +++ b/src/test/run-pass/regions-expl-self.rs @@ -1,4 +1,4 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -18,4 +18,4 @@ pub impl Foo { fn foo(&'a self) {} } -fn main() {} \ No newline at end of file +pub fn main() {} \ No newline at end of file diff --git a/src/test/run-pass/regions-parameterization-self-types-issue-5224.rs b/src/test/run-pass/regions-parameterization-self-types-issue-5224.rs index 3420b8be9c7..cef3e6e8243 100644 --- a/src/test/run-pass/regions-parameterization-self-types-issue-5224.rs +++ b/src/test/run-pass/regions-parameterization-self-types-issue-5224.rs @@ -1,3 +1,13 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + // Test how region-parameterization inference // interacts with explicit self types. // @@ -22,7 +32,7 @@ fn get_int<G: Getter>(g: &G) -> int { *g.get() } -fn main() { +pub fn main() { let foo = Foo { field: 22 }; fail_unless!(get_int(&foo) == 22); } |
