1+ // Copyright 2012 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+ // xfail-fast
12+ // aux-build:xc_conditions.rs
13+
14+ extern mod xc_conditions;
15+ use xc_conditions:: oops;
16+ use xc_conditions:: trouble;
17+
18+ // Tests of cross-crate conditions; the condition is
19+ // defined in lib, and we test various combinations
20+ // of `trap` and `raise` in the client or the lib where
21+ // the condition was defined. Also in test #4 we use
22+ // more complex features (generics, traits) in
23+ // combination with the condition.
24+ //
25+ // trap raise
26+ // ------------
27+ // xc_conditions : client lib
28+ // xc_conditions_2: client client
29+ // xc_conditions_3: lib client
30+ // xc_conditions_4: client client (with traits)
31+ //
32+ // the trap=lib, raise=lib case isn't tested since
33+ // there's no cross-crate-ness to test in that case.
34+
35+ pub fn main ( ) {
36+ do oops:: cond. trap ( |_i| 12345 ) . inside {
37+ let x = trouble ( ) ;
38+ assert_eq ! ( x, 12345 ) ;
39+ }
40+ }
0 commit comments