Ticket #482: prove_t_examples_pod_t.log

File prove_t_examples_pod_t.log, 23.4 KB (added by mikehh, 6 years ago)
Line 
1error:imcc:syntax error, unexpected STRINGC, expecting '(' ('"expired"')
2        in file '/tmp/1gwF_yRDuu.pir' line 11
3error:imcc:syntax error, unexpected STRINGC, expecting '(' ('"timer"')
4        in file '/tmp/1gwF_yRDuu.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/4gxj7SjW6U.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/T01udkLNqa.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/Q7rz5y8THb.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/lcqLDnOhtE.pir' line 12
165error:imcc:syntax error, unexpected VAR, expecting '(' ('b')
166        in file '/tmp/lcqLDnOhtE.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/OoAnD0DsUw.pir' line 4
197error:imcc:syntax error, unexpected INTV, expecting STRINGC ('int')
198        in file '/tmp/OoAnD0DsUw.pir' line 5
199error:imcc:syntax error, unexpected INTV, expecting STRINGC ('int')
200        in file '/tmp/OoAnD0DsUw.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/_fIsrlJkwA.pir' line 5
223error:imcc:syntax error, unexpected PARROT_OP, expecting '(' ('fact')
224        in file '/tmp/_fIsrlJkwA.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/n7lSR39Fuc.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.
275t/examples/pod.t ..
276ok 1 - docs/book/ch03_pir_basics.pod
277#
278#   .sub main
279#     $S0 = "hello "
280#     print $S0
281#     $S1 = "world!"
282#     print $S1
283#   .end
284#
285ok 2 - docs/book/ch03_pir_basics.pod
286#
287#   .sub main
288#     $S0 = "hello "
289#     print $S0
290#     $S0 = "world!"
291#     print $S0
292#   .end
293#
294ok 3 - docs/book/ch03_pir_basics.pod
295#
296#   .sub main
297#       print "Hello, Polly.\n"
298#   .end
299#
300ok 4 - docs/book/ch03_pir_basics.pod
301#
302#   .sub first
303#       print "Polly want a cracker?\n"
304#   .end
305#
306#   .sub second :main
307#       print "Hello, Polly.\n"
308#   .end
309#
310ok 5 - docs/book/ch03_pir_basics.pod
311#
312#   .sub first :main
313#       print "Polly want a cracker?\n"
314#   .end
315#
316#   .sub second
317#       print "Hello, Polly.\n"
318#   .end
319#
320ok 6 - docs/book/ch03_pir_basics.pod
321#
322#   .sub _main
323#       goto L1
324#       print "never printed"
325#   L1:
326#       print "after branch\n"
327#       end
328#   .end
329#
330ok 7 - docs/book/ch03_pir_basics.pod
331#
332#   .sub _main
333#       $I0 = 42
334#       if $I0 goto L1
335#       print "never printed"
336#   L1: print "after branch\n"
337#       end
338#   .end
339#
340ok 8 - docs/book/ch03_pir_basics.pod
341#
342#   .sub _main
343#       $I0 = 42
344#       $I1 = 43
345#       if $I0 < $I1 goto L1
346#       print "never printed"
347#   L1:
348#       print "after branch\n"
349#       end
350#   .end
351#
352ok 9 - docs/book/ch03_pir_basics.pod
353#
354#   .sub _main
355#       $I0 = 1               \# product
356#       $I1 = 5               \# counter
357#
358#   REDO:                     \# start of loop
359#       $I0 = $I0 * $I1
360#       dec $I1
361#       if $I1 > 0 goto REDO  \# end of loop
362#
363#       print $I0
364#       print "\n"
365#       end
366#   .end
367#
368ok 10 - docs/book/ch03_pir_basics.pod
369#
370#   .sub _main
371#       $I0 = 1               \# product
372#       $I1 = 5               \# counter
373#
374#   REDO:                     \# start of loop
375#       if $I1 <= 0 goto LAST
376#       $I0 = $I0 * $I1
377#       dec $I1
378#       goto REDO
379#   LAST:                     \# end of loop
380#
381#       print $I0
382#       print "\n"
383#       end
384#   .end
385#
386ok 11 - docs/book/ch03_pir_basics.pod
387#
388#   .sub main
389#     loop_top:
390#       $S0 = read 10
391#       print $S0
392#       goto loop_top
393#   .end
394#
395ok 12 - docs/book/ch03_pir_basics.pod
396#
397#   .sub main
398#     $P0 = getstdout
399#     $P1 = open "myfile.txt", "r"
400#     loop_top:
401#       $S0 = readline $P1
402#       print $P0, $S0
403#       if $P1 goto loop_top
404#     close $P1
405#   .end
406#
407ok 13 - docs/user/pir/pmcs.pod
408#
409#
410#     .sub _ :main
411#         .param pmc args
412#       loop:
413#         unless args goto end_loop           \# line 4
414#         $S0 = shift args
415#         print $S0
416#         print "\n"
417#         goto loop
418#       end_loop:
419#     .end
420#
421#
422ok 14 - docs/user/pir/pmcs.pod
423#
424#
425#     .sub _ :main
426#         .param pmc args
427#         .local int argc
428#         argc = args                         \# line 4
429#         $I0 = 0
430#       loop:
431#         unless $I0 < argc goto end_loop
432#         print $I0
433#         print "\t"
434#         $S0 = args[$I0]                     \# line 10
435#         print $S0
436#         print "\n"
437#         inc $I0
438#         goto loop
439#       end_loop:
440#     .end
441#
442#
443ok 15 - docs/user/pir/pmcs.pod
444#
445#
446#     .sub _ :main
447#         .param pmc args
448#         $S0 = typeof args
449#         print $S0
450#         print "\n"
451#     .end
452#
453#
454ok 16 - docs/user/pir/pmcs.pod
455#
456#
457#     .sub _ :main
458#         .local pmc env, iter
459#         .local string key, value
460#
461#         env  = new 'Env'                    \# line 3
462#         iter = new 'Iterator', env          \# line 4
463#       iterloop:
464#         unless iter goto iterend
465#         key = shift iter                    \# line 8
466#         value = env[key]
467#         print key
468#         print ":"
469#         print value
470#         print "\n"
471#         goto iterloop
472#       iterend:
473#     .end
474#
475#
476ok 17 - docs/user/pir/pmcs.pod
477#
478#
479#     .sub _ :main
480#         .param pmc args
481#         .local pmc cmdline
482#         cmdline = new 'Iterator', args
483#       loop:
484#         unless cmdline goto end_loop
485#         $S0 = shift cmdline
486#         print $S0
487#         print "\n"
488#         goto loop
489#       end_loop:
490#     .end
491#
492#
493ok 18 - docs/user/pir/pmcs.pod
494#
495#
496#     .sub _ :main
497#         $P0 = new 'Random'
498#         $N0 = $P0
499#         print $N0
500#         print "\n"
501#         $N0 = $P0
502#         print $N0
503#         print "\n"
504#     .end
505#
506#
507ok 19 - docs/user/pir/pmcs.pod
508#
509#
510#     .sub _ :main
511#         $P0 = new 'Exception'
512#         $P0 = "The sky is falling!"
513#         throw $P0
514#     .end
515#
516#
517not ok 20 - docs/user/pir/pmcs.pod
518#
519#
520#     .include "timer.pasm"                   \# for the timer constants
521#
522#     .sub expired
523#        print "Timer has expired!\n"
524#     .end
525#
526#     .sub _ :main
527#        $P0 = new 'Timer'
528#        $P1 = global "expired"
529#
530#        $P0[.PARROT_TIMER_HANDLER] = $P1    \# call sub in $P1 when timer goes off
531#        $P0[.PARROT_TIMER_SEC] = 2          \# trigger every 2 seconds
532#        $P0[.PARROT_TIMER_REPEAT] = -1      \# repeat indefinitely
533#        $P0[.PARROT_TIMER_RUNNING] = 1      \# start timer immediately
534#        global "timer" = $P0                \# keep the timer around
535#
536#        $I0 = 0
537#       loop:
538#        print $I0
539#        print ": running...\n"
540#        inc $I0
541#        sleep 1                             \# wait a second
542#        goto loop
543#     .end
544#
545#
546ok 21 - docs/user/pir/intro.pod
547#
548#
549#   .sub main :main
550#        print "hello world\n"
551#   .end
552#
553#
554ok 22 - docs/user/pir/intro.pod
555#
556#
557#   .sub main :main
558#      hello()
559#   .end
560#
561#   .sub hello
562#     print "Hello World\n"
563#   .end
564#
565#
566ok 23 - docs/user/pir/intro.pod
567#
568#
569#   .sub main :main
570#      hello("leo")
571#      hello("chip")
572#   .end
573#
574#   .sub hello
575#      .param string person
576#      print "Hello "
577#      print person
578#      print "\n"
579#   .end
580#
581#
582not ok 24 - docs/user/pir/intro.pod
583#
584#
585#   .sub main :main
586#      $I1 = factorial(5)
587#      print $I1
588#      print "\n"
589#   .end
590#
591#   .sub factorial
592#      .param int i
593#      if i > 1 goto recur
594#      .return (1)
595#   recur:
596#      $I1 = i - 1
597#      $I2 = factorial($I1)
598#      $I2 *= i
599#      .return ($I2)
600#   .end
601#
602# =cut
603#
604# This example also shows that PIR subroutines may be recursive just as in
605# a high-level language.
606#
607# =head2 Named Arguments
608#
609# As some other languages as Python and Perl support named arguments,
610# PIR supports them as well.
611#
612# As before, I need to use C<.param> for each named argument, but you need to
613# specify a flag indicating the parameter is named:
614#
615#   .sub func
616#     .param int a :named("foo")
617#
618# The subroutine will receive an integer named "foo", and inside of the
619# subroutine that integer will be known as "a".
620#
621# When calling the function, I need to pass the names of the
622# arguments. For that there are two syntaxes:
623#
624#   func( 10 :named("foo") )    \# or
625#   func( "foo" => 10 )
626#
627# Note that with named arguments, you may rearrange the order of your
628# parameters at will.
629#
630# =begin PIR
631#
632#   .sub foo
633#     .param string "name"    => a
634#     .param int    "age"     => b
635#     .param string "gender"  => c
636#     \# ...
637#   .end
638#
639#
640ok 25 - docs/user/pir/intro.pod
641#
642#
643#   .sub main
644#     .param int a
645#     .param int b :named("age")
646#     \# ...
647#   .end
648#
649#
650ok 26 - docs/book/ch05_pasm.pod
651#
652#
653#   LABEL:
654#       print "The answer is: "
655#       print 42
656#       print "\n"
657#       end                \# halt the interpreter
658#
659#
660not ok 27 - docs/book/ch04_pir_subroutines.pod
661#
662#
663#   \# factorial.pir
664#   .sub main
665#      .local int count
666#      .local int product
667#      count = 5
668#      product = 1
669#
670#      $I0 = fact(count, product)
671#
672#      print $I0
673#      print "\n"
674#      end
675#   .end
676#
677#   .sub fact
678#      .param int c
679#      .param int p
680#
681#   loop:
682#      if c <= 1 goto fin
683#      p = c * p
684#      dec c
685#      branch loop
686#   fin:
687#      .return p
688#   .end
689#
690#
691not ok 28 - docs/book/ch04_pir_subroutines.pod
692#
693#
694#  .sub 'MySub'
695#     .param int yrs :named("age")
696#     .param string call :named("name")
697#     $S0 = "Hello " . call
698#     $S1 = "You are " . yrs
699#     $S1 = $S1 . " years old
700#     print $S0
701#     print $S1
702#  .end
703#
704#  .sub main :main
705#     'MySub'("age" => 42, "name" => "Bob")
706#  .end
707#
708#
709ok 29 - docs/book/ch04_pir_subroutines.pod
710#
711#
712#  .sub main :main
713#     'MySub'("name" => "Bob", "age" => 42)    \# Same!
714#  .end
715#
716#
717not ok 30 - docs/book/ch04_pir_subroutines.pod
718#
719#
720#   .sub main :main
721#       .local int value
722#       value = add_two(5)
723#       say value
724#   .end
725#
726#   .sub add_two
727#       .param int value
728#       .local int val2
729#       val2 = add_one(value
730#       .tailcall add_one(val2)
731#   .end
732#
733#   .sub add_one
734#       .param int a
735#       .local int b
736#       b = a + 1
737#       return b
738#   .end
739#
740#
741not ok 31 - docs/book/ch04_pir_subroutines.pod
742#
743#
744#   .sub 'MyOuter'
745#       .lex int x
746#       .lex int y
747#       'MyInner'()
748#       \# only x and y are visible here
749#   .end
750#
751#   .sub 'MyInner' :outer('MyOuter')
752#       .lex int z
753#       \#x, y, and z are all "visible" here
754#   .end
755#
756#
757not ok 32 - docs/book/ch04_pir_subroutines.pod
758#
759#
760#   .sub main
761#       $I1 = 5           \# counter
762#       call fact         \# same as "bsr fact"
763#       print $I0
764#       print "\n"
765#       $I1 = 6           \# counter
766#       call fact
767#       print $I0
768#       print "\n"
769#       end
770#
771#   fact:
772#       $I0 = 1           \# product
773#   L1:
774#       $I0 = $I0 * $I1
775#       dec $I1
776#       if $I1 > 0 goto L1
777#       ret
778#   .end
779#
780#
781not ok 33 - docs/book/ch04_pir_subroutines.pod
782#
783#
784#   .sub "MyMethod" :method
785#     $S0 = self                    \# Already defined as "self"
786#     say $S0
787#   .end
788#
789#   .sub "MyMethod2" :method
790#     .param pmc item :invocant     \# "self" is now called "item"
791#     $S0 = item
792#     say $S0
793#   .end
794#
795#
796ok 34 - docs/book/ch04_pir_subroutines.pod
797#
798#
799#   .sub main
800#     .local pmc class
801#     .local pmc obj
802#     newclass class, "Foo"       \# create a new Foo class
803#     new obj, "Foo"              \# instantiate a Foo object
804#     obj."meth"()                \# call obj."meth" which is actually
805#     print "done\n"              \# in the "Foo" namespace
806#     end
807#   .end
808#
809#   .namespace [ "Foo" ]          \# start namespace "Foo"
810#
811#   .sub meth :method             \# define Foo::meth global
812#      print "in meth\n"
813#      $S0 = "other_meth"         \# method names can be in a register too
814#      self.$S0()                 \# self is the invocant
815#   .end
816#
817#   .sub other_meth :method       \# define another method
818#      print "in other_meth\n"    \# as above Parrot provides a return
819#   .end                          \# statement
820#
821#
822ok 35 - docs/intro.pod
823#
824#
825#   .sub main
826#       print "Hello world!\n"
827#   .end
828#
829#
830ok 36 - docs/intro.pod
831#
832#
833#   .sub main
834#       set $S0, "Hello world!\n"
835#       print $S0
836#   .end
837#
838#
839ok 37 - docs/intro.pod
840#
841#
842#   .sub main
843#       $S0 = "Hello world!\n"
844#       print $S0
845#   .end
846#
847#
848ok 38 - docs/intro.pod
849#
850#
851#   .sub main
852#       .local string hello
853#       hello = "Hello world!\n"
854#       print hello
855#   .end
856#
857#
858ok 39 - docs/intro.pod
859#
860#
861#   .sub main
862#       \# State the number of squares to sum.
863#       .local int maxnum
864#       maxnum = 10
865#
866#       \# We'll use some named registers. Note that we can declare many
867#       \# registers of the same type on one line.
868#       .local int i, total, temp
869#       total = 0
870#
871#       \# Loop to do the sum.
872#       i = 1
873#   loop:
874#       temp = i * i
875#       total += temp
876#       inc i
877#       if i <= maxnum goto loop
878#
879#       \# Output result.
880#       print "The sum of the first "
881#       print maxnum
882#       print " squares is "
883#       print total
884#       print ".\n"
885#   .end
886#
887#
888ok 40 - docs/intro.pod
889#
890#
891#   .sub factorial
892#       \# Get input parameter.
893#       .param int n
894#
895#       \# return (n > 1 ? n * factorial(n - 1) : 1)
896#       .local int result
897#
898#       if n > 1 goto recurse
899#       result = 1
900#       goto return
901#
902#   recurse:
903#       $I0 = n - 1
904#       result = factorial($I0)
905#       result *= n
906#
907#   return:
908#       .return (result)
909#   .end
910#
911#
912#   .sub main :main
913#       .local int f, i
914#
915#       \# We'll do factorial 0 to 10.
916#       i = 0
917#   loop:
918#       f = factorial(i)
919#
920#       print "Factorial of "
921#       print i
922#       print " is "
923#       print f
924#       print ".\n"
925#
926#       inc i
927#       if i <= 10 goto loop
928#   .end
929#
930#
931ok 41 - docs/user/pir/objects.pod
932#
933#
934#     .namespace [ "Person" ]
935#
936#     .sub run
937#         say "Run Forrest, Run!"
938#     .end
939#
940#     .namespace [ "Process" ]
941#
942#     .sub run
943#         say "Running process \#53"
944#     .end
945#
946#
947ok 42 - docs/user/pir/objects.pod
948#
949#
950#     .sub _ :main
951#         $P0 = newclass 'Dog'
952#         .local pmc spot
953#         spot = new 'Dog'
954#     .end
955#
956#
957ok 43 - docs/user/pir/objects.pod
958#
959#
960#     .namespace [ "Cow" ]
961#
962#     .sub speak :method
963#         print "Moo\n"
964#     .end
965#
966#     .namespace [ "Dog" ]
967#
968#     .sub speak :method
969#         print "Woof\n"
970#     .end
971#
972#     .namespace [ "Pig" ]
973#
974#     .sub speak :method
975#         print "Oink\n"
976#     .end
977#
978#     .namespace []
979#
980#     .sub _ :main
981#         $P0 = newclass "Cow"
982#         $P0 = newclass "Dog"
983#         $P0 = newclass "Pig"
984#
985#         .local pmc elsie, fido, porky
986#
987#         elsie   = new "Cow"
988#         fido    = new "Dog"
989#         porky   = new "Pig"
990#
991#         elsie.'speak'()
992#         fido.'speak'()
993#         porky.'speak'()
994#     .end
995#
996#
997ok 44 - docs/user/pir/objects.pod
998#
999#
1000#     .namespace [ 'Foo' ]
1001#
1002#     .sub foo :method
1003#         print "foo\n"
1004#     .end
1005#
1006#     .sub bar :method
1007#         print "bar\n"
1008#     .end
1009#
1010#     .namespace []
1011#
1012#     .sub _ :main
1013#         $P0 = newclass "Foo"
1014#         .local pmc f
1015#         f = new "Foo"
1016#
1017#         .local string m
1018#         m = "foo"
1019#         f.m()
1020#         m = "bar"
1021#         f.m()
1022#     .end
1023#
1024#
1025ok 45 - docs/user/pir/objects.pod
1026#
1027#
1028#     .namespace [ "Dog" ]
1029#
1030#     .sub name :method
1031#         .local pmc name
1032#         name = getattribute self, "name"
1033#         print name
1034#     .end
1035#
1036#     .sub speak :method
1037#         print "woof"
1038#     .end
1039#
1040#     .namespace []
1041#
1042#     .sub _ :main
1043#         $P0 = newclass "Dog"
1044#         addattribute $P0, "name"
1045#
1046#         .local pmc dog
1047#         dog = new "Dog"
1048#         $P0 = new "String"
1049#         $P0 = "Phideaux"
1050#         setattribute dog, "name", $P0
1051#
1052#         dog.'name'()
1053#         print " says "
1054#         dog.'speak'()
1055#         print "!\n"
1056#     .end
1057#
1058#
1059ok 46 - docs/user/pir/objects.pod
1060#
1061#
1062#     .namespace [ "Animal" ]
1063#
1064#     .sub setname :method
1065#         .param string name
1066#         $P0 = new 'String'
1067#         $P0 = name
1068#         setattribute self, "name", $P0
1069#     .end
1070#
1071#     .sub getname :method
1072#         $P0 = getattribute self, "name"
1073#         print $P0
1074#     .end
1075#
1076#     .sub speak :method
1077#         .local string name, sound
1078#         name = self.'getname'()
1079#         sound = self.'sound'()
1080#         print name
1081#         print " says "
1082#         print sound
1083#         print "\n"
1084#     .end
1085#
1086#     .namespace [ "Cow" ]
1087#
1088#     .sub sound :method
1089#         .return( "moo" )
1090#     .end
1091#
1092#     .namespace [ "Dog" ]
1093#
1094#     .sub sound :method
1095#         .return( "woof" )
1096#     .end
1097#
1098#     .namespace [ "Pig" ]
1099#
1100#     .sub sound :method
1101#         .return( "oink" )
1102#     .end
1103#
1104#     .namespace []
1105#
1106#     .sub _ :main
1107#         $P0 = newclass "Animal"
1108#         addattribute $P0, "name"
1109#         $P0 = subclass "Animal", "Cow"
1110#         $P0 = subclass "Animal", "Dog"
1111#         $P0 = subclass "Animal", "Pig"
1112#
1113#         .local pmc cow, dog, pig
1114#
1115#         cow   = new "Cow"
1116#         cow.'setname'("Elsie")
1117#         dog    = new "Dog"
1118#         dog.'setname'("Snoopy")
1119#         pig   = new "Pig"
1120#         pig.'setname'("Porky")
1121#
1122#         cow.'speak'()
1123#         dog.'speak'()
1124#         pig.'speak'()
1125#     .end
1126#
1127#
1128ok 47 - docs/compiler_faq.pod
1129#
1130#   .sub my_coro             \# automagically a Coroutine PMC
1131#      .param pmc result
1132#      \#...
1133#      .yield (result)
1134#      \#...
1135#   .end
1136#
1137ok 48 - docs/compiler_faq.pod
1138#
1139#   .sub foo
1140#       \# ...
1141#       .tailcall bar(42)           \# tail call sub bar
1142#   .end
1143#
1144#   .sub bar
1145#       .param int answer
1146#       inc answer
1147#       .return(answer)
1148#   .end
1149#
1150ok 49 - docs/user/pir/exceptions.pod
1151#
1152#
1153#     .include 'include/except_severity.pasm'
1154#
1155#     .sub 'dostuff'
1156#         .local pmc eh
1157#         eh = new 'ExceptionHandler'
1158#         set_addr eh, handler
1159#         eh.'min_severity'(.EXCEPT_ERROR)
1160#         push_eh eh
1161#         \# ... stuff that might throw an error
1162#         pop_eh
1163#         .return (1)
1164#       handler:
1165#         .local pmc ex
1166#         .local string msg
1167#         .get_results (ex)
1168#         print "There was a fatal error in dostuff: "
1169#         msg = ex
1170#         say ex
1171#         exit 1
1172#     .end
1173#
1174#
11751..49
1176Dubious, test returned 8 (wstat 2048, 0x800)
1177Failed 8/49 subtests
1178
1179Test Summary Report
1180-------------------
1181t/examples/pod.t (Wstat: 2048 Tests: 49 Failed: 8)
1182  Failed tests:  20, 24, 27-28, 30-33
1183  Non-zero exit status: 8
1184Files=1, Tests=49,  1 wallclock secs ( 0.12 usr  0.00 sys +  0.86 cusr  0.43 csys =  1.41 CPU)
1185Result: FAIL