From d38308cd6bfe5d3aabba32455f1a8caabd7cb73d Mon Sep 17 00:00:00 2001 From: Fatih Arslan Date: Sat, 26 Jul 2014 17:46:48 +0300 Subject: [PATCH] Add test for non struct --- README.md | 4 ++-- structure_test.go | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8be54fb..2794028 100644 --- a/README.md +++ b/README.md @@ -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 { diff --git a/structure_test.go b/structure_test.go index 89e0dd5..a556da3 100644 --- a/structure_test.go +++ b/structure_test.go @@ -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