Separate the codebase for XL and FS format.json related code (#5317)

This commit is contained in:
Krishna Srinivas
2018-01-08 14:30:55 -08:00
committed by kannappanr
parent ccd9767b7a
commit 7c72d14027
8 changed files with 599 additions and 611 deletions

View File

@@ -17,6 +17,7 @@
package cmd
import (
"bytes"
"encoding/json"
"errors"
"io/ioutil"
@@ -363,3 +364,19 @@ func TestContains(t *testing.T) {
}
}
}
// Test jsonLoadFromSeeker.
func TestJSONLoadFromSeeker(t *testing.T) {
format := newFormatFSV1()
b, err := json.Marshal(format)
if err != nil {
t.Fatal(err)
}
var gotFormat formatFSV1
if err = jsonLoadFromSeeker(bytes.NewReader(b), &gotFormat); err != nil {
t.Fatal(err)
}
if *format != gotFormat {
t.Fatal("jsonLoadFromSeeker() failed to decode json")
}
}