z_func_5_filetest.gno

3.86 Kb ยท 110 lines
  1package main
  2
  3import (
  4	"strings"
  5
  6	"gno.land/p/jeronimoalbi/expect"
  7)
  8
  9var (
 10	output strings.Builder
 11	t      = expect.MockTestingT(&output)
 12)
 13
 14func main() {
 15	expect.Func(t, func() any { return "foo" }).Not().ToReturn("foo")
 16	expect.Func(t, func() any { return []byte("foo") }).Not().ToReturn([]byte("foo"))
 17	expect.Func(t, func() any { return true }).Not().ToReturn(true)
 18	expect.Func(t, func() any { return float32(1) }).Not().ToReturn(float32(1))
 19	expect.Func(t, func() any { return float64(1.1) }).Not().ToReturn(float64(1.1))
 20	expect.Func(t, func() any { return uint(1) }).Not().ToReturn(uint(1))
 21	expect.Func(t, func() any { return uint8(1) }).Not().ToReturn(uint8(1))
 22	expect.Func(t, func() any { return uint16(1) }).Not().ToReturn(uint16(1))
 23	expect.Func(t, func() any { return uint32(1) }).Not().ToReturn(uint32(1))
 24	expect.Func(t, func() any { return uint64(1) }).Not().ToReturn(uint64(1))
 25	expect.Func(t, func() any { return int(1) }).Not().ToReturn(int(1))
 26	expect.Func(t, func() any { return int8(1) }).Not().ToReturn(int8(1))
 27	expect.Func(t, func() any { return int16(1) }).Not().ToReturn(int16(1))
 28	expect.Func(t, func() any { return int32(1) }).Not().ToReturn(int32(1))
 29	expect.Func(t, func() any { return int64(1) }).Not().ToReturn(int64(1))
 30
 31	expect.Func(t, func() (any, error) { return "foo", nil }).Not().ToReturn("foo")
 32	expect.Func(t, func() (any, error) { return []byte("foo"), nil }).Not().ToReturn([]byte("foo"))
 33	expect.Func(t, func() (any, error) { return true, nil }).Not().ToReturn(true)
 34	expect.Func(t, func() (any, error) { return float32(1), nil }).Not().ToReturn(float32(1))
 35	expect.Func(t, func() (any, error) { return float64(1.1), nil }).Not().ToReturn(float64(1.1))
 36	expect.Func(t, func() (any, error) { return uint(1), nil }).Not().ToReturn(uint(1))
 37	expect.Func(t, func() (any, error) { return uint8(1), nil }).Not().ToReturn(uint8(1))
 38	expect.Func(t, func() (any, error) { return uint16(1), nil }).Not().ToReturn(uint16(1))
 39	expect.Func(t, func() (any, error) { return uint32(1), nil }).Not().ToReturn(uint32(1))
 40	expect.Func(t, func() (any, error) { return uint64(1), nil }).Not().ToReturn(uint64(1))
 41	expect.Func(t, func() (any, error) { return int(1), nil }).Not().ToReturn(int(1))
 42	expect.Func(t, func() (any, error) { return int8(1), nil }).Not().ToReturn(int8(1))
 43	expect.Func(t, func() (any, error) { return int16(1), nil }).Not().ToReturn(int16(1))
 44	expect.Func(t, func() (any, error) { return int32(1), nil }).Not().ToReturn(int32(1))
 45	expect.Func(t, func() (any, error) { return int64(1), nil }).Not().ToReturn(int64(1))
 46
 47	println(output.String())
 48}
 49
 50// Output:
 51// Expected values to be different
 52// Got: foo
 53// Expected values to be different
 54// Got: foo
 55// Expected values to be different
 56// Got: true
 57// Expected value to be different
 58// Got: 1
 59// Expected value to be different
 60// Got: 1.1
 61// Expected value to be different
 62// Got: 1
 63// Expected value to be different
 64// Got: 1
 65// Expected value to be different
 66// Got: 1
 67// Expected value to be different
 68// Got: 1
 69// Expected value to be different
 70// Got: 1
 71// Expected value to be different
 72// Got: 1
 73// Expected value to be different
 74// Got: 1
 75// Expected value to be different
 76// Got: 1
 77// Expected value to be different
 78// Got: 1
 79// Expected value to be different
 80// Got: 1
 81// Expected values to be different
 82// Got: foo
 83// Expected values to be different
 84// Got: foo
 85// Expected values to be different
 86// Got: true
 87// Expected value to be different
 88// Got: 1
 89// Expected value to be different
 90// Got: 1.1
 91// Expected value to be different
 92// Got: 1
 93// Expected value to be different
 94// Got: 1
 95// Expected value to be different
 96// Got: 1
 97// Expected value to be different
 98// Got: 1
 99// Expected value to be different
100// Got: 1
101// Expected value to be different
102// Got: 1
103// Expected value to be different
104// Got: 1
105// Expected value to be different
106// Got: 1
107// Expected value to be different
108// Got: 1
109// Expected value to be different
110// Got: 1