Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustpkg: Add a few tests #5897

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
rustpkg: Add a few tests
There's no test runner for rustpkg yet; just sketching out a few
basic test scenarios.
catamorphism committed Apr 16, 2013
commit b5c1dfc658c5f780f0e45f7e928499ecf0072bc5
3 changes: 3 additions & 0 deletions src/librustpkg/testsuite/fancy-lib/bar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn assert_true() {
assert!(true);
}
24 changes: 24 additions & 0 deletions src/librustpkg/testsuite/fancy-lib/fancy-lib.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 2 additions & 0 deletions src/librustpkg/testsuite/fancy-lib/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub fn do_nothing() {
}
14 changes: 14 additions & 0 deletions src/librustpkg/testsuite/fancy-lib/pkg.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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() {
write_file(~"build/generated.rs",
"pub fn wheeeee() { for [1, 2, 3].each() { assert!(true); } }");
}
21 changes: 21 additions & 0 deletions src/librustpkg/testsuite/hello-world/main.rs
Original file line number Diff line number Diff line change
@@ -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 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 changes: 3 additions & 0 deletions src/librustpkg/testsuite/simple-lib/bar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn assert_true() {
assert!(true);
}
2 changes: 2 additions & 0 deletions src/librustpkg/testsuite/simple-lib/foo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub fn do_nothing() {
}
21 changes: 21 additions & 0 deletions src/librustpkg/testsuite/simple-lib/lib.rs
Original file line number Diff line number Diff line change
@@ -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;