diff options
author | kballou <kballou@devnulllabs.io> | 2015-04-17 15:45:06 -0600 |
---|---|---|
committer | kballou <kballou@devnulllabs.io> | 2015-04-17 15:45:06 -0600 |
commit | a2da59bf0f0b7f64a9cda4998b2b6a1f6b582506 (patch) | |
tree | 4a3d84d15966ea535f91fa73f8592c0c4bf43350 /gohadoopxml_test.go | |
parent | 7d18972112a7d940333f9ef17a5ae1383da0a57c (diff) | |
download | gohadoopxml-a2da59bf0f0b7f64a9cda4998b2b6a1f6b582506.tar.gz gohadoopxml-a2da59bf0f0b7f64a9cda4998b2b6a1f6b582506.tar.xz |
Add unittests for gohadoopxml
Test new function `MergeConfigurations`
Diffstat (limited to 'gohadoopxml_test.go')
-rw-r--r-- | gohadoopxml_test.go | 40 |
1 files changed, 40 insertions, 0 deletions
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() + } +} |