Skip to content
This repository has been archived by the owner on Apr 29, 2021. It is now read-only.

Use -z instead of -n for testing existence. #115

Closed
envygeeks opened this issue Aug 11, 2015 · 3 comments
Closed

Use -z instead of -n for testing existence. #115

envygeeks opened this issue Aug 11, 2015 · 3 comments

Comments

@envygeeks
Copy link

We always quote variables coming regardless of trust, which means when we do --env="CI='$CI'" in our Docker runs to test our Docker Helpers we still get taps output because -n will return true, -z will return false on both CI= and CI=''

@mislav
Copy link
Collaborator

mislav commented Aug 11, 2015

I'm sorry, but CI= and CI='' are equivalent in bash, and -n and -z are perfect opposites with no functional differences that I'm aware of. Can you be more specific?

@envygeeks
Copy link
Author

They are the same except when there is quirky behavior with -n, but we worked around it, so I'm not mithered to explain it.

@mislav
Copy link
Collaborator

mislav commented Aug 12, 2015

I would be interested to learn about the quirky behavior of -n.

yarikoptic pushed a commit to neurodebian/bats that referenced this issue Aug 6, 2019
…ion-#113

Fix BATS_ROOT resolution when /bin => /usr/bin
yarikoptic added a commit to neurodebian/bats that referenced this issue Aug 6, 2019
Bats 1.1.0 - 2018-07-08

This is the first release with new features relative to the original Bats 0.4.0.

Added:
* The `-r, --recursive` flag to scan directory arguments recursively for
  `*.bats` files (sstephenson#109)
* The `contrib/rpm/bats.spec` file to build RPMs (sstephenson#111)

Changed:
* Travis exercises latest versions of Bash from 3.2 through 4.4 (sstephenson#116, sstephenson#117)
* Error output highlights invalid command line options (sstephenson#45, sstephenson#46, sstephenson#118)
* Replaced `echo` with `printf` (sstephenson#120)

Fixed:
* Fixed `BATS_ERROR_STATUS` getting lost when `bats_error_trap` fired multiple
  times under Bash 4.2.x (sstephenson#110)
* Updated `bin/bats` symlink resolution, handling the case on CentOS where
  `/bin` is a symlink to `/usr/bin` (sstephenson#113, sstephenson#115)

* tag 'v1.1.0': (198 commits)
  Bats 1.1.0
  bats: Replace echo with printf
  Extract `abort()` function
  travis: Remove `bats -c` wrapper
  travis: Enable build with default Linux image Bash
  Add Bash version test to Travis job.
  Revert "Re-add Bash version check to Docker image build"
  Re-add Bash version check to Docker image build
  Move timing test to Docker run for Linux jobs
  Remove version check from Docker image build
  Bash version via build matrix instead of script loop
  Fix merge error.
  Add return code storage for Bash version loop
  Add Bash version output during 'docker build'
  Clean up Docker image tags
  Add default value for Bash version
  Cover more Bash versions with Docker
  BATS_ROOT: Elide options to reset shell options
  BATS_ROOT: Restore comment noting issue sstephenson#113
  BATS_ROOT: Use `set -P`, remove `PWD` resolution
  ...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants