-- in.cue --
c1: "a" =~ "a" @test(eq, true)
c2: "foo" =~ "[a-z]{3}" @test(eq, true)
c3: "foo" =~ "[a-z]{4}" @test(eq, false)
c4: "foo" !~ "[a-z]{4}" @test(eq, true)

b1: =~"a" @test(eq, "a")
b1: "a"
b2: =~"[a-z]{3}" @test(eq, "foo")
b2: "foo"
b3: =~"[a-z]{4}" @test(err, code=eval, contains="out of bound", pos=[0:5, 1:5])
b3: "foo"
b4: !~"[a-z]{4}" @test(eq, "foo")
b4: "foo"

s1: !="b" & =~"c"     @test(eq, =~"c")
s2: =~"c" & !="b"     @test(eq, =~"c")
s3: !="b" & =~"[a-z]" @test(eq, !="b" & =~"[a-z]")
s4: =~"[a-z]" & !="b" @test(eq, =~"[a-z]" & !="b") // TODO: allow different order

e1: "foo" =~ 1     @test(err, code=eval,
        contains="cannot use 1", pos=[0:5, 0:14])
e2: "foo" !~ true  @test(err, code=eval,
        contains="cannot use true", pos=[0:5, 0:14])
e3: !="a" & <5     @test(err, code=eval,
        contains="conflicting values", pos=[0:5, 0:13])
-- out/errors.txt --
[eval] b3: invalid value "foo" (out of bound =~"[a-z]{4}"):
    ./in.cue:10:5
    ./in.cue:11:5
[eval] e1: cannot use 1 (type int) as type (string|bytes):
    ./in.cue:20:5
    ./in.cue:20:14
[eval] e2: cannot use true (type bool) as type (string|bytes):
    ./in.cue:22:5
    ./in.cue:22:14
[eval] e3: conflicting values !="a" and <5 (mismatched types string and number):
    ./in.cue:24:5
    ./in.cue:24:13
-- out/eval/stats --
Leaks:  0
Freed:  16
Reused: 14
Allocs: 2
Retain: 0

Unifications: 16
Conjuncts:    25
Disjuncts:    16
