diff --git a/misc_test.go b/misc_test.go index b2d5c7cd..efa0e166 100644 --- a/misc_test.go +++ b/misc_test.go @@ -1215,13 +1215,6 @@ func TestPreparser(t *testing.T) { msgList = addMETri(msgList, "", "</strong>") msgList = addMETri(msgList, "", "") msgList = addMETri(msgList, "hi", "hi") - msgList = addMETri(msgList, "//github.com/Azareal/Gosora", "//github.com/Azareal/Gosora") - msgList = addMETri(msgList, "https://github.com/Azareal/Gosora", "https://github.com/Azareal/Gosora") - msgList = addMETri(msgList, "http://github.com/Azareal/Gosora", "http://github.com/Azareal/Gosora") - msgList = addMETri(msgList, "//github.com/Azareal/Gosora\n", "//github.com/Azareal/Gosora") - msgList = addMETri(msgList, "\n//github.com/Azareal/Gosora", "//github.com/Azareal/Gosora") - msgList = addMETri(msgList, "\n//github.com/Azareal/Gosora\n", "//github.com/Azareal/Gosora") - msgList = addMETri(msgList, "//github.com/Azareal/Gosora\n//github.com/Azareal/Gosora", "//github.com/Azareal/Gosora\n//github.com/Azareal/Gosora") msgList = addMETri(msgList, "hi", "hi") msgList = addMETri(msgList, "", "") msgList = addMETri(msgList, "", "") @@ -1249,3 +1242,31 @@ func TestPreparser(t *testing.T) { } } } + +func TestParser(t *testing.T) { + var res string + var msgList []METri + + msgList = addMETri(msgList, "//github.com/Azareal/Gosora", "//github.com/Azareal/Gosora") + msgList = addMETri(msgList, "https://github.com/Azareal/Gosora", "https://github.com/Azareal/Gosora") + msgList = addMETri(msgList, "http://github.com/Azareal/Gosora", "http://github.com/Azareal/Gosora") + msgList = addMETri(msgList, "//github.com/Azareal/Gosora\n", "//github.com/Azareal/Gosora") + msgList = addMETri(msgList, "\n//github.com/Azareal/Gosora", "//github.com/Azareal/Gosora") + msgList = addMETri(msgList, "\n//github.com/Azareal/Gosora\n", "//github.com/Azareal/Gosora") + msgList = addMETri(msgList, "//github.com/Azareal/Gosora\n//github.com/Azareal/Gosora", "//github.com/Azareal/Gosora\n//github.com/Azareal/Gosora") + msgList = addMETri(msgList, "//"+common.Site.URL, "//"+common.Site.URL+"") + msgList = addMETri(msgList, "//"+common.Site.URL+"\n", "//"+common.Site.URL+"") + + for _, item := range msgList { + res = common.ParseMessage(item.Msg, 1, "forums") + if res != item.Expects { + if item.Name != "" { + t.Error("Name: ", item.Name) + } + t.Error("Testing string '" + item.Msg + "'") + t.Error("Bad output:", "'"+res+"'") + //t.Error("Ouput in bytes:", []byte(res)) + t.Error("Expected:", "'"+item.Expects+"'") + } + } +}