Skip to content

Commit

Permalink
test: Make shell integration tests non-blocking
Browse files Browse the repository at this point in the history
We're running into the problem of tests being dependent on the version
of the command.
  • Loading branch information
epage committed Sep 27, 2024
1 parent a6286cf commit acd6e12
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ jobs:
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- name: Install shells
if: runner.os == 'Linux'
run: sudo apt-get install -y elvish fish zsh
- name: Build
run: make build-${{matrix.features}}
- name: Test
Expand All @@ -84,6 +81,22 @@ jobs:
run: make test-minimal ARGS='--manifest-path Cargo.toml'
- name: Test dynamic completions
run: cargo test -p clap_complete -F unstable-dynamic
shell-integration:
name: Shell Integration
runs-on: buildjet-8vcpu-ubuntu-2204
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Install shells
if: runner.os == 'Linux'
run: sudo apt-get install -y elvish fish zsh
- name: Test dynamic completions
run: cargo test -p clap_complete -F unstable-dynamic --test testsuite -- --ignored
check:
name: Check
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions clap_complete/tests/testsuite/bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ fn register_completion() {

#[test]
#[cfg(unix)]
#[ignore]
fn complete() {
if !common::has_command(CMD) {
return;
Expand Down Expand Up @@ -242,6 +243,7 @@ fn register_dynamic_env() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_toplevel() {
if !common::has_command(CMD) {
return;
Expand All @@ -262,6 +264,7 @@ quote pacman alias help --generate --version

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_help() {
if !common::has_command(CMD) {
return;
Expand All @@ -283,6 +286,7 @@ cmd-backticks cmd-expansions --single-quotes --backticks --ex

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_option_value() {
if !common::has_command(CMD) {
return;
Expand All @@ -304,6 +308,7 @@ fn complete_dynamic_env_option_value() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_value() {
if !common::has_command(CMD) {
return;
Expand Down
5 changes: 5 additions & 0 deletions clap_complete/tests/testsuite/elvish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ fn register_completion() {

#[test]
#[cfg(unix)]
#[ignore]
fn complete_static_toplevel() {
if !common::has_command(CMD) {
return;
Expand Down Expand Up @@ -186,6 +187,7 @@ fn register_dynamic_env() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_toplevel() {
if !common::has_command(CMD) {
return;
Expand All @@ -207,6 +209,7 @@ fn complete_dynamic_env_toplevel() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_help() {
if !common::has_command(CMD) {
return;
Expand All @@ -229,6 +232,7 @@ fn complete_dynamic_env_quoted_help() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_option_value() {
if !common::has_command(CMD) {
return;
Expand Down Expand Up @@ -258,6 +262,7 @@ fn complete_dynamic_env_option_value() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_value() {
if !common::has_command(CMD) {
return;
Expand Down
5 changes: 5 additions & 0 deletions clap_complete/tests/testsuite/fish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ fn register_completion() {

#[test]
#[cfg(unix)]
#[ignore]
fn complete() {
if !common::has_command(CMD) {
return;
Expand Down Expand Up @@ -181,6 +182,7 @@ fn register_dynamic_env() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_toplevel() {
if !common::has_command(CMD) {
return;
Expand All @@ -202,6 +204,7 @@ value alias --global (everywhere

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_help() {
if !common::has_command(CMD) {
return;
Expand Down Expand Up @@ -238,6 +241,7 @@ help (Print this message or the help of the given subcommand(s))

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_option_value() {
if !common::has_command(CMD) {
return;
Expand All @@ -262,6 +266,7 @@ fn complete_dynamic_env_option_value() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_value() {
if !common::has_command(CMD) {
return;
Expand Down
5 changes: 5 additions & 0 deletions clap_complete/tests/testsuite/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ fn register_completion() {

#[test]
#[cfg(unix)]
#[ignore]
fn complete() {
if !common::has_command(CMD) {
return;
Expand All @@ -174,6 +175,7 @@ fn register_dynamic_env() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_toplevel() {
if !common::has_command(CMD) {
return;
Expand All @@ -194,6 +196,7 @@ fn complete_dynamic_env_toplevel() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_help() {
if !common::has_command(CMD) {
return;
Expand All @@ -215,6 +218,7 @@ fn complete_dynamic_env_quoted_help() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_option_value() {
if !common::has_command(CMD) {
return;
Expand All @@ -239,6 +243,7 @@ fn complete_dynamic_env_option_value() {

#[test]
#[cfg(all(unix, feature = "unstable-dynamic"))]
#[ignore]
fn complete_dynamic_env_quoted_value() {
if !common::has_command(CMD) {
return;
Expand Down

0 comments on commit acd6e12

Please sign in to comment.