rustpkg: Add a few tests
There's no test runner for rustpkg yet; just sketching out a few basic test scenarios. pass/ contains packages that should compile successfully, whereas fail/ contains packages that should fail to build.
This commit is contained in:
parent
c01c3d9fc6
commit
e6c3c371a5
22
src/librustpkg/testsuite/fail/no-inferred-crates/zzyzx.rs
Normal file
22
src/librustpkg/testsuite/fail/no-inferred-crates/zzyzx.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
The test runner should check that, after `rustpkg build hello-world`:
|
||||
* testsuite/hello-world/build/ exists
|
||||
* testsuite/hello-world/build/ contains an executable named hello-world
|
||||
* testsuite/hello-world/build/ does not contain a library
|
||||
*/
|
||||
|
||||
use core::io;
|
||||
|
||||
fn main() {
|
||||
io::println(~"Hello world!");
|
||||
}
|
3
src/librustpkg/testsuite/pass/fancy-lib/bar.rs
Normal file
3
src/librustpkg/testsuite/pass/fancy-lib/bar.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub fn assert_true() {
|
||||
assert!(true);
|
||||
}
|
24
src/librustpkg/testsuite/pass/fancy-lib/fancy-lib.rc
Normal file
24
src/librustpkg/testsuite/pass/fancy-lib/fancy-lib.rc
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
The test runner should check that, after `rustpkg build fancy-lib`:
|
||||
* testsuite/fancy-lib/build/ exists
|
||||
* testsuite/fancy-lib/build/ contains a file called generated.rs
|
||||
* testsuite/fancy-lib/build/ contains a library named libfancy_lib
|
||||
* testsuite/fancy-lib/build/ does not contain an executable
|
||||
*
|
||||
*/
|
||||
|
||||
extern mod std;
|
||||
|
||||
pub mod foo;
|
||||
pub mod bar;
|
||||
#[path = "build/generated.rs"] pub mod generated;
|
24
src/librustpkg/testsuite/pass/fancy-lib/fancy-lib.rs
Normal file
24
src/librustpkg/testsuite/pass/fancy-lib/fancy-lib.rs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
The test runner should check that, after `rustpkg build fancy-lib`:
|
||||
* testsuite/fancy-lib/build/ exists
|
||||
* testsuite/fancy-lib/build/ contains a file called generated.rs
|
||||
* testsuite/fancy-lib/build/ contains a library named libfancy_lib
|
||||
* testsuite/fancy-lib/build/ does not contain an executable
|
||||
*
|
||||
*/
|
||||
|
||||
extern mod std;
|
||||
|
||||
pub mod foo;
|
||||
pub mod bar;
|
||||
pub mod generated;
|
2
src/librustpkg/testsuite/pass/fancy-lib/foo.rs
Normal file
2
src/librustpkg/testsuite/pass/fancy-lib/foo.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub fn do_nothing() {
|
||||
}
|
17
src/librustpkg/testsuite/pass/fancy-lib/pkg.rs
Normal file
17
src/librustpkg/testsuite/pass/fancy-lib/pkg.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
let cwd = os::getcwd();
|
||||
debug!("cwd = %s", cwd.to_str());
|
||||
let file = io::file_writer(&Path(~"fancy-lib/build/generated.rs"),
|
||||
[io::Create]).get();
|
||||
file.write_str("pub fn wheeeee() { for [1, 2, 3].each() |_| { assert!(true); } }");
|
||||
}
|
22
src/librustpkg/testsuite/pass/hello-world/main.rs
Normal file
22
src/librustpkg/testsuite/pass/hello-world/main.rs
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
The test runner should check that, after `rustpkg build hello-world`:
|
||||
* testsuite/hello-world/build/ exists
|
||||
* testsuite/hello-world/build/ contains an executable named hello-world
|
||||
* testsuite/hello-world/build/ does not contain a library
|
||||
*/
|
||||
|
||||
use core::io;
|
||||
|
||||
fn main() {
|
||||
io::println(~"Hello world!");
|
||||
}
|
3
src/librustpkg/testsuite/pass/simple-lib/bar.rs
Normal file
3
src/librustpkg/testsuite/pass/simple-lib/bar.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub fn assert_true() {
|
||||
assert!(true);
|
||||
}
|
2
src/librustpkg/testsuite/pass/simple-lib/foo.rs
Normal file
2
src/librustpkg/testsuite/pass/simple-lib/foo.rs
Normal file
@ -0,0 +1,2 @@
|
||||
pub fn do_nothing() {
|
||||
}
|
21
src/librustpkg/testsuite/pass/simple-lib/lib.rs
Normal file
21
src/librustpkg/testsuite/pass/simple-lib/lib.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
The test runner should check that, after `rustpkg build simple-lib`:
|
||||
* testsuite/simple-lib/build/ exists
|
||||
* testsuite/simple-lib/build/ contains a library named libsimple_lib
|
||||
* testsuite/simple-lib/build/ does not contain an executable
|
||||
*/
|
||||
|
||||
extern mod std;
|
||||
|
||||
pub mod foo;
|
||||
pub mod bar;
|
21
src/librustpkg/testsuite/pass/simple-lib/simple-lib.rc
Normal file
21
src/librustpkg/testsuite/pass/simple-lib/simple-lib.rc
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
/*
|
||||
The test runner should check that, after `rustpkg build simple-lib`:
|
||||
* testsuite/simple-lib/build/ exists
|
||||
* testsuite/simple-lib/build/ contains a library named libsimple_lib
|
||||
* testsuite/simple-lib/build/ does not contain an executable
|
||||
*/
|
||||
|
||||
extern mod std;
|
||||
|
||||
pub mod foo;
|
||||
pub mod bar;
|
Loading…
x
Reference in New Issue
Block a user