Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Check formatting on code at build time #282

Merged
merged 2 commits into from
Jan 20, 2020
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ before_script:
- |
pip install 'travis-cargo<0.2' --user &&
export PATH=$HOME/.local/bin:$PATH
if [ "$CHECK" = "true" ]; then rustup component add rustfmt ; fi

script:
- travis-cargo build -- $FEATURES
- travis-cargo --skip 1.13.0 test -- $FEATURES
- if [ "$CHECK" = "true" ]; then travis-cargo fmt -- -- --check ; fi
- if [ "$CHECK" = "" ]; then travis-cargo build -- $FEATURES ; fi
- if [ "$CHECK" = "" ]; then travis-cargo --skip 1.13.0 test -- $FEATURES ; fi

after_success:
- travis-cargo --only stable doc
Expand All @@ -42,6 +44,9 @@ env:
- FEATURES=--no-default-features

matrix:
include:
- env: CHECK=true
rust: stable
exclude:
- env: FEATURES=--features=backtrace
rust: 1.13.0
9 changes: 6 additions & 3 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,19 @@ fn has_backtrace_depending_on_env() {
use std::path::PathBuf;
use std::process::Command;

let cmd_folder = if cfg!(build="debug") {
let cmd_folder = if cfg!(build = "debug") {
"debug"
} else if cfg!(build="release") {
} else if cfg!(build = "release") {
"release"
} else {
panic!("Unknown build config");
};

let cmd_path = if cfg!(windows) {
PathBuf::from(format!("./target/{}/examples/has_backtrace.exe", cmd_folder))
PathBuf::from(format!(
"./target/{}/examples/has_backtrace.exe",
cmd_folder
))
} else {
PathBuf::from(format!("./target/{}/examples/has_backtrace", cmd_folder))
};
Expand Down