mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
testsuite: more pub fn main
This commit is contained in:
parent
e23fad0e6a
commit
fad05591e5
@ -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});
|
||||
|
@ -10,6 +10,6 @@
|
||||
|
||||
static a: *u8 = 0 as *u8;
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
fail_unless!(a == ptr::null());
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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];
|
||||
|
@ -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];
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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() {}
|
||||
|
||||
|
@ -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() {}
|
||||
|
||||
|
@ -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() {}
|
||||
|
||||
|
@ -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\")"));
|
||||
|
@ -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);
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -18,6 +18,6 @@ struct S<'self> {
|
||||
|
||||
fn f<'lt>(_s: &'lt S<'lt>) {}
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
f(& S { v: &42 });
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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]));
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
// Why one-tuples? Because macros.
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
match ('c',) {
|
||||
(x,) => {
|
||||
fail_unless!(x == 'c');
|
||||
|
@ -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;
|
||||
|
@ -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() {}
|
||||
pub fn main() {}
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user