From ed3fc529ed9a4d45cde7dcbf8243fedf69b10eb5 Mon Sep 17 00:00:00 2001 From: wenzi Date: Sun, 8 Sep 2019 23:25:45 +0800 Subject: [PATCH] Failed to return when Gini file grammar error Failed to return when Gini file grammar error --- encoding/gini/gini_test.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/encoding/gini/gini_test.go b/encoding/gini/gini_test.go index da75c22a3..29a60dbd9 100644 --- a/encoding/gini/gini_test.go +++ b/encoding/gini/gini_test.go @@ -7,7 +7,6 @@ package gini_test import ( - "fmt" "github.com/gogf/gf/encoding/gini" "github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/test/gtest" @@ -39,7 +38,6 @@ func TestDecode(t *testing.T) { if err != nil { gtest.Fatal(err) } - fmt.Println(res) gtest.Assert(res["addr"].(map[string]interface{})["ip"], "127.0.0.1") gtest.Assert(res["addr"].(map[string]interface{})["port"], "9001") gtest.Assert(res["DBINFO"].(map[string]interface{})["user"], "root") @@ -47,6 +45,15 @@ func TestDecode(t *testing.T) { gtest.Assert(res["键"].(map[string]interface{})["呵呵"], "值") }) + gtest.Case(t, func() { + errContent := ` + a = b +` + _, err := gini.Decode([]byte(errContent)) + if err == nil { + gtest.Fatal(err) + } + }) } func TestEncode(t *testing.T) {