From a3b87e5f113278db4b908be38b92a9cd33e378cf Mon Sep 17 00:00:00 2001 From: OGINO Masanori Date: Thu, 30 Jan 2014 01:04:14 +0900 Subject: [PATCH] Add test cases for #4063. Signed-off-by: OGINO Masanori --- .../non-constant-enum-for-vec-repeat.rs | 15 +++++++++++++++ src/test/run-pass/const-enum-vec-repeat.rs | 15 +++++++++++++++ src/test/run-pass/vec-repeat-with-cast.rs | 11 +++++++++++ 3 files changed, 41 insertions(+) create mode 100644 src/test/compile-fail/non-constant-enum-for-vec-repeat.rs create mode 100644 src/test/run-pass/const-enum-vec-repeat.rs create mode 100644 src/test/run-pass/vec-repeat-with-cast.rs diff --git a/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs new file mode 100644 index 0000000000000..883ba5b0eaa67 --- /dev/null +++ b/src/test/compile-fail/non-constant-enum-for-vec-repeat.rs @@ -0,0 +1,15 @@ +// Copyright 2014 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. + +enum State { ST_NULL, ST_WHITESPACE } + +fn main() { + ~[ST_NULL, ..(ST_WHITESPACE as uint)]; //~ ERROR expected constant integer for repeat count but found variable +} diff --git a/src/test/run-pass/const-enum-vec-repeat.rs b/src/test/run-pass/const-enum-vec-repeat.rs new file mode 100644 index 0000000000000..4ad4bbc4a8a57 --- /dev/null +++ b/src/test/run-pass/const-enum-vec-repeat.rs @@ -0,0 +1,15 @@ +// Copyright 2014 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. + +enum State { ST_NULL, ST_WHITESPACE = 1 } + +fn main() { + ~[ST_NULL, ..(ST_WHITESPACE as uint)]; +} diff --git a/src/test/run-pass/vec-repeat-with-cast.rs b/src/test/run-pass/vec-repeat-with-cast.rs new file mode 100644 index 0000000000000..c28ddd2bcb511 --- /dev/null +++ b/src/test/run-pass/vec-repeat-with-cast.rs @@ -0,0 +1,11 @@ +// Copyright 2014 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() { let _a = [0, ..1 as uint]; }