2011-06-30 11:22:10 -07:00
|
|
|
#[cfg(bogus)]
|
2011-07-27 14:19:39 +02:00
|
|
|
const b: bool = false;
|
2011-06-30 11:22:10 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
const b: bool = true;
|
2011-06-30 11:22:10 -07:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2011-11-16 22:49:38 -06:00
|
|
|
#[abi = "cdecl"]
|
2012-07-03 16:11:00 -07:00
|
|
|
extern mod rustrt {
|
2011-07-27 14:19:39 +02:00
|
|
|
// This symbol doesn't exist and would be a link error if this
|
|
|
|
// module was translated
|
|
|
|
fn bogus();
|
2011-06-30 11:22:10 -07:00
|
|
|
}
|
|
|
|
|
2011-11-16 22:49:38 -06:00
|
|
|
#[abi = "cdecl"]
|
2012-07-03 16:11:00 -07:00
|
|
|
extern mod rustrt { }
|
2011-06-30 11:22:10 -07:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
type t = int;
|
|
|
|
|
|
|
|
type t = bool;
|
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2012-01-19 18:31:08 -08:00
|
|
|
enum tg { foo, }
|
2011-06-30 11:22:10 -07:00
|
|
|
|
2012-01-19 18:31:08 -08:00
|
|
|
enum tg { bar, }
|
2011-06-30 11:22:10 -07:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
2012-08-15 18:46:55 -07:00
|
|
|
struct r {
|
2012-06-06 14:37:41 -07:00
|
|
|
let i: int;
|
|
|
|
new(i:int) { self.i = i; }
|
2012-05-15 20:33:59 -07:00
|
|
|
}
|
2011-06-30 11:22:10 -07:00
|
|
|
|
2012-08-15 18:46:55 -07:00
|
|
|
struct r {
|
2012-06-06 14:37:41 -07:00
|
|
|
let i: int;
|
|
|
|
new(i:int) { self.i = i; }
|
2012-05-15 20:33:59 -07:00
|
|
|
}
|
2011-06-30 11:22:10 -07:00
|
|
|
|
|
|
|
#[cfg(bogus)]
|
|
|
|
mod m {
|
2011-07-27 14:19:39 +02:00
|
|
|
// This needs to parse but would fail in typeck. Since it's not in
|
|
|
|
// the current config it should not be typechecked.
|
2012-08-01 17:30:05 -07:00
|
|
|
fn bogus() { return 0; }
|
2011-06-30 11:22:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
mod m {
|
|
|
|
|
2011-07-27 14:19:39 +02: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 11:22:10 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn f() { }
|
2011-06-30 11:22:10 -07:00
|
|
|
}
|
|
|
|
|
2011-06-29 17:38:40 -07: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 11:22:10 -07:00
|
|
|
fn main() {
|
2011-07-27 14:19:39 +02: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 13:04:02 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
test_in_fn_ctxt();
|
2011-06-30 11:22:10 -07:00
|
|
|
}
|
|
|
|
|
2011-06-30 13:04:02 -07:00
|
|
|
fn test_in_fn_ctxt() {
|
2011-07-27 14:19:39 +02: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 13:04:02 -07:00
|
|
|
}
|
2011-07-05 13:29:21 -07:00
|
|
|
|
2012-06-26 16:18:37 -07:00
|
|
|
mod test_foreign_items {
|
2011-11-16 22:49:38 -06:00
|
|
|
#[abi = "cdecl"]
|
2012-07-03 16:11:00 -07:00
|
|
|
extern mod rustrt {
|
2011-07-27 14:19:39 +02:00
|
|
|
#[cfg(bogus)]
|
2012-08-31 15:28:44 -07:00
|
|
|
fn rust_getcwd() -> *();
|
|
|
|
fn rust_getcwd() -> *();
|
2011-07-27 14:19:39 +02:00
|
|
|
}
|
2011-08-10 09:27:22 -07:00
|
|
|
}
|
2012-07-09 14:02:39 -07:00
|
|
|
|
|
|
|
mod test_use_statements {
|
|
|
|
#[cfg(bogus)]
|
|
|
|
use flippity_foo;
|
|
|
|
|
|
|
|
extern mod rustrt {
|
|
|
|
#[cfg(bogus)]
|
|
|
|
use flippity_foo;
|
|
|
|
}
|
|
|
|
}
|