Skip to content

Commit

Permalink
fix: move to proper rust integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
bconn98 committed Dec 22, 2023
1 parent 4c8cd02 commit ce115dc
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 85 deletions.
20 changes: 0 additions & 20 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,3 @@ jobs:

- name: Bench features
run: cargo bench --all-features

examples:
name: Project Examples
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout the source code
uses: actions/checkout@v4

- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable

- name: Run compile_time_config
run: cargo run
working-directory: test/color-test
env:
RUST_BACKTRACE: 1
File renamed without changes.
10 changes: 0 additions & 10 deletions test/color-test/Cargo.toml

This file was deleted.

55 changes: 0 additions & 55 deletions test/color-test/src/main.rs

This file was deleted.

File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions tests/color_control.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use std::process::Command;

fn execute_test(env_key: &str, env_val: &str) {
let mut child_proc = Command::new("cargo")
.args(&["run", "--example", "compile_time_config"])
.env(env_key, env_val)
.spawn()
.expect("Cargo command failed to start");

let ecode = child_proc.wait()
.expect("failed to wait on child");

assert!(ecode.success());
}

// Maintaining as a single test to avoid blocking calls to the package cache
#[test]
fn test_no_color() {
let keys = vec!("NO_COLOR", "CLICOLOR_FORCE", "CLICOLOR");

for key in keys {
execute_test(key, "1");
execute_test(key, "0");
}
}

0 comments on commit ce115dc

Please sign in to comment.