Ticket #482: examples.pod.failure.txt

File examples.pod.failure.txt, 6.8 KB (added by jkeenan, 6 years ago)

5 test failures in t/examples/pod.t

Line 
1t/examples/pod....error:imcc:syntax error, unexpected STRINGC, expecting '(' ('"expired"')
2        in file '/tmp/oFLv8VF8TK.pir' line 11
3error:imcc:syntax error, unexpected STRINGC, expecting '(' ('"timer"')
4        in file '/tmp/oFLv8VF8TK.pir' line 17
5
6#   Failed test 'docs/user/pir/pmcs.pod
7#
8#
9#     .include "timer.pasm"                   \# for the timer constants
10#
11#     .sub expired
12#        print "Timer has expired!\n"
13#     .end
14#
15#     .sub _ :main
16#        $P0 = new 'Timer'
17#        $P1 = global "expired"
18#
19#        $P0[.PARROT_TIMER_HANDLER] = $P1    \# call sub in $P1 when timer goes off
20#        $P0[.PARROT_TIMER_SEC] = 2          \# trigger every 2 seconds
21#        $P0[.PARROT_TIMER_REPEAT] = -1      \# repeat indefinitely
22#        $P0[.PARROT_TIMER_RUNNING] = 1      \# start timer immediately
23#        global "timer" = $P0                \# keep the timer around
24#
25#        $I0 = 0
26#       loop:
27#        print $I0
28#        print ": running...\n"
29#        inc $I0
30#        sleep 1                             \# wait a second
31#        goto loop
32#     .end
33#
34# '
35#   at t/examples/pod.t line 49.
36#          got: '256'
37#     expected: '0'
38error:imcc:syntax error, unexpected IDENTIFIER, expecting $end ('This')
39        in file '/tmp/4Wsizg0h5B.pir' line 21
40
41#   Failed test 'docs/user/pir/intro.pod
42#
43#
44#   .sub main :main
45#      $I1 = factorial(5)
46#      print $I1
47#      print "\n"
48#   .end
49#
50#   .sub factorial
51#      .param int i
52#      if i > 1 goto recur
53#      .return (1)
54#   recur:
55#      $I1 = i - 1
56#      $I2 = factorial($I1)
57#      $I2 *= i
58#      .return ($I2)
59#   .end
60#
61# =cut
62#
63# This example also shows that PIR subroutines may be recursive just as in
64# a high-level language.
65#
66# =head2 Named Arguments
67#
68# As some other languages as Python and Perl support named arguments,
69# PIR supports them as well.
70#
71# As before, I need to use C<.param> for each named argument, but you need to
72# specify a flag indicating the parameter is named:
73#
74#   .sub func
75#     .param int a :named("foo")
76#
77# The subroutine will receive an integer named "foo", and inside of the
78# subroutine that integer will be known as "a".
79#
80# When calling the function, I need to pass the names of the
81# arguments. For that there are two syntaxes:
82#
83#   func( 10 :named("foo") )    \# or
84#   func( "foo" => 10 )
85#
86# Note that with named arguments, you may rearrange the order of your
87# parameters at will.
88#
89# =begin PIR
90#
91#   .sub foo
92#     .param string "name"    => a
93#     .param int    "age"     => b
94#     .param string "gender"  => c
95#     \# ...
96#   .end
97#
98# '
99#   at t/examples/pod.t line 49.
100#          got: '256'
101#     expected: '0'
102error:imcc:The opcode 'fact_i' (fact<1>) was not found. Check the type and number of the arguments
103        in file '/tmp/PHze5YBsNQ.pir' line 10
104
105#   Failed test 'docs/book/ch04_pir_subroutines.pod
106#
107#
108#   \# factorial.pir
109#   .sub main
110#      .local int count
111#      .local int product
112#      count = 5
113#      product = 1
114#
115#      $I0 = fact(count, product)
116#
117#      print $I0
118#      print "\n"
119#      end
120#   .end
121#
122#   .sub fact
123#      .param int c
124#      .param int p
125#
126#   loop:
127#      if c <= 1 goto fin
128#      p = c * p
129#      dec c
130#      branch loop
131#   fin:
132#      .return p
133#   .end
134#
135# '
136#   at t/examples/pod.t line 49.
137#          got: '512'
138#     expected: '0'
139error:imcc:The opcode 'concat_s_sc_i' (concat<3>) was not found. Check the type and number of the arguments
140        in file '/tmp/JcNjVN4Ljy.pir' line 7
141
142#   Failed test 'docs/book/ch04_pir_subroutines.pod
143#
144#
145#  .sub 'MySub'
146#     .param int yrs :named("age")
147#     .param string call :named("name")
148#     $S0 = "Hello " . call
149#     $S1 = "You are " . yrs
150#     $S1 = $S1 . " years old
151#     print $S0
152#     print $S1
153#  .end
154#
155#  .sub main :main
156#     'MySub'("age" => 42, "name" => "Bob")
157#  .end
158#
159# '
160#   at t/examples/pod.t line 49.
161#          got: '512'
162#     expected: '0'
163error:imcc:syntax error, unexpected '\n', expecting COMMA or ')'
164        in file '/tmp/FTZhyWsid2.pir' line 12
165error:imcc:syntax error, unexpected VAR, expecting '(' ('b')
166        in file '/tmp/FTZhyWsid2.pir' line 20
167
168#   Failed test 'docs/book/ch04_pir_subroutines.pod
169#
170#
171#   .sub main :main
172#       .local int value
173#       value = add_two(5)
174#       say value
175#   .end
176#
177#   .sub add_two
178#       .param int value
179#       .local int val2
180#       val2 = add_one(value
181#       .tailcall add_one(val2)
182#   .end
183#
184#   .sub add_one
185#       .param int a
186#       .local int b
187#       b = a + 1
188#       return b
189#   .end
190#
191# '
192#   at t/examples/pod.t line 49.
193#          got: '256'
194#     expected: '0'
195error:imcc:syntax error, unexpected INTV, expecting STRINGC ('int')
196        in file '/tmp/wlhMKOemjj.pir' line 4
197error:imcc:syntax error, unexpected INTV, expecting STRINGC ('int')
198        in file '/tmp/wlhMKOemjj.pir' line 5
199error:imcc:syntax error, unexpected INTV, expecting STRINGC ('int')
200        in file '/tmp/wlhMKOemjj.pir' line 11
201
202#   Failed test 'docs/book/ch04_pir_subroutines.pod
203#
204#
205#   .sub 'MyOuter'
206#       .lex int x
207#       .lex int y
208#       'MyInner'()
209#       \# only x and y are visible here
210#   .end
211#
212#   .sub 'MyInner' :outer('MyOuter')
213#       .lex int z
214#       \#x, y, and z are all "visible" here
215#   .end
216#
217# '
218#   at t/examples/pod.t line 49.
219#          got: '256'
220#     expected: '0'
221error:imcc:syntax error, unexpected PARROT_OP, expecting '(' ('fact')
222        in file '/tmp/tp7yEZjet4.pir' line 5
223error:imcc:syntax error, unexpected PARROT_OP, expecting '(' ('fact')
224        in file '/tmp/tp7yEZjet4.pir' line 9
225
226#   Failed test 'docs/book/ch04_pir_subroutines.pod
227#
228#
229#   .sub main
230#       $I1 = 5           \# counter
231#       call fact         \# same as "bsr fact"
232#       print $I0
233#       print "\n"
234#       $I1 = 6           \# counter
235#       call fact
236#       print $I0
237#       print "\n"
238#       end
239#
240#   fact:
241#       $I0 = 1           \# product
242#   L1:
243#       $I0 = $I0 * $I1
244#       dec $I1
245#       if $I1 > 0 goto L1
246#       ret
247#   .end
248#
249# '
250#   at t/examples/pod.t line 49.
251#          got: '256'
252#     expected: '0'
253error:imcc:syntax error, unexpected ADV_INVOCANT, expecting '\n' (':invocant')
254        in file '/tmp/F4D162WOA5.pir' line 9
255
256#   Failed test 'docs/book/ch04_pir_subroutines.pod
257#
258#
259#   .sub "MyMethod" :method
260#     $S0 = self                    \# Already defined as "self"
261#     say $S0
262#   .end
263#
264#   .sub "MyMethod2" :method
265#     .param pmc item :invocant     \# "self" is now called "item"
266#     $S0 = item
267#     say $S0
268#   .end
269#
270# '
271#   at t/examples/pod.t line 49.
272#          got: '256'
273#     expected: '0'
274# Looks like you failed 8 tests of 49.
275 Dubious, test returned 8 (wstat 2048, 0x800)
276 Failed 8/49 subtests
277
278Test Summary Report
279-------------------
280t/examples/pod (Wstat: 2048 Tests: 49 Failed: 8)
281  Failed tests:  20, 24, 27-28, 30-33
282  Non-zero exit status: 8
283Files=1, Tests=49,  4 wallclock secs ( 0.00 usr  0.00 sys +  0.95 cusr  0.48 csys =  1.43 CPU)
284Result: FAIL