Add test for non struct

This commit is contained in:
Fatih Arslan 2014-07-26 17:46:48 +03:00
parent 4f9899b12b
commit d38308cd6b
2 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# Structure [![GoDoc](https://godoc.org/github.com/fatih/structure?status.png)](http://godoc.org/github.com/fatih/structure) [![Build Status](https://travis-ci.org/fatih/structure.png)](https://travis-ci.org/fatih/structure)
# Structure [![GoDoc](https://godoc.org/github.com/fatih/structure?status.svg)](http://godoc.org/github.com/fatih/structure) [![Build Status](https://travis-ci.org/fatih/structure.svg)](https://travis-ci.org/fatih/structure)
Structure contains various utilitis to work with Go structs.
@ -8,7 +8,7 @@ Structure contains various utilitis to work with Go structs.
go get github.com/fatih/structure
```
## Examples
## Example
```go
type Server struct {

View File

@ -6,6 +6,16 @@ import (
"testing"
)
func TestToMapNonStruct(t *testing.T) {
foo := []string{"foo"}
_, err := ToMap(foo)
if err == nil {
t.Error("ToMap shouldn't accept non struct types")
}
}
func TestToMap(t *testing.T) {
var T = struct {
A string