rust/src/test/run-pass/import-glob-circular.rs
Paul Stansifer b4c3b83f26 Fix bug: globbed imports were importing everything visible from the other
module, not just everything exported.
2011-06-22 15:41:39 -07:00

61 lines
985 B
Rust

import test1::*;
import test2::*;
mod circ1 {
import circ1::*;
export f1;
export f2;
export common;
fn f1() -> uint {
ret 1u
}
fn common() -> uint {
ret 1u;
}
}
mod circ2 {
import circ2::*;
export f1;
export f2;
export common;
fn f2() -> uint {
ret 2u;
}
fn common() -> uint {
ret 2u;
}
}
mod test1 {
import circ1::*;
fn test1() {
assert(f1() == 1u);
//make sure that cached lookups work...
assert(f1() == 1u);
//assert(f2() == 2u); //TODO: renable when 'reexport' is implemented
//assert(f2() == 2u);
assert(common() == 1u);
assert(common() == 1u);
}
}
mod test2 {
import circ2::*;
fn test2() {
//assert(f1() == 1u); //TODO: renable when 'reexport' is implemented
////make sure that cached lookups work...
//assert(f1() == 1u);
assert(f2() == 2u);
assert(f2() == 2u);
assert(common() == 2u);
assert(common() == 2u);
}
}
fn main() {
test1();
test2();
}