From 1b145602d95b6f3e750527185a6a40e1b071b9b6 Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Tue, 10 Oct 2017 15:34:41 -0400 Subject: [PATCH] MINOR: trim environment variable values 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\\$" ``` --- sigar_interface_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sigar_interface_test.go b/sigar_interface_test.go index efaa3ae92..8545484c5 100644 --- a/sigar_interface_test.go +++ b/sigar_interface_test.go @@ -5,6 +5,7 @@ import ( "os/user" "path/filepath" "runtime" + "strings" "testing" "time" @@ -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) } } }