Ticket #1401: pcre.t.dbg_patch

File pcre.t.dbg_patch, 2.2 KB (added by ronaldws, 4 years ago)

Diagnostic patch for tests

Line 
1Index: t/library/pcre.t
2===================================================================
3--- t/library/pcre.t    (revision 49188)
4+++ t/library/pcre.t    (working copy)
5@@ -99,10 +99,8 @@
6 CODE
7 Loaded
8 OUT
9-
10-## 2
11     my @todo;
12-    @todo = ( todo => '3..5 fail on Win32' ) if $^O =~ /MSWin32/;
13+    @todo = ( todo => '4..6 fail on Win32 (maybe)' ) if $^O =~ /MSWin32/;
14     pir_output_is( <<"CODE", <<'OUT', 'soup to nuts', @todo );
15 
16 .include 'iglobals.pasm'
17@@ -139,37 +137,58 @@
18 OK2:
19     say 'ok 2'
20 
21-
22-    .local string s
23     .local string pat
24+    pat= '(a'
25+    func= get_global ['PCRE'], 'compile'
26 
27-    s= '--a--'
28-    pat= 'a'
29-
30     .local pmc code
31-    .local string error
32+    .local pmc error
33     .local int errptr
34+     error= new ['String']
35 
36     func= get_global ['PCRE'], 'compile'
37     ( code, error, errptr )= func( pat, 0 )
38 
39-    .local int is_code_defined
40-    is_code_defined= defined code
41-    if is_code_defined goto OK3
42+    # expecting error like 'missing )'
43+    .local int error_end
44+    .local int found_paren
45+    error_end = elements error
46+    dec error_end
47+    found_paren = error.'reverse_index'(')', error_end)
48+    ne found_paren, -1, OK3
49     print 'not '
50 OK3:
51     say 'ok 3'
52 
53+    pat= 'a'
54+
55+    func= get_global ['PCRE'], 'compile'
56+    ( code, error, errptr )= func( pat, 0 )
57+
58+    .local int is_code_defined
59+    is_code_defined= defined code
60+    if is_code_defined goto OK4
61+    print 'compile error is: '
62+    say error
63+    print 'not '
64+OK4:
65+    say 'ok 4'
66+
67     .local int ok
68     .local pmc result
69 
70+    .local string s
71+    s= '--a--'
72+
73     func= get_global ['PCRE'], 'match'
74     ( ok, result )= func( code, s, 0, 0 )
75 
76-    unless ok < 0 goto OK4
77+    unless ok < 0 goto OK5
78+    print 'ok value seems to be error code - value is: '
79+    say ok
80     print 'not '
81-OK4:
82-    say 'ok 4'
83+OK5:
84+    say 'ok 5'
85 
86     .local int i
87     i = 0
88@@ -177,10 +196,10 @@
89 
90     func = get_global ['PCRE'], 'dollar'
91     match = func( s, ok, result, i )
92-    if 'a' == match goto OK5
93+    if 'a' == match goto OK6
94     print 'not '
95-OK5:
96-    say 'ok 5'
97+OK6:
98+    say 'ok 6'
99 
100 .end
101 CODE
102@@ -189,6 +208,7 @@
103 ok 3
104 ok 4
105 ok 5
106+ok 6
107 OUT
108 
109 }