From 928a07e9cb576640d122fbd7428b8a39b925c5f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20L=C3=B6bel?= Date: Fri, 26 Apr 2013 10:23:12 +0200 Subject: [PATCH] Added test cases for all fail message formats --- src/test/run-fail/assert-macro-explicit.rs | 15 +++++++++++++++ src/test/run-fail/assert-macro-fmt.rs | 15 +++++++++++++++ src/test/run-fail/assert-macro-owned.rs | 15 +++++++++++++++ src/test/run-fail/assert-macro-static.rs | 15 +++++++++++++++ src/test/run-fail/fail-macro-explicit.rs | 15 +++++++++++++++ src/test/run-fail/fail-macro-fmt.rs | 15 +++++++++++++++ src/test/run-fail/fail-macro-owned.rs | 15 +++++++++++++++ src/test/run-fail/fail-macro-static.rs | 15 +++++++++++++++ 8 files changed, 120 insertions(+) create mode 100644 src/test/run-fail/assert-macro-explicit.rs create mode 100644 src/test/run-fail/assert-macro-fmt.rs create mode 100644 src/test/run-fail/assert-macro-owned.rs create mode 100644 src/test/run-fail/assert-macro-static.rs create mode 100644 src/test/run-fail/fail-macro-explicit.rs create mode 100644 src/test/run-fail/fail-macro-fmt.rs create mode 100644 src/test/run-fail/fail-macro-owned.rs create mode 100644 src/test/run-fail/fail-macro-static.rs diff --git a/src/test/run-fail/assert-macro-explicit.rs b/src/test/run-fail/assert-macro-explicit.rs new file mode 100644 index 00000000000..8c35c92ffb0 --- /dev/null +++ b/src/test/run-fail/assert-macro-explicit.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'assertion failed: false' + +fn main() { + assert!(false); +} diff --git a/src/test/run-fail/assert-macro-fmt.rs b/src/test/run-fail/assert-macro-fmt.rs new file mode 100644 index 00000000000..d2397605378 --- /dev/null +++ b/src/test/run-fail/assert-macro-fmt.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'test-assert-fmt 42 rust' + +fn main() { + assert!(false, "test-assert-fmt %d %s", 42, "rust"); +} diff --git a/src/test/run-fail/assert-macro-owned.rs b/src/test/run-fail/assert-macro-owned.rs new file mode 100644 index 00000000000..baa47dbbd35 --- /dev/null +++ b/src/test/run-fail/assert-macro-owned.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'test-assert-owned' + +fn main() { + assert!(false, ~"test-assert-owned"); +} diff --git a/src/test/run-fail/assert-macro-static.rs b/src/test/run-fail/assert-macro-static.rs new file mode 100644 index 00000000000..d47455173d1 --- /dev/null +++ b/src/test/run-fail/assert-macro-static.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'test-assert-static' + +fn main() { + assert!(false, "test-assert-static"); +} diff --git a/src/test/run-fail/fail-macro-explicit.rs b/src/test/run-fail/fail-macro-explicit.rs new file mode 100644 index 00000000000..eac80db40b9 --- /dev/null +++ b/src/test/run-fail/fail-macro-explicit.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'explicit failure' + +fn main() { + fail!(); +} diff --git a/src/test/run-fail/fail-macro-fmt.rs b/src/test/run-fail/fail-macro-fmt.rs new file mode 100644 index 00000000000..363c572f3fe --- /dev/null +++ b/src/test/run-fail/fail-macro-fmt.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'test-fail-fmt 42 rust' + +fn main() { + fail!("test-fail-fmt %d %s", 42, "rust"); +} diff --git a/src/test/run-fail/fail-macro-owned.rs b/src/test/run-fail/fail-macro-owned.rs new file mode 100644 index 00000000000..6bed79a885f --- /dev/null +++ b/src/test/run-fail/fail-macro-owned.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'test-fail-owned' + +fn main() { + fail!(~"test-fail-owned"); +} diff --git a/src/test/run-fail/fail-macro-static.rs b/src/test/run-fail/fail-macro-static.rs new file mode 100644 index 00000000000..3235dc761a2 --- /dev/null +++ b/src/test/run-fail/fail-macro-static.rs @@ -0,0 +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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:task failed at 'test-fail-static' + +fn main() { + fail!("test-fail-static"); +}