about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-08-09 18:48:01 -0700
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-08-09 18:48:01 -0700
commitee59aacac490edd619db1c4e2fcd848f793bc3b9 (patch)
treed4f01cefe67f55b80cfaca641a03b581823eb200 /src/test
parentcab6d46e58ea6f7535d8e454f0345eccfae183c4 (diff)
parent6f6dce7bbcfb104a8a1e23b0b93d83cbb770f338 (diff)
downloadrust-ee59aacac490edd619db1c4e2fcd848f793bc3b9.tar.gz
rust-ee59aacac490edd619db1c4e2fcd848f793bc3b9.zip
Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/extenv-arg-2-not-string-literal.rs (renamed from src/test/run-pass/extern-mod-url.rs)7
-rw-r--r--src/test/compile-fail/extenv-no-args.rs6
-rw-r--r--src/test/compile-fail/extenv-not-defined-custom.rs11
-rw-r--r--src/test/compile-fail/extenv-not-defined-default.rs11
-rw-r--r--src/test/compile-fail/extenv-not-string-literal.rs6
-rw-r--r--src/test/compile-fail/extenv-too-many-args.rs4
-rw-r--r--src/test/compile-fail/extoption_env-no-args.rs11
-rw-r--r--src/test/compile-fail/extoption_env-not-string-literal.rs11
-rw-r--r--src/test/compile-fail/extoption_env-too-many-args.rs11
-rw-r--r--src/test/run-pass/extoption_env-not-defined.rs14
-rw-r--r--src/test/run-pass/issue-5530.rs2
-rw-r--r--src/test/run-pass/match-enum-struct-0.rs24
-rw-r--r--src/test/run-pass/match-enum-struct-1.rs26
-rw-r--r--src/test/run-pass/match-struct-0.rs29
14 files changed, 154 insertions, 19 deletions
diff --git a/src/test/run-pass/extern-mod-url.rs b/src/test/compile-fail/extenv-arg-2-not-string-literal.rs
index 363c54f6812..c2362689721 100644
--- a/src/test/run-pass/extern-mod-url.rs
+++ b/src/test/compile-fail/extenv-arg-2-not-string-literal.rs
@@ -8,9 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// Just a test that new-style extern mods parse
-
-// xfail-test FIXME #6407
-extern mod test = "github.com/catamorphism/test-pkg";
-
-fn main() {}
+fn main() { env!("one", 10); } //~ ERROR: expected string literal
diff --git a/src/test/compile-fail/extenv-no-args.rs b/src/test/compile-fail/extenv-no-args.rs
index 7ff1357dcf3..afa47dbe744 100644
--- a/src/test/compile-fail/extenv-no-args.rs
+++ b/src/test/compile-fail/extenv-no-args.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,6 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern: env! takes 1 argument
-
-fn main() { env!(); }
+fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments
diff --git a/src/test/compile-fail/extenv-not-defined-custom.rs b/src/test/compile-fail/extenv-not-defined-custom.rs
new file mode 100644
index 00000000000..485b6c09f0a
--- /dev/null
+++ b/src/test/compile-fail/extenv-not-defined-custom.rs
@@ -0,0 +1,11 @@
+// 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 <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() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message
diff --git a/src/test/compile-fail/extenv-not-defined-default.rs b/src/test/compile-fail/extenv-not-defined-default.rs
new file mode 100644
index 00000000000..d7a543c045a
--- /dev/null
+++ b/src/test/compile-fail/extenv-not-defined-default.rs
@@ -0,0 +1,11 @@
+// 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() { env!("__HOPEFULLY_NOT_DEFINED__"); } //~ ERROR: Environment variable __HOPEFULLY_NOT_DEFINED__ not defined
diff --git a/src/test/compile-fail/extenv-not-string-literal.rs b/src/test/compile-fail/extenv-not-string-literal.rs
index 3f09f81b85b..07ce47a14d8 100644
--- a/src/test/compile-fail/extenv-not-string-literal.rs
+++ b/src/test/compile-fail/extenv-not-string-literal.rs
@@ -1,4 +1,4 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -8,6 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:requires a string
-
-fn main() { env!(10); }
+fn main() { env!(10, "two"); } //~ ERROR: expected string literal
diff --git a/src/test/compile-fail/extenv-too-many-args.rs b/src/test/compile-fail/extenv-too-many-args.rs
index b1b2001abc3..c6c4f0ec6b8 100644
--- a/src/test/compile-fail/extenv-too-many-args.rs
+++ b/src/test/compile-fail/extenv-too-many-args.rs
@@ -8,6 +8,4 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern: env! takes 1 argument
-
-fn main() { env!("one", "two"); }
+fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments
diff --git a/src/test/compile-fail/extoption_env-no-args.rs b/src/test/compile-fail/extoption_env-no-args.rs
new file mode 100644
index 00000000000..fd56756584a
--- /dev/null
+++ b/src/test/compile-fail/extoption_env-no-args.rs
@@ -0,0 +1,11 @@
+// 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() { option_env!(); } //~ ERROR: option_env! takes 1 argument
diff --git a/src/test/compile-fail/extoption_env-not-string-literal.rs b/src/test/compile-fail/extoption_env-not-string-literal.rs
new file mode 100644
index 00000000000..10f6c34980e
--- /dev/null
+++ b/src/test/compile-fail/extoption_env-not-string-literal.rs
@@ -0,0 +1,11 @@
+// Copyright 2012-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 <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() { option_env!(10); } //~ ERROR: requires a string
diff --git a/src/test/compile-fail/extoption_env-too-many-args.rs b/src/test/compile-fail/extoption_env-too-many-args.rs
new file mode 100644
index 00000000000..b31e857c14e
--- /dev/null
+++ b/src/test/compile-fail/extoption_env-too-many-args.rs
@@ -0,0 +1,11 @@
+// Copyright 2012-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 <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() { option_env!("one", "two"); } //~ ERROR: option_env! takes 1 argument
diff --git a/src/test/run-pass/extoption_env-not-defined.rs b/src/test/run-pass/extoption_env-not-defined.rs
new file mode 100644
index 00000000000..412efcc25a8
--- /dev/null
+++ b/src/test/run-pass/extoption_env-not-defined.rs
@@ -0,0 +1,14 @@
+// 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 <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 opt: Option<&'static str> = option_env!("__HOPEFULLY_DOESNT_EXIST__");
+    assert!(opt.is_none());
+}
diff --git a/src/test/run-pass/issue-5530.rs b/src/test/run-pass/issue-5530.rs
index 002435fcb36..8e55ad90c70 100644
--- a/src/test/run-pass/issue-5530.rs
+++ b/src/test/run-pass/issue-5530.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// xfail-test
-
 enum Enum {
     Foo { foo: uint },
     Bar { bar: uint }
diff --git a/src/test/run-pass/match-enum-struct-0.rs b/src/test/run-pass/match-enum-struct-0.rs
new file mode 100644
index 00000000000..365729ec860
--- /dev/null
+++ b/src/test/run-pass/match-enum-struct-0.rs
@@ -0,0 +1,24 @@
+// 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 <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.
+
+// regression test for issue #5625
+
+enum E {
+    Foo{f : int},
+    Bar
+}
+
+pub fn main() {
+    let e = Bar;
+    match e {
+        Foo{f: _f} => fail!(),
+        _ => (),
+    }
+}
diff --git a/src/test/run-pass/match-enum-struct-1.rs b/src/test/run-pass/match-enum-struct-1.rs
new file mode 100644
index 00000000000..15d24c41a3d
--- /dev/null
+++ b/src/test/run-pass/match-enum-struct-1.rs
@@ -0,0 +1,26 @@
+// 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 <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 E {
+    Foo{f : int},
+    Bar
+}
+
+pub fn main() {
+    let e = Foo{f: 1};
+    match e {
+        Foo{_} => (),
+        _ => fail!(),
+    }
+    match e {
+        Foo{f: _f} => (),
+        _ => fail!(),
+    }
+}
diff --git a/src/test/run-pass/match-struct-0.rs b/src/test/run-pass/match-struct-0.rs
new file mode 100644
index 00000000000..67e844c519e
--- /dev/null
+++ b/src/test/run-pass/match-struct-0.rs
@@ -0,0 +1,29 @@
+// 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 <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.
+
+struct Foo{
+    f : int,
+}
+
+pub fn main() {
+    let f = Foo{f: 1};
+    match f {
+        Foo{f: 0} => fail!(),
+        Foo{_} => (),
+    }
+    match f {
+        Foo{f: 0} => fail!(),
+        Foo{f: _f} => (),
+    }
+    match f {
+        Foo{f: 0} => fail!(),
+        _ => (),
+    }
+}