diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-11-28 12:38:53 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-28 13:17:33 -0800 |
| commit | fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6 (patch) | |
| tree | bd9de2c450f23b8ff0e09130ab59d784ace5b5e3 /src/test | |
| parent | 669fbddc4435a9ab152332df06a7fcca789c8059 (diff) | |
| parent | 8179e268efd86ae5c1bcf21b4f8d4e01eea7c193 (diff) | |
| download | rust-fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6.tar.gz rust-fc06114ddfd2bcdbc4f29076c226a7a1d66ea8d6.zip | |
Merge remote-tracking branch 'brson/companion' into incoming
Conflicts: src/compiletest/compiletest.rs src/libcargo/cargo.rs src/libcore/core.rs src/librustc/rustc.rs src/librustdoc/rustdoc.rc
Diffstat (limited to 'src/test')
41 files changed, 22 insertions, 412 deletions
diff --git a/src/test/compile-fail/attr-bad-crate-attr.rc b/src/test/compile-fail/attr-bad-crate-attr.rc index 0a86c40a3af..8d1d15138fd 100644 --- a/src/test/compile-fail/attr-bad-crate-attr.rc +++ b/src/test/compile-fail/attr-bad-crate-attr.rc @@ -1,4 +1,4 @@ -// error-pattern: expected `mod` +// error-pattern: expected item #[attr = "val"]; #[attr = "val"] // Unterminated diff --git a/src/test/run-pass/companionmod-src/b.rs b/src/test/run-pass/companionmod-src/b.rs deleted file mode 100644 index e4350ab4ee7..00000000000 --- a/src/test/run-pass/companionmod-src/b.rs +++ /dev/null @@ -1,2 +0,0 @@ -use g = x::f; -export g; \ No newline at end of file diff --git a/src/test/run-pass/companionmod-src/b/x.rs b/src/test/run-pass/companionmod-src/b/x.rs deleted file mode 100644 index d81ff2ba9a5..00000000000 --- a/src/test/run-pass/companionmod-src/b/x.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() -> ~str { ~"ralph" } \ No newline at end of file diff --git a/src/test/run-pass/companionmod-src/d.rs b/src/test/run-pass/companionmod-src/d.rs deleted file mode 100644 index e4350ab4ee7..00000000000 --- a/src/test/run-pass/companionmod-src/d.rs +++ /dev/null @@ -1,2 +0,0 @@ -use g = x::f; -export g; \ No newline at end of file diff --git a/src/test/run-pass/companionmod-src/d/x.rs b/src/test/run-pass/companionmod-src/d/x.rs deleted file mode 100644 index b27e39327f1..00000000000 --- a/src/test/run-pass/companionmod-src/d/x.rs +++ /dev/null @@ -1 +0,0 @@ -fn f() -> ~str { ~"nelson" } \ No newline at end of file diff --git a/src/test/run-pass/companionmod.rc b/src/test/run-pass/companionmod.rc deleted file mode 100644 index 8736345c982..00000000000 --- a/src/test/run-pass/companionmod.rc +++ /dev/null @@ -1,19 +0,0 @@ -// xfail-win32 don't understand what's wrong -// Test that crates and directory modules can contain code -#[legacy_exports]; - -#[path = "companionmod-src"] -mod a { - #[legacy_exports]; - mod b { - #[legacy_exports]; - #[legacy_exports] - mod x; - } - #[path = "d"] - mod c { - #[legacy_exports]; - #[legacy_exports] - mod x; - } -} diff --git a/src/test/run-pass/companionmod.rs b/src/test/run-pass/companionmod.rs deleted file mode 100644 index ff15fe58056..00000000000 --- a/src/test/run-pass/companionmod.rs +++ /dev/null @@ -1,8 +0,0 @@ -// This isn't really xfailed; it's used by the companionmod.rc test -// xfail-test - -#[legacy_exports]; -fn main() { - assert a::b::g() == ~"ralph"; - assert a::c::g() == ~"nelson"; -} \ No newline at end of file diff --git a/src/test/run-pass/crate-attributes-src/foo.rs b/src/test/run-pass/crate-attributes-src/foo.rs deleted file mode 100644 index 7086ebf2ea8..00000000000 --- a/src/test/run-pass/crate-attributes-src/foo.rs +++ /dev/null @@ -1,9 +0,0 @@ -// These are attributes of the foo module -#[legacy_exports]; -#[attr1 = "val"]; -#[attr2 = "val"]; - -// Attributes of the following function -#[attr1 = "val"] -#[attr2 = "val"] -fn main() { } diff --git a/src/test/run-pass/crate-attributes.rc b/src/test/run-pass/crate-attributes.rc deleted file mode 100644 index 2ee41913f40..00000000000 --- a/src/test/run-pass/crate-attributes.rc +++ /dev/null @@ -1,13 +0,0 @@ -#[name = "crate-attributes"]; -#[vers = "1.0"]; - -#[attr1] -#[path = "crate-attributes-src"] -mod m { - #[legacy_exports]; - #[attr_inner]; - - #[attr2] - #[legacy_exports] - mod foo; -} diff --git a/src/test/run-pass/mod-merge-hack-inst.rs b/src/test/run-pass/mod-merge-hack-inst.rs new file mode 100644 index 00000000000..d61c6383ee5 --- /dev/null +++ b/src/test/run-pass/mod-merge-hack-inst.rs @@ -0,0 +1,6 @@ +// xfail-test not a test. used by mod-merge-hack.rs + +mod inst { + pub type T = i32; + pub const bits: uint = 32; +} diff --git a/src/test/run-pass/mod-merge-hack-template.rs b/src/test/run-pass/mod-merge-hack-template.rs new file mode 100644 index 00000000000..a659d8b0e5f --- /dev/null +++ b/src/test/run-pass/mod-merge-hack-template.rs @@ -0,0 +1,6 @@ +// xfail-test not a test. used by mod-merge-hack.rs + +use T = inst::T; + +pub const bits: uint = inst::bits; +pub pure fn min(x: T, y: T) -> T { if x < y { x } else { y } } diff --git a/src/test/run-pass/mod-merge-hack.rs b/src/test/run-pass/mod-merge-hack.rs new file mode 100644 index 00000000000..c6e0901779b --- /dev/null +++ b/src/test/run-pass/mod-merge-hack.rs @@ -0,0 +1,9 @@ +// xfail-pretty +#[path = "mod-merge-hack-template.rs"] +#[merge = "mod-merge-hack-inst.rs"] +mod myint32; + +fn main() { + assert myint32::bits == 32; + assert myint32::min(10, 20) == 10; +} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism-files/inst_f32.rs b/src/test/run-pass/module-polymorphism-files/inst_f32.rs deleted file mode 100644 index ea7d8fd77a0..00000000000 --- a/src/test/run-pass/module-polymorphism-files/inst_f32.rs +++ /dev/null @@ -1 +0,0 @@ -type T = f32; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism-files/inst_f64.rs b/src/test/run-pass/module-polymorphism-files/inst_f64.rs deleted file mode 100644 index 8811863b27c..00000000000 --- a/src/test/run-pass/module-polymorphism-files/inst_f64.rs +++ /dev/null @@ -1 +0,0 @@ -type T = f64; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism-files/inst_float.rs b/src/test/run-pass/module-polymorphism-files/inst_float.rs deleted file mode 100644 index 5726ccf7ad0..00000000000 --- a/src/test/run-pass/module-polymorphism-files/inst_float.rs +++ /dev/null @@ -1 +0,0 @@ -type T = float; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism-files/template.rs b/src/test/run-pass/module-polymorphism-files/template.rs deleted file mode 100644 index c8d52145cab..00000000000 --- a/src/test/run-pass/module-polymorphism-files/template.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn plus(x: T, y: T) -> T { - x + y -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism.rc b/src/test/run-pass/module-polymorphism.rc deleted file mode 100644 index bce2d80e045..00000000000 --- a/src/test/run-pass/module-polymorphism.rc +++ /dev/null @@ -1,51 +0,0 @@ -#[path = "module-polymorphism-files"] -mod my_float { - #[legacy_exports]; - - // The type of the float - use inst::T; - - // Define T as float - #[path = "inst_float.rs"] - #[legacy_exports] - mod inst; - - // Add in the implementation from a single source file - #[path = "template.rs"] - #[legacy_exports] - mod template; - -} - -#[path = "module-polymorphism-files"] -mod my_f64 { - #[legacy_exports]; - - use inst::T; - - // Define T as f64 - #[path = "inst_f64.rs"] - #[legacy_exports] - mod inst; - - // Use the implementation for the same source file! - #[path = "template.rs"] - #[legacy_exports] - mod template; - -} - -#[path = "module-polymorphism-files"] -mod my_f32 { - #[legacy_exports]; - use inst::T; - - #[path = "inst_f32.rs"] - #[legacy_exports] - mod inst; - - #[path = "template.rs"] - #[legacy_exports] - mod template; - -} diff --git a/src/test/run-pass/module-polymorphism.rs b/src/test/run-pass/module-polymorphism.rs deleted file mode 100644 index 26c3582d6a6..00000000000 --- a/src/test/run-pass/module-polymorphism.rs +++ /dev/null @@ -1,11 +0,0 @@ -// This isn't really xfailed; it's used by the -// module-polymorphism.rc test -// xfail-test - -fn main() { - // All of these functions are defined by a single module - // source file but instantiated for different types - assert my_float::template::plus(1.0f, 2.0f) == 3.0f; - assert my_f64::template::plus(1.0f64, 2.0f64) == 3.0f64; - assert my_f32::template::plus(1.0f32, 2.0f32) == 3.0f32; -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism2-files/float-template/inst_f32.rs b/src/test/run-pass/module-polymorphism2-files/float-template/inst_f32.rs deleted file mode 100644 index ea7d8fd77a0..00000000000 --- a/src/test/run-pass/module-polymorphism2-files/float-template/inst_f32.rs +++ /dev/null @@ -1 +0,0 @@ -type T = f32; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism2-files/float-template/inst_f64.rs b/src/test/run-pass/module-polymorphism2-files/float-template/inst_f64.rs deleted file mode 100644 index 8811863b27c..00000000000 --- a/src/test/run-pass/module-polymorphism2-files/float-template/inst_f64.rs +++ /dev/null @@ -1 +0,0 @@ -type T = f64; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism2-files/float-template/inst_float.rs b/src/test/run-pass/module-polymorphism2-files/float-template/inst_float.rs deleted file mode 100644 index 5726ccf7ad0..00000000000 --- a/src/test/run-pass/module-polymorphism2-files/float-template/inst_float.rs +++ /dev/null @@ -1 +0,0 @@ -type T = float; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism2-files/float-template/template.rs b/src/test/run-pass/module-polymorphism2-files/float-template/template.rs deleted file mode 100644 index c8d52145cab..00000000000 --- a/src/test/run-pass/module-polymorphism2-files/float-template/template.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn plus(x: T, y: T) -> T { - x + y -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism2.rc b/src/test/run-pass/module-polymorphism2.rc deleted file mode 100644 index 49cd60fc0a9..00000000000 --- a/src/test/run-pass/module-polymorphism2.rc +++ /dev/null @@ -1,68 +0,0 @@ -#[path = "module-polymorphism2-files"] -mod mystd { - #[legacy_exports]; - - #[path = "float-template"] - mod float { - #[legacy_exports]; - // The type of the float - use inst::T; - - // Unfortunate - use template::*; - export plus; - - // Define T as float - #[path = "inst_float.rs"] - #[legacy_exports] - mod inst; - - // Add in the implementation from a single source file - #[path = "template.rs"] - #[legacy_exports] - mod template; - } - - - #[path = "float-template"] - mod f64 { - #[legacy_exports]; - - use inst::T; - - // Unfortunate - use template::*; - export plus; - - // Define T as f64 - #[path = "inst_f64.rs"] - #[legacy_exports] - mod inst; - - // Use the implementation for the same source file! - #[path = "template.rs"] - #[legacy_exports] - mod template; - - } - - #[path = "float-template"] - mod f32 { - #[legacy_exports]; - use inst::T; - - // Unfortunate - use template::*; - export plus; - - #[path = "inst_f32.rs"] - #[legacy_exports] - mod inst; - - #[path = "template.rs"] - #[legacy_exports] - mod template; - - } - -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism2.rs b/src/test/run-pass/module-polymorphism2.rs deleted file mode 100644 index 7bb55c45430..00000000000 --- a/src/test/run-pass/module-polymorphism2.rs +++ /dev/null @@ -1,11 +0,0 @@ -// This isn't really xfailed; it's used by the -// module-polymorphism.rc test -// xfail-test - -fn main() { - // All of these functions are defined by a single module - // source file but instantiated for different types - assert mystd::float::plus(1.0f, 2.0f) == 3.0f; - assert mystd::f64::plus(1.0f64, 2.0f64) == 3.0f64; - assert mystd::f32::plus(1.0f32, 2.0f32) == 3.0f32; -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism3-files/float-template.rs b/src/test/run-pass/module-polymorphism3-files/float-template.rs deleted file mode 100644 index c8d52145cab..00000000000 --- a/src/test/run-pass/module-polymorphism3-files/float-template.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn plus(x: T, y: T) -> T { - x + y -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism3-files/float-template/inst_f32.rs b/src/test/run-pass/module-polymorphism3-files/float-template/inst_f32.rs deleted file mode 100644 index ea7d8fd77a0..00000000000 --- a/src/test/run-pass/module-polymorphism3-files/float-template/inst_f32.rs +++ /dev/null @@ -1 +0,0 @@ -type T = f32; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism3-files/float-template/inst_f64.rs b/src/test/run-pass/module-polymorphism3-files/float-template/inst_f64.rs deleted file mode 100644 index 8811863b27c..00000000000 --- a/src/test/run-pass/module-polymorphism3-files/float-template/inst_f64.rs +++ /dev/null @@ -1 +0,0 @@ -type T = f64; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism3-files/float-template/inst_float.rs b/src/test/run-pass/module-polymorphism3-files/float-template/inst_float.rs deleted file mode 100644 index 5726ccf7ad0..00000000000 --- a/src/test/run-pass/module-polymorphism3-files/float-template/inst_float.rs +++ /dev/null @@ -1 +0,0 @@ -type T = float; \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism3.rc b/src/test/run-pass/module-polymorphism3.rc deleted file mode 100644 index 27d9753d9d5..00000000000 --- a/src/test/run-pass/module-polymorphism3.rc +++ /dev/null @@ -1,41 +0,0 @@ -// Use one template module to specify in a single file the implementation -// of functions for multiple types - -#[path = "module-polymorphism3-files"] -mod mystd { - #[legacy_exports]; - - // The template is specified in float-template.rs - #[path = "float-template"] - mod float { - #[legacy_exports]; - // The type of the float - use inst::T; - - // Define T as appropriate for platform - #[path = "inst_float.rs"] - mod inst; - } - - // Use the same template - #[path = "float-template"] - mod f64 { - #[legacy_exports]; - - use inst::T; - - // Define T as f64 - #[path = "inst_f64.rs"] - mod inst; - } - - #[path = "float-template"] - mod f32 { - #[legacy_exports]; - use inst::T; - - #[path = "inst_f32.rs"] - mod inst; - } - -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism3.rs b/src/test/run-pass/module-polymorphism3.rs deleted file mode 100644 index 7bb55c45430..00000000000 --- a/src/test/run-pass/module-polymorphism3.rs +++ /dev/null @@ -1,11 +0,0 @@ -// This isn't really xfailed; it's used by the -// module-polymorphism.rc test -// xfail-test - -fn main() { - // All of these functions are defined by a single module - // source file but instantiated for different types - assert mystd::float::plus(1.0f, 2.0f) == 3.0f; - assert mystd::f64::plus(1.0f64, 2.0f64) == 3.0f64; - assert mystd::f32::plus(1.0f32, 2.0f32) == 3.0f32; -} \ No newline at end of file diff --git a/src/test/run-pass/module-polymorphism4-files/cat.rs b/src/test/run-pass/module-polymorphism4-files/cat.rs deleted file mode 100644 index f19b72ed181..00000000000 --- a/src/test/run-pass/module-polymorphism4-files/cat.rs +++ /dev/null @@ -1,14 +0,0 @@ -type T = cat; - -enum cat { - howlycat, - meowlycat -} - -fn animal() -> ~str { ~"cat" } -fn talk(c: cat) -> ~str { - match c { - howlycat => { ~"howl" } - meowlycat => { ~"meow" } - } -} diff --git a/src/test/run-pass/module-polymorphism4-files/dog.rs b/src/test/run-pass/module-polymorphism4-files/dog.rs deleted file mode 100644 index 4fd212deb8d..00000000000 --- a/src/test/run-pass/module-polymorphism4-files/dog.rs +++ /dev/null @@ -1,9 +0,0 @@ -type T = dog; - -enum dog { - dog -} - -fn animal() -> ~str { ~"dog" } -fn talk(_d: dog) -> ~str { ~"woof" } - diff --git a/src/test/run-pass/module-polymorphism4-files/trait_.rs b/src/test/run-pass/module-polymorphism4-files/trait_.rs deleted file mode 100644 index 983a4039eeb..00000000000 --- a/src/test/run-pass/module-polymorphism4-files/trait_.rs +++ /dev/null @@ -1,13 +0,0 @@ -trait says { - fn says() -> ~str; -} - -impl T: says { - - // 'animal' and 'talk' functions are implemented by the module - // instantiating the talky trait. They are 'abstract' - fn says() -> ~str { - animal() + ~" says '" + talk(self) + ~"'" - } - -} diff --git a/src/test/run-pass/module-polymorphism4.rc b/src/test/run-pass/module-polymorphism4.rc deleted file mode 100644 index 4cb7acf8f03..00000000000 --- a/src/test/run-pass/module-polymorphism4.rc +++ /dev/null @@ -1,32 +0,0 @@ - -#[path = "module-polymorphism4-files"] -mod cat { - #[legacy_exports]; - - use inst::*; - - #[path = "cat.rs"] - #[legacy_exports] - mod inst; - - #[path = "trait_.rs"] - #[legacy_exports] - mod trait_; - -} - -#[path = "module-polymorphism4-files"] -mod dog { - #[legacy_exports]; - - use inst::*; - - #[path = "dog.rs"] - #[legacy_exports] - mod inst; - - #[path = "trait_.rs"] - #[legacy_exports] - mod trait_; - -} diff --git a/src/test/run-pass/module-polymorphism4.rs b/src/test/run-pass/module-polymorphism4.rs deleted file mode 100644 index 0824e5b49bb..00000000000 --- a/src/test/run-pass/module-polymorphism4.rs +++ /dev/null @@ -1,12 +0,0 @@ -// This isn't really xfailed; it's used by the -// module-polymorphism.rc test -// xfail-test - -fn main() { - let cat1 = cat::inst::meowlycat; - let cat2 = cat::inst::howlycat; - let dog = dog::inst::dog; - assert cat1.says() == ~"cat says 'meow'"; - assert cat2.says() == ~"cat says 'howl'"; - assert dog.says() == ~"dog says 'woof'"; -} \ No newline at end of file diff --git a/src/test/run-pass/multi-src/bar.rs b/src/test/run-pass/multi-src/bar.rs deleted file mode 100644 index 33699ac4f84..00000000000 --- a/src/test/run-pass/multi-src/bar.rs +++ /dev/null @@ -1,3 +0,0 @@ - - -fn other() { debug!("yes"); } diff --git a/src/test/run-pass/multi-src/foo.rs b/src/test/run-pass/multi-src/foo.rs deleted file mode 100644 index 466b6b9be56..00000000000 --- a/src/test/run-pass/multi-src/foo.rs +++ /dev/null @@ -1,3 +0,0 @@ - - -fn main() { debug!("hello, multi-file world."); bar::other(); } diff --git a/src/test/run-pass/multi.rc b/src/test/run-pass/multi.rc deleted file mode 100644 index 61c81030bba..00000000000 --- a/src/test/run-pass/multi.rc +++ /dev/null @@ -1,11 +0,0 @@ -#[path = "multi-src"] -mod multi { - #[legacy_exports]; - // implicitly #[path = "foo.rs"] - #[legacy_exports] - mod foo; - - #[path = "bar.rs"] - #[legacy_exports] - mod bar; -} diff --git a/src/test/run-pass/trait-mix.rc b/src/test/run-pass/trait-mix.rc deleted file mode 100644 index 818f41de262..00000000000 --- a/src/test/run-pass/trait-mix.rc +++ /dev/null @@ -1,8 +0,0 @@ -mod trait_mix { - #[legacy_exports]; - #[path = "trait-mix.rs"] - #[legacy_exports] - mod trait_mix; - #[legacy_exports] - mod u_trait_mix; -} diff --git a/src/test/run-pass/trait_mix/trait-mix.rs b/src/test/run-pass/trait_mix/trait-mix.rs deleted file mode 100644 index 800fb4f9006..00000000000 --- a/src/test/run-pass/trait_mix/trait-mix.rs +++ /dev/null @@ -1,27 +0,0 @@ - -impl f32: u_trait_mix::num { - pure fn add(&&other: f32) -> f32 { return self + other; } - pure fn sub(&&other: f32) -> f32 { return self - other; } - pure fn mul(&&other: f32) -> f32 { return self * other; } - pure fn div(&&other: f32) -> f32 { return self / other; } - pure fn modulo(&&other: f32) -> f32 { return self % other; } - pure fn neg() -> f32 { return -self; } - - pure fn to_int() -> int { return self as int; } - static pure fn from_int(n: int) -> f32 { return n as f32; } -} - -/* -It seems that this will fail if I try using it from another crate. - -*/ - -/* - -// ICEs if I put this in num -- ??? -trait from_int { - -} -*/ - -fn main() {} diff --git a/src/test/run-pass/trait_mix/u_trait_mix.rs b/src/test/run-pass/trait_mix/u_trait_mix.rs deleted file mode 100644 index 260955e687a..00000000000 --- a/src/test/run-pass/trait_mix/u_trait_mix.rs +++ /dev/null @@ -1,13 +0,0 @@ -trait num { - // FIXME: Trait composition. (#2616) - pure fn add(&&other: self) -> self; - pure fn sub(&&other: self) -> self; - pure fn mul(&&other: self) -> self; - pure fn div(&&other: self) -> self; - pure fn modulo(&&other: self) -> self; - pure fn neg() -> self; - - pure fn to_int() -> int; - static pure fn from_int(n: int) -> self; -} - |
