File: strbool_test.go

package info (click to toggle)
golang-github-anacrolix-missinggo 2.1.0-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 836 kB
  • sloc: makefile: 4
file content (29 lines) | stat: -rw-r--r-- 390 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package missinggo

import (
	"testing"

	"github.com/stretchr/testify/assert"
)

func TestStringTruth(t *testing.T) {
	for _, s := range []string{
		"",
		" ",
		"\n",
		"\x00",
		"0",
	} {
		t.Run(s, func(t *testing.T) {
			assert.False(t, StringTruth(s))
		})
	}
	for _, s := range []string{
		" 1",
		"t",
	} {
		t.Run(s, func(t *testing.T) {
			assert.True(t, StringTruth(s))
		})
	}
}