Update test boilerplate for running on travis (#134). r=rnewman

* Include a local and external test.
* Add license blocks.
This commit is contained in:
Brian Grinstead 2016-12-16 11:50:08 -08:00 committed by Richard Newman
parent 789eb59c9a
commit 973c32ff77
3 changed files with 35 additions and 1 deletions

1
.gitignore vendored
View file

@ -13,6 +13,7 @@
.nrepl-port .nrepl-port
/.lein-* /.lein-*
/.nrepl-port /.nrepl-port
Cargo.lock
/checkouts/ /checkouts/
/classes/ /classes/
/node_modules/ /node_modules/

View file

@ -1,6 +1,23 @@
// Copyright 2016 Mozilla
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
pub fn add_two(a: i32) -> i32 {
a + 2
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
#[test] #[test]
fn it_works() { fn it_works() {
assert_eq!(4, add_two(2));
} }
} }

16
tests/external_test.rs Normal file
View file

@ -0,0 +1,16 @@
// Copyright 2016 Mozilla
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
extern crate datomish;
#[test]
fn external_test() {
assert_eq!(4, datomish::add_two(2));
}