summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--gohadoopxml_test.go40
2 files changed, 43 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index e296636..576420d 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,9 @@ build:
@mkdir -p _build
@go build -ldflags ${LDFLAGS} -o _build/gohadoopxml
+test:
+ @go test
+
install:
@go install -ldflags ${LDFLAGS}
diff --git a/gohadoopxml_test.go b/gohadoopxml_test.go
new file mode 100644
index 0000000..aa81010
--- /dev/null
+++ b/gohadoopxml_test.go
@@ -0,0 +1,40 @@
+package gohadoopxml
+
+import (
+ "testing"
+)
+
+func isin(key string, c Configuration) int {
+ for i, p := range c.Properties {
+ if p.Name == key {
+ return i
+ }
+ }
+ return -1
+}
+
+func TestMergeConfiguration(t *testing.T) {
+ var config1 = Configuration{
+ Properties: []Property{
+ {
+ Name: "foo",
+ Value: "bar",
+ },
+ },
+ }
+ var config2 = Configuration{
+ Properties: []Property{
+ {
+ Name: "fizz",
+ Value: "buzz",
+ },
+ },
+ }
+ result := MergeConfigurations(config1, config2)
+ if i := isin("foo", result); i < 0 {
+ t.Fail()
+ }
+ if i := isin("fizz", result); i < 0 {
+ t.Fail()
+ }
+}