Browse Source

add environment variable example to tests

pull/19/head
Brett Langdon 11 years ago
parent
commit
de1ddf76e2
2 changed files with 6 additions and 0 deletions
  1. +5
    -0
      forge_test.go
  2. +1
    -0
      test.cfg

+ 5
- 0
forge_test.go View File

@ -3,6 +3,7 @@ package forge_test
import (
"bytes"
"fmt"
"os"
"testing"
"github.com/brettlangdon/forge"
@ -36,12 +37,15 @@ secondary {
primary_sub_key = primary.sub.key;
another_again = .another; # References secondary.another
_under = 50;
path = $PATH;
}
`)
var testConfigString = string(testConfigBytes)
var testConfigReader = bytes.NewReader(testConfigBytes)
var expectedPath = os.Getenv("PATH")
func assertEqual(a interface{}, b interface{}, t *testing.T) {
if a != b {
t.Fatal(fmt.Sprintf("'%v' != '%v'", a, b))
@ -76,6 +80,7 @@ func assertDirectives(values map[string]interface{}, t *testing.T) {
assertEqual(secondary["primary_sub_key"], "primary sub key value", t)
assertEqual(secondary["another_again"], "secondary another value", t)
assertEqual(secondary["_under"], int64(50), t)
assertEqual(secondary["path"], expectedPath, t)
}
func TestParseBytes(t *testing.T) {


+ 1
- 0
test.cfg View File

@ -25,4 +25,5 @@ secondary {
primary_sub_key = primary.sub.key;
another_again = .another; # References secondary.another
_under = 50;
path = $PATH;
}

Loading…
Cancel
Save