From 973c32ff7715b632e60541afc312295c94011bc5 Mon Sep 17 00:00:00 2001 From: Brian Grinstead Date: Fri, 16 Dec 2016 11:50:08 -0800 Subject: [PATCH] Update test boilerplate for running on travis (#134). r=rnewman * Include a local and external test. * Add license blocks. --- .gitignore | 1 + src/lib.rs | 19 ++++++++++++++++++- tests/external_test.rs | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 tests/external_test.rs diff --git a/.gitignore b/.gitignore index bac4bda0..aee1f22c 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ .nrepl-port /.lein-* /.nrepl-port +Cargo.lock /checkouts/ /classes/ /node_modules/ diff --git a/src/lib.rs b/src/lib.rs index cdfbe1aa..cd781274 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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)] mod tests { + use super::*; + #[test] fn it_works() { + assert_eq!(4, add_two(2)); } -} +} \ No newline at end of file diff --git a/tests/external_test.rs b/tests/external_test.rs new file mode 100644 index 00000000..ea8ff658 --- /dev/null +++ b/tests/external_test.rs @@ -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)); +} \ No newline at end of file