2011-06-30 18:22:10 +00:00
|
|
|
#[cfg(bogus)]
|
2011-07-27 12:19:39 +00:00
|
|
|
const b: bool = false;
|
2011-06-30 18:22:10 +00:00
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
const b: bool = true;
|
2011-06-30 18:22:10 +00:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2011-11-17 04:49:38 +00:00
|
|
|
#[abi = "cdecl"]
|
|
|
|
native mod rustrt {
|
2011-07-27 12:19:39 +00:00
|
|
|
// This symbol doesn't exist and would be a link error if this
|
|
|
|
// module was translated
|
|
|
|
fn bogus();
|
2011-06-30 18:22:10 +00:00
|
|
|
}
|
|
|
|
|
2011-11-17 04:49:38 +00:00
|
|
|
#[abi = "cdecl"]
|
|
|
|
native mod rustrt { }
|
2011-06-30 18:22:10 +00:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
type t = int;
|
|
|
|
|
|
|
|
type t = bool;
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2012-01-20 00:10:31 +00:00
|
|
|
enum tg { foo; }
|
2011-06-30 18:22:10 +00:00
|
|
|
|
2012-01-20 00:10:31 +00:00
|
|
|
enum tg { bar; }
|
2011-06-30 18:22:10 +00:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2011-07-27 12:19:39 +00:00
|
|
|
resource r(i: int) { }
|
2011-06-30 18:22:10 +00:00
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
resource r(i: int) { }
|
2011-06-30 18:22:10 +00:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
mod m {
|
2011-07-27 12:19:39 +00:00
|
|
|
// This needs to parse but would fail in typeck. Since it's not in
|
|
|
|
// the current config it should not be typechecked.
|
|
|
|
fn bogus() { ret 0; }
|
2011-06-30 18:22:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mod m {
|
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
// Submodules have slightly different code paths than the top-level
|
|
|
|
// module, so let's make sure this jazz works here as well
|
|
|
|
#[cfg(bogus)]
|
|
|
|
fn f() { }
|
2011-06-30 18:22:10 +00:00
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
fn f() { }
|
2011-06-30 18:22:10 +00:00
|
|
|
}
|
|
|
|
|
2011-06-30 00:38:40 +00:00
|
|
|
// Since the bogus configuration isn't defined main will just be
|
|
|
|
// parsed, but nothing further will be done with it
|
|
|
|
#[cfg(bogus)]
|
|
|
|
fn main() { fail }
|
|
|
|
|
2011-06-30 18:22:10 +00:00
|
|
|
fn main() {
|
2011-07-27 12:19:39 +00:00
|
|
|
// Exercise some of the configured items in ways that wouldn't be possible
|
|
|
|
// if they had the bogus definition
|
|
|
|
assert (b);
|
|
|
|
let x: t = true;
|
|
|
|
let y: tg = bar;
|
2011-06-30 20:04:02 +00:00
|
|
|
|
2011-07-27 12:19:39 +00:00
|
|
|
test_in_fn_ctxt();
|
2011-06-30 18:22:10 +00:00
|
|
|
}
|
|
|
|
|
2011-06-30 20:04:02 +00:00
|
|
|
fn test_in_fn_ctxt() {
|
2011-07-27 12:19:39 +00:00
|
|
|
#[cfg(bogus)]
|
|
|
|
fn f() { fail }
|
|
|
|
fn f() { }
|
|
|
|
f();
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
const i: int = 0;
|
|
|
|
const i: int = 1;
|
|
|
|
assert (i == 1);
|
2011-06-30 20:04:02 +00:00
|
|
|
}
|
2011-07-05 20:29:21 +00:00
|
|
|
|
|
|
|
mod test_native_items {
|
2011-11-17 04:49:38 +00:00
|
|
|
#[abi = "cdecl"]
|
|
|
|
native mod rustrt {
|
2011-07-27 12:19:39 +00:00
|
|
|
#[cfg(bogus)]
|
2011-09-01 01:47:29 +00:00
|
|
|
fn vec_from_buf_shared<T>(ptr: *T, count: uint) -> [T];
|
|
|
|
fn vec_from_buf_shared<T>(ptr: *T, count: uint) -> [T];
|
2011-07-27 12:19:39 +00:00
|
|
|
}
|
2011-08-10 16:27:22 +00:00
|
|
|
}
|