...
1# DO NOT EDIT; generated by go run testdata/gen.go
2#
3#name: regexp
4#evalPartial
5-- in.cue --
6c1: "a" =~ "a"
7c2: "foo" =~ "[a-z]{3}"
8c3: "foo" =~ "[a-z]{4}"
9c4: "foo" !~ "[a-z]{4}"
10
11b1: =~"a"
12b1: "a"
13b2: =~"[a-z]{3}"
14b2: "foo"
15b3: =~"[a-z]{4}"
16b3: "foo"
17b4: !~"[a-z]{4}"
18b4: "foo"
19
20s1: !="b" & =~"c" // =~"c"
21s2: =~"c" & !="b" // =~"c"
22s3: !="b" & =~"[a-z]" // != "b" & =~"[a-z]"
23s4: =~"[a-z]" & !="b" // != "b" & =~"[a-z]"
24
25e1: "foo" =~ 1
26e2: "foo" !~ true
27e3: !="a" & <5
28-- out/def --
29c1: true
30c2: true
31c3: false
32c4: true
33b1: "a"
34b2: "foo"
35b3: _|_ // invalid value "foo" (does not match =~"[a-z]{4}")
36b4: "foo"
37s1: =~"c"
38s2: !="b" & =~"[a-z]"
39e1: _|_ // invalid operation "foo" =~ 1 (mismatched types string and int)
40e2: _|_ // invalid operation "foo" !~ true (mismatched types string and bool)
41e3: _|_ // conflicting values !="a" and <5 (mismatched types string and number)
42-- out/legacy-debug --
43<0>{c1: true, c2: true, c3: false, c4: true, b1: "a", b2: "foo", b3: _|_((=~"[a-z]{4}" & "foo"):invalid value "foo" (does not match =~"[a-z]{4}")), b4: "foo", s1: =~"c", s2: (!="b" & =~"[a-z]"), e1: _|_(("foo" =~ 1):invalid operation "foo" =~ 1 (mismatched types string and int)), e2: _|_(("foo" !~ true):invalid operation "foo" !~ true (mismatched types string and bool)), e3: _|_((!="a" & <5):conflicting values !="a" and <5 (mismatched types string and number))}
44-- out/compile --
45--- in.cue
46{
47 c1: ("a" =~ "a")
48 c2: ("foo" =~ "[a-z]{3}")
49 c3: ("foo" =~ "[a-z]{4}")
50 c4: ("foo" !~ "[a-z]{4}")
51 b1: =~"a"
52 b1: "a"
53 b2: =~"[a-z]{3}"
54 b2: "foo"
55 b3: =~"[a-z]{4}"
56 b3: "foo"
57 b4: !~"[a-z]{4}"
58 b4: "foo"
59 s1: (!="b" & =~"c")
60 s2: (=~"c" & !="b")
61 s3: (!="b" & =~"[a-z]")
62 s4: (=~"[a-z]" & !="b")
63 e1: ("foo" =~ 1)
64 e2: ("foo" !~ true)
65 e3: (!="a" & <5)
66}
67-- out/eval/stats --
68Leaks: 0
69Freed: 16
70Reused: 14
71Allocs: 2
72Retain: 0
73
74Unifications: 16
75Conjuncts: 25
76Disjuncts: 16
77-- out/eval --
78Errors:
79e3: conflicting values !="a" and <5 (mismatched types string and number):
80 ./in.cue:22:5
81 ./in.cue:22:13
82b3: invalid value "foo" (out of bound =~"[a-z]{4}"):
83 ./in.cue:10:5
84 ./in.cue:11:5
85e1: cannot use 1 (type int) as type (string|bytes):
86 ./in.cue:20:5
87 ./in.cue:20:14
88e2: cannot use true (type bool) as type (string|bytes):
89 ./in.cue:21:5
90 ./in.cue:21:14
91
92Result:
93(_|_){
94 // [eval]
95 c1: (bool){ true }
96 c2: (bool){ true }
97 c3: (bool){ false }
98 c4: (bool){ true }
99 b1: (string){ "a" }
100 b2: (string){ "foo" }
101 b3: (_|_){
102 // [eval] b3: invalid value "foo" (out of bound =~"[a-z]{4}"):
103 // ./in.cue:10:5
104 // ./in.cue:11:5
105 }
106 b4: (string){ "foo" }
107 s1: (string){ =~"c" }
108 s2: (string){ =~"c" }
109 s3: (string){ &(!="b", =~"[a-z]") }
110 s4: (string){ &(=~"[a-z]", !="b") }
111 e1: (_|_){
112 // [eval] e1: cannot use 1 (type int) as type (string|bytes):
113 // ./in.cue:20:5
114 // ./in.cue:20:14
115 }
116 e2: (_|_){
117 // [eval] e2: cannot use true (type bool) as type (string|bytes):
118 // ./in.cue:21:5
119 // ./in.cue:21:14
120 }
121 e3: (_|_){
122 // [eval] e3: conflicting values !="a" and <5 (mismatched types string and number):
123 // ./in.cue:22:5
124 // ./in.cue:22:13
125 }
126}
View as plain text