Skip to content

Commit

Permalink
test: Move setEnv & unsetEnv functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas LE ROUX committed Mar 21, 2016
1 parent 08c420b commit f73ec52
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
18 changes: 18 additions & 0 deletions engine/engine_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package engine

import (
"os"
"testing"
)

func setEnv(t *testing.T, key, value string) {
if err := os.Setenv(key, value); err != nil {
t.Fatalf("unexpected error: %s", err)
}
}

func unsetEnv(t *testing.T, key string) {
if err := os.Unsetenv(key); err != nil {
t.Fatalf("unexpected error: %s", err)
}
}
12 changes: 0 additions & 12 deletions engine/id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ func TestWorkingDirectoryWithUndefinedEnv(t *testing.T) {

}

func setEnv(t *testing.T, key, value string) {
if err := os.Setenv(key, value); err != nil {
t.Fatalf("unexpected error: %s", err)
}
}

func unsetEnv(t *testing.T, key string) {
if err := os.Unsetenv(key); err != nil {
t.Fatalf("unexpected error: %s", err)
}
}

func checkIDMatch(t *testing.T, key string, e int, callback func() (int, error)) {

setEnv(t, key, fmt.Sprint(e))
Expand Down

0 comments on commit f73ec52

Please sign in to comment.