diff options
| author | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-08-09 18:48:01 -0700 |
|---|---|---|
| committer | Erick Tryzelaar <erick.tryzelaar@gmail.com> | 2013-08-09 18:48:01 -0700 |
| commit | ee59aacac490edd619db1c4e2fcd848f793bc3b9 (patch) | |
| tree | d4f01cefe67f55b80cfaca641a03b581823eb200 /src/test | |
| parent | cab6d46e58ea6f7535d8e454f0345eccfae183c4 (diff) | |
| parent | 6f6dce7bbcfb104a8a1e23b0b93d83cbb770f338 (diff) | |
| download | rust-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.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/extenv-not-defined-custom.rs | 11 | ||||
| -rw-r--r-- | src/test/compile-fail/extenv-not-defined-default.rs | 11 | ||||
| -rw-r--r-- | src/test/compile-fail/extenv-not-string-literal.rs | 6 | ||||
| -rw-r--r-- | src/test/compile-fail/extenv-too-many-args.rs | 4 | ||||
| -rw-r--r-- | src/test/compile-fail/extoption_env-no-args.rs | 11 | ||||
| -rw-r--r-- | src/test/compile-fail/extoption_env-not-string-literal.rs | 11 | ||||
| -rw-r--r-- | src/test/compile-fail/extoption_env-too-many-args.rs | 11 | ||||
| -rw-r--r-- | src/test/run-pass/extoption_env-not-defined.rs | 14 | ||||
| -rw-r--r-- | src/test/run-pass/issue-5530.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/match-enum-struct-0.rs | 24 | ||||
| -rw-r--r-- | src/test/run-pass/match-enum-struct-1.rs | 26 | ||||
| -rw-r--r-- | src/test/run-pass/match-struct-0.rs | 29 |
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!(), + _ => (), + } +} |
