thomascube
2012-03-03 884add1419729cb8eb5ed8fb47ea68e5f6ce6682
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
--TEST--
Script parsing: tokenizer
--SKIPIF--
--FILE--
<?php
include '../lib/rcube_sieve_script.php';
 
$txt[1] = array(1, 'text: #test
This is test ; message;
Multi line
.
;
');
$txt[2] = array(0, '["test1","test2"]');
$txt[3] = array(1, '["test"]');
$txt[4] = array(1, '"te\\"st"');
$txt[5] = array(0, 'test #comment');
$txt[6] = array(0, 'text:
test
.
text:
test
.
');
$txt[7] = array(1, '"\\a\\\\\\"a"');
 
foreach ($txt as $idx => $t) {
    echo "[$idx]---------------\n"; 
    var_dump(rcube_sieve_script::tokenize($t[1], $t[0]));
}
?>
--EXPECT--
[1]---------------
string(34) "This is test ; message;
Multi line"
[2]---------------
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(5) "test1"
    [1]=>
    string(5) "test2"
  }
}
[3]---------------
array(1) {
  [0]=>
  string(4) "test"
}
[4]---------------
string(5) "te"st"
[5]---------------
array(1) {
  [0]=>
  string(4) "test"
}
[6]---------------
array(2) {
  [0]=>
  string(4) "test"
  [1]=>
  string(4) "test"
}
[7]---------------
string(4) "a\"a"