Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_value_1_filetest.gno

2.21 Kb ยท 84 lines
 1package main
 2
 3import (
 4	"errors"
 5	"strings"
 6
 7	"gno.land/p/jeronimoalbi/expect"
 8)
 9
10var (
11	output strings.Builder
12	t      = expect.MockTestingT(&output)
13)
14
15type stringer string
16
17func (s stringer) String() string { return string(s) }
18
19func main() {
20	expect.Value(t, "foo").Not().ToEqual("foo")
21	expect.Value(t, []byte("foo")).Not().ToEqual([]byte("foo"))
22	expect.Value(t, stringer("foo")).Not().ToEqual(stringer("foo"))
23	expect.Value(t, true).Not().ToEqual(true)
24	expect.Value(t, float32(1)).Not().ToEqual(float32(1))
25	expect.Value(t, float64(1)).Not().ToEqual(float64(1))
26	expect.Value(t, uint(1)).Not().ToEqual(uint(1))
27	expect.Value(t, uint8(1)).Not().ToEqual(uint8(1))
28	expect.Value(t, uint16(1)).Not().ToEqual(uint16(1))
29	expect.Value(t, uint32(1)).Not().ToEqual(uint32(1))
30	expect.Value(t, uint64(1)).Not().ToEqual(uint64(1))
31	expect.Value(t, int(1)).Not().ToEqual(int(1))
32	expect.Value(t, int8(1)).Not().ToEqual(int8(1))
33	expect.Value(t, int16(1)).Not().ToEqual(int16(1))
34	expect.Value(t, int32(1)).Not().ToEqual(int32(1))
35	expect.Value(t, int64(1)).Not().ToEqual(int64(1))
36	expect.Value(t, errors.New("foo")).Not().ToEqual(errors.New("foo"))
37	expect.Value(t, errors.New("foo bar")).Not().ToContainErrorString("bar")
38
39	expect.Value(t, 0).Not().ToEqual(errors.New("foo"))
40	expect.Value(t, 0).Not().ToEqual([]string{})
41
42	println(output.String())
43}
44
45// Output:
46// Expected values to be different
47// Got: foo
48// Expected values to be different
49// Got: foo
50// Expected values to be different
51// Got: foo
52// Expected values to be different
53// Got: true
54// Expected value to be different
55// Got: 1
56// Expected value to be different
57// Got: 1
58// Expected value to be different
59// Got: 1
60// Expected value to be different
61// Got: 1
62// Expected value to be different
63// Got: 1
64// Expected value to be different
65// Got: 1
66// Expected value to be different
67// Got: 1
68// Expected value to be different
69// Got: 1
70// Expected value to be different
71// Got: 1
72// Expected value to be different
73// Got: 1
74// Expected value to be different
75// Got: 1
76// Expected value to be different
77// Got: 1
78// Expected errors to be different
79// Got: foo
80// Expected error message not to contain: bar
81// Got: foo bar
82// Error is not equal to value
83// Got: foo
84// Unsupported type: unknown