diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/compile-fail/multiple-main-2.rs | 17 | ||||
| -rw-r--r-- | src/test/compile-fail/multiple-main-3.rs | 19 | ||||
| -rw-r--r-- | src/test/run-pass/attr-main-2.rs | 17 | ||||
| -rw-r--r-- | src/test/run-pass/attr-main.rs | 13 |
4 files changed, 66 insertions, 0 deletions
diff --git a/src/test/compile-fail/multiple-main-2.rs b/src/test/compile-fail/multiple-main-2.rs new file mode 100644 index 00000000000..723aefb91cb --- /dev/null +++ b/src/test/compile-fail/multiple-main-2.rs @@ -0,0 +1,17 @@ +// 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. + +#[main] +fn bar() { +} + +#[main] +fn foo() { //~ ERROR multiple 'main' functions +} diff --git a/src/test/compile-fail/multiple-main-3.rs b/src/test/compile-fail/multiple-main-3.rs new file mode 100644 index 00000000000..36da3e6e84a --- /dev/null +++ b/src/test/compile-fail/multiple-main-3.rs @@ -0,0 +1,19 @@ +// 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. + +#[main] +fn main1() { +} + +mod foo { + #[main] + fn main2() { //~ ERROR multiple 'main' functions + } +} diff --git a/src/test/run-pass/attr-main-2.rs b/src/test/run-pass/attr-main-2.rs new file mode 100644 index 00000000000..78fb9d3e39a --- /dev/null +++ b/src/test/run-pass/attr-main-2.rs @@ -0,0 +1,17 @@ +// 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. + +fn main() { + fail +} + +#[main] +fn foo() { +} diff --git a/src/test/run-pass/attr-main.rs b/src/test/run-pass/attr-main.rs new file mode 100644 index 00000000000..782240fd982 --- /dev/null +++ b/src/test/run-pass/attr-main.rs @@ -0,0 +1,13 @@ +// 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. + +#[main] +fn foo() { +} |
