on master help sign in
Skip snapshot test if Git is not available

closes #161

commit86c17772053b10431531101686aec64d76a08122 authorsharkdp <davidpeter@web.de> dateFri 1 Jun 2018, 00:33 (8 years ago) parent16874ab
3 files changed+14−2
Cargo.toml+1−1 tests/tester.rs+1−1 tests/tests.rs+12
Cargo.toml+1−1
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
77name = "bat"
88readme = "README.md"
99repository = "https://github.com/sharkdp/bat"
10−version = "0.4.0"
10+version = "0.4.1"
1111exclude = [
1212 "assets/syntaxes/*",
1313 "assets/themes/*",
tests/tester.rs+1−1
@@ -11,7 +11,7 @@ pub struct BatTester {
1111impl BatTester {
1212 pub fn new() -> Self {
1313 modify_sample_file();
14− // Lifted from fd :)
14+
1515 let root = env::current_exe()
1616 .expect("tests executable")
1717 .parent()
tests/tests.rs+12
@@ -1,5 +1,6 @@
11mod tester;
22
3+use std::process::{Command, Stdio};
34use tester::BatTester;
45
56static STYLES: &'static [&'static str] = &[
@@ -24,6 +25,17 @@ static STYLES: &'static [&'static str] = &[
2425
2526#[test]
2627fn test_snapshots() {
28+ let status = Command::new("git")
29+ .arg("rev-parse")
30+ .stdout(Stdio::null())
31+ .stderr(Stdio::null())
32+ .status();
33+
34+ if !status.map(|s| s.success()).unwrap_or(false) {
35+ // Git not available or not a git repository. Skipping snapshot test.
36+ return;
37+ }
38+
2739 let bat_tester = BatTester::new();
2840
2941 for style in STYLES {