From b7cefd0c962e8ad8a77de45ede39d615d0f78924 Mon Sep 17 00:00:00 2001 From: ILyoan Date: Fri, 11 Jan 2013 18:08:01 +0900 Subject: allowing the entry point name to be something other than main add build tests --- src/test/compile-fail/multiple-main-2.rs | 17 +++++++++++++++++ src/test/compile-fail/multiple-main-3.rs | 19 +++++++++++++++++++ src/test/run-pass/attr-main-2.rs | 17 +++++++++++++++++ src/test/run-pass/attr-main.rs | 13 +++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 src/test/compile-fail/multiple-main-2.rs create mode 100644 src/test/compile-fail/multiple-main-3.rs create mode 100644 src/test/run-pass/attr-main-2.rs create mode 100644 src/test/run-pass/attr-main.rs (limited to 'src/test') 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 or the MIT license +// , 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 or the MIT license +// , 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 or the MIT license +// , 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[main] +fn foo() { +} -- cgit 1.4.1-3-g733a5