Skip to content

Commit

Permalink
fix vet complaint for go v1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Banning committed Mar 23, 2018
1 parent f65883c commit eb2e8a1
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 35 deletions.
2 changes: 1 addition & 1 deletion anyxml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestAnyXmlHeader(t *testing.T) {
fmt.Println("\n---------------- anyxml_test.go ...\n")
fmt.Println("\n---------------- anyxml_test.go ...")
}

var anydata = []byte(`[
Expand Down
2 changes: 1 addition & 1 deletion badxml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var baddata = []byte(`
`)

func TestBadXml(t *testing.T) {
fmt.Println("\n---------------- badxml_test.go\n")
fmt.Println("\n---------------- badxml_test.go")
fmt.Println("TestBadXml ...")
m, err := NewMapXml(baddata)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion bom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var boms = [][]byte{
}

func TestBom(t *testing.T) {
fmt.Println("\n--------------- bom_test.go \n")
fmt.Println("\n--------------- bom_test.go")
fmt.Println("TestBom ...")

// use just UTF-8 BOM ... no alternative CharSetReader
Expand Down
2 changes: 1 addition & 1 deletion bulk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestBulkHeader(t *testing.T) {
fmt.Println("\n---------------- bulk_test.go ...\n")
fmt.Println("\n---------------- bulk_test.go ...")
}

var jsonWriter = new(bytes.Buffer)
Expand Down
2 changes: 1 addition & 1 deletion bulkraw_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func TestBulkRawHeader(t *testing.T) {
fmt.Println("\n---------------- bulkraw_test.go ...\n")
fmt.Println("\n---------------- bulkraw_test.go ...")
}

// use data from bulk_test.go
Expand Down
2 changes: 1 addition & 1 deletion files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestFilesHeader(t *testing.T) {
fmt.Println("\n---------------- files_test.go ...\n")
fmt.Println("\n---------------- files_test.go ...")
}

func TestNewJsonFile(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion j2x_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
var jjdata = []byte(`{ "key1":"string", "key2":34, "key3":true, "key4":"unsafe: <>&", "key5":null }`)

func TestJ2XHeader(t *testing.T) {
fmt.Println("\n---------------- j2x_test .go ...\n")
fmt.Println("\n---------------- j2x_test .go ...")
}

func TestJ2X(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var jdata2 = []byte(`{ "key1":"string", "key2":34, "key3":true, "key4":"unsafe:
{ "key":"value in new JSON string" }`)

func TestJsonHeader(t *testing.T) {
fmt.Println("\n---------------- json_test.go ...\n")
fmt.Println("\n---------------- json_test.go ...")
}

func TestNewMapJson(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions keyvalues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestKVHeader(t *testing.T) {
fmt.Println("\n---------------- keyvalues_test.go ...\n")
fmt.Println("\n---------------- keyvalues_test.go ...")
}

var doc1 = []byte(`
Expand Down Expand Up @@ -224,7 +224,7 @@ func TestValuesForNotKey(t *testing.T) {
}

func TestIAHeader(t *testing.T) {
fmt.Println("\n---------------- indexedarray_test.go ...\n")
fmt.Println("\n---------------- indexedarray_test.go ...")
}

var ak_data = []byte(`{ "section1":{"data" : [{"F1" : "F1 data","F2" : "F2 data"},{"F1" : "demo 123","F2" : "abc xyz"}]}}`)
Expand Down
2 changes: 1 addition & 1 deletion mxj_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestMxjHeader(t *testing.T) {
fmt.Println("\n---------------- mxj_test.go ...\n")
fmt.Println("\n---------------- mxj_test.go ...")
}

func TestMap(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestNamespaceHeader(t *testing.T) {
fmt.Println("\n---------------- namespace_test.go ...\n")
fmt.Println("\n---------------- namespace_test.go ...")
}

func TestBeautifyXml(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion nan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestNan(t *testing.T) {
fmt.Println("\n------------ TestNan\n")
fmt.Println("\n------------ TestNan ...")
data := []byte("<foo><bar>NAN</bar></foo>")

m, err := NewMapXml(data, true)
Expand Down
2 changes: 1 addition & 1 deletion newmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestNewMapHeader(t *testing.T) {
fmt.Println("\n---------------- newmap_test.go ...\n")
fmt.Println("\n---------------- newmap_test.go ...")
}

func TestNewMap(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion seqnum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ var seqdata2 = []byte(`
</Obj>`)

func TestSeqNumHeader(t *testing.T) {
fmt.Println("\n---------------- seqnum_test.go ...\n")
fmt.Println("\n---------------- seqnum_test.go ...")
}

func TestSeqNum(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
)

func TestStructHeader(t *testing.T) {
fmt.Println("\n---------------- struct_test.go ...\n")
fmt.Println("\n---------------- struct_test.go ...")
}

/*
Expand Down
2 changes: 1 addition & 1 deletion updatevalues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestUVHeader(t *testing.T) {
fmt.Println("\n---------------- updatevalues_test.go ...\n")
fmt.Println("\n---------------- updatevalues_test.go ...")
}

func TestUpdateValuesForPath_Author(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion xml2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestXml2Header(t *testing.T) {
fmt.Println("\n---------------- xml2_test.go ...\n")
fmt.Println("\n---------------- xml2_test.go ...")
}

func TestNewMapXml4(t *testing.T) {
Expand Down
50 changes: 34 additions & 16 deletions xml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"bytes"
"fmt"
"io"
"reflect"
"testing"
)

func TestXmlHeader(t *testing.T) {
fmt.Println("\n---------------- xml_test.go ...\n")
fmt.Println("\n---------------- xml_test.go ...")
}

func TestNewMapXml(t *testing.T) {
Expand All @@ -19,22 +20,44 @@ func TestNewMapXml(t *testing.T) {
t.Fatal("merr:", merr.Error())
}

fmt.Println("NewMapXml, x :", string(x))
fmt.Println("NewMapXml, mv:", mv)
want := Map{"root2":
map[string]interface{}{
"newtag":
map[string]interface{}{"-newattr": "some_attr_value", "#text":"something more"},
"list":
map[string]interface{}{"-listattr":"val", "item":[]interface{}{"1", "2"}},
}}
if !reflect.DeepEqual(mv, want) {
fmt.Println("NewMapXml, x :", string(x))
fmt.Printf("NewMapXml, mv : %#v\n", mv)
fmt.Printf("NewMapXml, want: %#v\n", want)
t.Fatal("not DeepEqual")
}
}

func TestAttrHyphenFalse(t *testing.T) {
PrependAttrWithHyphen(false)
defer PrependAttrWithHyphen(true)
x := []byte(`<root2><newtag newattr="some_attr_value">something more</newtag><list listattr="val"><item>1</item><item>2</item></list></root2>`)

mv, merr := NewMapXml(x)
if merr != nil {
t.Fatal("merr:", merr.Error())
}

fmt.Println("AttrHyphenFalse, x :", string(x))
fmt.Println("AttrHyphenFalse, mv:", mv)
PrependAttrWithHyphen(true)
want := Map{"root2":
map[string]interface{}{
"newtag":
map[string]interface{}{"newattr": "some_attr_value", "#text":"something more"},
"list":
map[string]interface{}{"listattr":"val", "item":[]interface{}{"1", "2"}},
}}
if !reflect.DeepEqual(mv, want) {
fmt.Println("AttrHyphenFalse, x :", string(x))
fmt.Printf("AttrHyphenFalse, mv : %#v\n", mv)
fmt.Printf("AttrHyphenFalse, want: %#v\n", want)
t.Fatal("not DeepEqual")
}
}

func TestNewMapXmlError(t *testing.T) {
Expand All @@ -45,17 +68,12 @@ func TestNewMapXmlError(t *testing.T) {
t.Fatal("NewMapXmlError, m:", m)
}

fmt.Println("NewMapXmlError, x :", string(x))
fmt.Println("NewMapXmlError, merr:", merr.Error())

x = []byte(`<root2><newtag>something more</newtag><list><item>1<item>2</item></list></root2>`)
m, merr = NewMapJson(x)
if merr == nil {
t.Fatal("NewMapXmlError, m:", m)
want := `invalid character '<' looking for beginning of value`
if merr != nil && merr.Error() != want {
fmt.Println("NewMapXmlError, x :", string(x))
fmt.Println("NewMapXmlError, merr:", merr.Error())
fmt.Println("NewMapXmlError, want:", want)
}

fmt.Println("NewMapXmlError, x :", string(x))
fmt.Println("NewMapXmlError, merr:", merr.Error())
}

func TestNewMapXmlReader(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion xmlseq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestXmlSeqHeader(t *testing.T) {
fmt.Println("\n---------------- xmlseq_test.go ...\n")
fmt.Println("\n---------------- xmlseq_test.go ...")
}

func TestNewMapXmlSeq(t *testing.T) {
Expand Down

0 comments on commit eb2e8a1

Please sign in to comment.