File: be_zero_matcher_test.go

package info (click to toggle)
golang-gomega 1.0%2Bgit20160910.d59fa0a-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 728 kB
  • ctags: 691
  • sloc: makefile: 12
file content (30 lines) | stat: -rw-r--r-- 665 bytes parent folder | download | duplicates (2)
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
30
package matchers_test

import (
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("BeZero", func() {
	It("should succeed if the passed in object is the zero value for its type", func() {
		Ω(nil).Should(BeZero())

		Ω("").Should(BeZero())
		Ω(" ").ShouldNot(BeZero())

		Ω(0).Should(BeZero())
		Ω(1).ShouldNot(BeZero())

		Ω(0.0).Should(BeZero())
		Ω(0.1).ShouldNot(BeZero())

		// Ω([]int{}).Should(BeZero())
		Ω([]int{1}).ShouldNot(BeZero())

		// Ω(map[string]int{}).Should(BeZero())
		Ω(map[string]int{"a": 1}).ShouldNot(BeZero())

		Ω(myCustomType{}).Should(BeZero())
		Ω(myCustomType{s: "a"}).ShouldNot(BeZero())
	})
})