3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-30 07:59:24 +01:00
ergo/irc/utils/args_test.go

24 lines
510 B
Go
Raw Normal View History

2019-05-20 18:34:30 +02:00
// Copyright (c) 2019 Shivaram Lingamneni <slingamn@cs.stanford.edu>
// released under the MIT license
package utils
import "testing"
func TestStringToBool(t *testing.T) {
val, err := StringToBool("on")
assertEqual(val, true, t)
assertEqual(err, nil, t)
val, err = StringToBool("n")
assertEqual(val, false, t)
assertEqual(err, nil, t)
val, err = StringToBool("OFF")
assertEqual(val, false, t)
assertEqual(err, nil, t)
val, err = StringToBool("default")
assertEqual(err, ErrInvalidParams, t)
}