]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/reachable-unnameable-items.rs
Add more tests for unnameable reachable items
[rust.git] / src / test / run-pass / reachable-unnameable-items.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // aux-build:reachable-unnameable-items.rs
12
13 #![feature(braced_empty_structs)]
14 #![feature(recover)]
15
16 extern crate reachable_unnameable_items;
17 use reachable_unnameable_items::*;
18
19 fn main() {
20     let res1 = function_returning_unnameable_type().method_of_unnameable_type1();
21     let res2 = CONSTANT_OF_UNNAMEABLE_TYPE.method_of_unnameable_type2();
22     let res4 = AliasOfUnnameableType{}.method_of_unnameable_type4();
23     let res5 = function_returning_unnameable_type().inherent_method_returning_unnameable_type().
24                                                     method_of_unnameable_type5();
25     let res6 = function_returning_unnameable_type().trait_method_returning_unnameable_type().
26                                                     method_of_unnameable_type6();
27     let res7 = STATIC.field_of_unnameable_type.method_of_unnameable_type7();
28     let res8 = generic_function::<AliasOfUnnameableType>().method_of_unnameable_type8();
29     let res_enum = NameableVariant.method_of_unnameable_enum();
30     assert_eq!(res1, "Hello1");
31     assert_eq!(res2, "Hello2");
32     assert_eq!(res4, "Hello4");
33     assert_eq!(res5, "Hello5");
34     assert_eq!(res6, "Hello6");
35     assert_eq!(res7, "Hello7");
36     assert_eq!(res8, "Hello8");
37     assert_eq!(res_enum, "HelloEnum");
38
39     let none = None;
40     function_accepting_unnameable_type(none);
41     let _guard = std::panic::recover(|| none.unwrap().method_of_unnameable_type3());
42 }