summaryrefslogtreecommitdiff
path: root/test/if.conf
blob: 8fcf92f1b97813a3b4793d356245c2aab7559111 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
pre_set $v inc;
pre_set $e '';

pre_if (0)   { nope s1; }
pre_if ("")  { nope s2; }
pre_if ''    { nope s3; }
pre_if 1     { yup s4; }
pre_if (1 )  { yup s5; }
pre_if ( 1 ) { yup s6; }
pre_if ( 1)  { yup s7; }
pre_if (1)   { yup s8; }
pre_if $v    { yup s9; }
pre_if ($v)  { yup s10; }
pre_if $e    { nope s11; }
pre_if ($e)  { nope s12; }

pre_if 1 {}
pre_if 1 { mul 1; mul 2; }

pre_if (-x empty.conf)  { nope f1; }
pre_if (!-x empty.conf) { yup f2; }
pre_if -f empty.conf    { yup f3; }
pre_if (-d inc       )  { yup f4; }
pre_if ( !-d inc     )  { nope f5; }
pre_if -e empty.conf    { yup f6; }
pre_if -e inc           { yup f7; }
pre_if -e doesnotexist  { nope f8; }
pre_if -e $v            { yup f9; }
pre_if -e $e            { nope f10; }

pre_if '' == ""  { yup t1; }
pre_if 0 == 0    { yup t2; }
pre_if ab != ab  { nope t3; }
pre_if ab == ab  { yup t4; }
pre_if '' != 0   { yup t5; }
pre_if $e == ''  { yup t6; }
pre_if inc == $v { yup t7; }
pre_if ( 0 == 0 ){ yup t8; }
pre_if (0 == 0)  { yup t9; }

pre_if abc ~ b    { yup r1; }
pre_if abc ~ ^b   { nope r2; }
pre_if abc ~* B   { yup r3; }
pre_if abc ~* C$  { yup r4; }
pre_if $v ~ ^inc$ { yup r5; }
pre_if ($v ~ ^..(.)) { yup r6 c: $1; }
pre_if $v ~* (.)([A-Z])(.) { yup r7 i: $1, n: $2, c: $3, inc: $0; }
pre_if abc !~ d { yup r8 $0 <- not substituted; }
pre_if abc !~ a  { nope r9; }
pre_if abc !~* A  { nope r10; }

pre_if 1 {
    pre_if abc ~ (.) {
        pre_if $1 == a {
            pre_if a !~ b {
                yup nested, a: $1;
            }
        }
    }
    there is no $1 here;
}

pre_if x ~ (x) {
    pre_set $var $1;
}
var set to $var;