mirror of
https://github.com/rancher/os.git
synced 2025-09-01 06:40:31 +00:00
Initial commit
This commit is contained in:
29
config/config_test.go
Normal file
29
config/config_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.google.com/p/rog-go/deepdiff"
|
||||
)
|
||||
|
||||
func TestParseCmdline(t *testing.T) {
|
||||
expected := map[string]interface{}{
|
||||
"rescue": true,
|
||||
"key1": "value1",
|
||||
"key2": "value2",
|
||||
"obj1": map[string]interface{}{
|
||||
"key3": "3value",
|
||||
"obj2": map[string]interface{}{
|
||||
"key4": true,
|
||||
},
|
||||
},
|
||||
"key5": 5,
|
||||
}
|
||||
|
||||
actual := parseCmdline("a b rancher.rescue rancher.key1=value1 c rancher.key2=value2 rancher.obj1.key3=3value rancher.obj1.obj2.key4 rancher.key5=5")
|
||||
|
||||
ok, err := deepdiff.DeepDiff(actual, expected)
|
||||
if !ok || err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user