]> git.lizzy.rs Git - rust.git/commitdiff
Add test cases for #4063.
authorOGINO Masanori <masanori.ogino@gmail.com>
Wed, 29 Jan 2014 16:04:14 +0000 (01:04 +0900)
committerAlex Crichton <alex@alexcrichton.com>
Sat, 1 Feb 2014 05:43:09 +0000 (21:43 -0800)
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
src/test/compile-fail/non-constant-enum-for-vec-repeat.rs [new file with mode: 0644]
src/test/run-pass/const-enum-vec-repeat.rs [new file with mode: 0644]
src/test/run-pass/vec-repeat-with-cast.rs [new file with mode: 0644]

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 (file)
index 0000000..883ba5b
--- /dev/null
@@ -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 <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 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 (file)
index 0000000..4ad4bbc
--- /dev/null
@@ -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 <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 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 (file)
index 0000000..c28ddd2
--- /dev/null
@@ -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 <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() { let _a = [0, ..1 as uint]; }