Skip to content

Commit

Permalink
MINOR: trim environment variable values (#79)
Browse files Browse the repository at this point in the history
When working on #78, I was hit by a test failing on linux (debian host)
Our code is triming values so we need to adjust the test code to make
sure we also trim values before doing the comparison.

Example:
```
	expected: "${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$ "
	            	actual: "${debian_chroot:+($debian_chroot)}\\u@\\h:\\w\\$"
```
  • Loading branch information
ph authored and andrewkroh committed Oct 11, 2017
1 parent 5a9ad8e commit 588927e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Added

### Changed
- Fixed Trim environment variables when comparing values in the test suite. #79

### Deprecated

Expand Down
3 changes: 2 additions & 1 deletion sigar_interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"os/user"
"path/filepath"
"runtime"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -134,7 +135,7 @@ func TestProcEnv(t *testing.T) {
assert.True(t, len(env.Vars) > 0, "env is empty")

for k, v := range env.Vars {
assert.Equal(t, os.Getenv(k), v)
assert.Equal(t, strings.TrimSpace(os.Getenv(k)), v)
}
}
}
Expand Down

0 comments on commit 588927e

Please sign in to comment.