Skip to content

Commit

Permalink
fix: while saving the environment variable: DISPLAY a new line was mi…
Browse files Browse the repository at this point in the history
…ssing
  • Loading branch information
xmik committed Feb 4, 2019
1 parent c056d0e commit c584848
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 0.3.1 (2019-Feb-04)

* fix: while saving the environment variable: DISPLAY a new line was missing

### 0.3.0 (2019-Feb-04)

Change default behavior that preserved current environment (by the means of environment file) only to the default
Expand Down
2 changes: 1 addition & 1 deletion environment_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func generateVariablesString(blacklistedVarsNames string, allVariables []string)
value := arr[1]
if key == "DISPLAY" {
// this is highly opinionated
generatedString += "DISPLAY=unix:0.0"
generatedString += "DISPLAY=unix:0.0\n"
} else if existsVariableWithDOJOPrefix(key, allVariables) {
// ignore this key, we will deal with DOJO_${key}
continue
Expand Down
14 changes: 7 additions & 7 deletions environment_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ func Test_generateVariablesString(t *testing.T) {
// MYVAR is not blacklisted, is not set with DOJO_ prefix
// DOJO_VAR1 is not blacklisted, is set with DOJO_ prefix
// DISPLAY is always set to the same value
allVariables := []string{"USER=dojo", "BASH_123=123", "DOJO_USER=555", "MYVAR=999", "DOJO_VAR1=11", "USER1=1", "DOJO_USER1=2", "DISPLAY=aaa"}
allVariables := []string{"USER=dojo", "BASH_123=123", "DOJO_USER=555", "MYVAR=999", "DOJO_VAR1=11", "USER1=1", "DISPLAY=aaa", "DOJO_USER1=2"}
genStr := generateVariablesString(blacklisted, allVariables)
assert.Contains(t, genStr, "DOJO_USER=555")
assert.Contains(t, genStr, "DOJO_BASH_123=123")
assert.Contains(t, genStr, "MYVAR=999")
assert.Contains(t, genStr, "DOJO_VAR1=11")
assert.Contains(t, genStr, "DOJO_USER1=2")
assert.Contains(t, genStr, "DISPLAY=unix:0.0")
assert.Contains(t, genStr, "DOJO_USER=555\n")
assert.Contains(t, genStr, "DOJO_BASH_123=123\n")
assert.Contains(t, genStr, "MYVAR=999\n")
assert.Contains(t, genStr, "DOJO_VAR1=11\n")
assert.Contains(t, genStr, "DOJO_USER1=2\n")
assert.Contains(t, genStr, "DISPLAY=unix:0.0\n")
assert.NotContains(t, genStr, "DOJO_USER=dojo")
assert.NotContains(t, genStr, "USER1=1")
assert.NotContains(t, genStr, "DISPLAY=aaa")
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package main
const DojoVersion = "0.3.0"
const DojoVersion = "0.3.1"

0 comments on commit c584848

Please sign in to comment.