Add test for non struct
This commit is contained in:
parent
4f9899b12b
commit
d38308cd6b
@ -1,4 +1,4 @@
|
||||
# Structure [](http://godoc.org/github.com/fatih/structure) [](https://travis-ci.org/fatih/structure)
|
||||
# Structure [](http://godoc.org/github.com/fatih/structure) [](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 {
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user