Add more tests.

This commit is contained in:
Syfaro 2016-04-13 17:06:18 -05:00
parent 289f7ef6ad
commit c0eb5db6c3
4 changed files with 131 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package tgbotapi
import (
"encoding/json"
"errors"
"fmt"
"net/url"
"strings"
@ -176,6 +177,10 @@ type MessageEntity struct {
// ParseURL attempts to parse a URL contained within a MessageEntity.
func (entity MessageEntity) ParseURL() (*url.URL, error) {
if entity.URL == "" {
return nil, errors.New(ErrBadURL)
}
return url.Parse(entity.URL)
}