diff --git a/main_test.go b/main_test.go
index c45ebf5..98cafe7 100644
--- a/main_test.go
+++ b/main_test.go
@@ -1,129 +1,13 @@
package main
import (
- "encoding/xml"
- "fmt"
- "tank/rest"
"testing"
)
-func TestXmlMarshal(t *testing.T) {
- fmt.Println("Hello World!")
+func TestSqlite(t *testing.T) {
- type Address struct {
- City, State string
- }
- type Person struct {
- XMLName xml.Name `xml:"person"`
- Id int `xml:"id,attr"`
- FirstName string `xml:"name>first"`
- LastName string `xml:"name>last"`
- Age int `xml:"age"`
- Height float32 `xml:"height,omitempty"`
- Married bool
- Address
- Comment string `xml:",comment"`
- }
- v := &Person{Id: 13, FirstName: "John", LastName: "Doe", Age: 42}
- v.Comment = " Need more details. "
- v.Address = Address{"Hanga Roa", "Easter Island"}
-
- output, err := xml.MarshalIndent(v, " ", " ")
- if err != nil {
- fmt.Printf("error: %v\n", err)
- }
-
- fmt.Println(string(output))
- // Output:
- //
- //
- // John
- // Doe
- //
- // 42
- // false
- // Hanga Roa
- // Easter Island
- //
- //
}
-func TestXmlUnMarshal(t *testing.T) {
- type Email struct {
- Where string `xml:"where,attr"`
- Addr string
- }
- type Address struct {
- City, State string
- }
- type Result struct {
- XMLName xml.Name `xml:"Person"`
- Name string `xml:"FullName"`
- Phone string
- Email []Email
- Groups []string `xml:"Group>Value"`
- Address
- }
- v := Result{Name: "none", Phone: "none"}
- data := `
-
- Grace R. Emlin
- Example Inc.
-
- gre@example.com
-
-
- gre@work.com
-
-
- Friends
- Squash
-
- Hanga Roa
- Easter Island
-
- `
- err := xml.Unmarshal([]byte(data), &v)
- if err != nil {
- fmt.Printf("error: %v", err)
- return
- }
- fmt.Printf("XMLName: %#v\n", v.XMLName)
- fmt.Printf("Name: %q\n", v.Name)
- fmt.Printf("Phone: %q\n", v.Phone)
- fmt.Printf("Email: %v\n", v.Email)
- fmt.Printf("Groups: %v\n", v.Groups)
- fmt.Printf("Address: %v\n", v.Address)
- // Output:
- // XMLName: xml.Name{Space:"", Local:"Person"}
- // Name: "Grace R. Emlin"
- // Phone: "none"
- // Email: [{home gre@example.com} {work gre@work.com}]
- // Groups: [Friends Squash]
- // Address: {Hanga Roa Easter Island}
-}
-
-func TestPropfind(t *testing.T) {
- data := `
-
-
-
-
-
-
-
-
-
- `
- propfind := &rest.Propfind{XmlNS: "DAV:"}
- err := xml.Unmarshal([]byte(data), &propfind)
- if err != nil {
- panic(err)
- }
-
- output, err := xml.MarshalIndent(propfind, " ", " ")
- fmt.Println(string(output))
-}