Ticket #482 (closed bug: fixed)

Opened 10 years ago

Last modified 10 years ago

t/examples/pod.t: 5 test failures

Reported by: jkeenan Owned by: coke
Priority: normal Milestone:
Component: none Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

Attached is a file with output of prove t/examples/pod.t at r37614.

Attachments

examples.pod.failure.txt Download (6.8 KB) - added by jkeenan 10 years ago.
5 test failures in t/examples/pod.t
prove_t_examples_pod_t.log Download (23.4 KB) - added by mikehh 10 years ago.
prove_t_examples_pod_t.1.log Download (21.5 KB) - added by mikehh 10 years ago.
pod_t.patch Download (4.1 KB) - added by mikehh 10 years ago.

Change History

Changed 10 years ago by jkeenan

5 test failures in t/examples/pod.t

  Changed 10 years ago by mikehh

I managed to fix 1 test (test 24) because of a missing =end PIR in docs/user/pir/intro.pod (replace =cut at line 317 with =end PIR) but this introduces a new test 25 which fails.

I have attached the before and after logs from prove --verbose t/examples.pod.t

before = prove_t_examples_pod_t.log
after = prove_t_examples_pod_t.1.log

Note the test numbers seem to bear little relation to the test failures which occur begore the test numvers are assigned?

I am working on some of the other tests.

Cheers,

Michael (mikehh)

Changed 10 years ago by mikehh

Changed 10 years ago by mikehh

  Changed 10 years ago by mikehh

I have found fixes for two more tests (27 and 30)

test 27 - docs/book/ch04_pir_subroutines.pod (28 in .1.log) it doesn't like fact as a sub name - changing this to fac or factr works. It also does not like .return p - it requires .return (p)

# factorial.pir
.sub main
   .local int count
   .local int product
   count = 5
   product = 1

   $I0 = factr(count, product)

   print $I0
   print "\n"
   end
.end

.sub factr
   .param int c
   .param int p

loop:
   if c <= 1 goto fin
   p = c * p
   dec c
   branch loop
fin:
   .return (p)
.end

test 30 docs/book/ch04_pir_subroutines.pod (31 in .1.log) I found 3 errors - a missing closing parens, a missing period before return and the return parameter needs to be enclosed in parens.

# 'docs/book/ch04_pir_subroutines.pod
.sub main :main
    .local int value
    value = add_two(5)
    say value
.end

.sub add_two
    .param int value
    .local int val2
    val2 = add_one(value)
    .tailcall add_one(val2)
.end

.sub add_one
    .param int a
    .local int b
    b = a + 1
    .return (b)
.end

I will continue working on this.

Cheers

Michael (mikehh)

  Changed 10 years ago by mikehh

As far as I can see the problem is not in the test but in the examples in the .pod files.

If I extract the snippets and run them they give the same errors.

I have managed to fix three of the tests as detailed above and am working on the others.

Cheers,

Michael (mikehh)

  Changed 10 years ago by mikehh

test 28 docs/book/ch04_pir_subroutines.pod (29 in .1.log)

there were at least 2 errors in this - it did not like concatenating an integer parameter onto a string - if I put in in an Integer register first then converted in a register and then concatenated it is ok, also there was a missing quote after " years old - I added a new line as well. There was a missing space before "You are ". I added a comma space there.

# docs/book/ch04_pir_subroutines.pod
# 
# 
.sub 'MySub'
   .param int yrs :named("age")
   .param string call :named("name")
   $S0 = "Hello " . call
   $I0 = yrs
   $S1 = $I0
   $S1 = ", You are " . $S1
   $S1 = $S1 . " years old\n"
   print $S0
   print $S1
.end

.sub main :main
   'MySub'("age" => 42, "name" => "Bob")
.end
#

Cheers,

Michael (mikehh)

  Changed 10 years ago by mikehh

In the last entry it is not necessary to assign an Integer Register, yrs can be assigned to a string register but does not work directly in concatenation.

So $S1 = yrs, $S1 = ", you are " . $S1 - works whereas $S1 = ", you are " . yrs - does not.

Cheers,

Michael (mikehh)

Changed 10 years ago by mikehh

follow-up: ↓ 7   Changed 10 years ago by mikehh

I have attached a patch which gets the test to pass. It is not complete as I have not managed to get all the code to work. In those cases I have commented the =begin/=end PIR for the moment (with the ticket number).

I will continue to look at those.

In the meantime the patch allows the test to pass (and passes codetest)

Cheers,

Michael (mikehh)

in reply to: ↑ 6   Changed 10 years ago by jkeenan

Replying to mikehh:

I have attached a patch which gets the test to pass. It is not complete as I have not managed to get all the code to work. In those cases I have commented the =begin/=end PIR for the moment (with the ticket number). I will continue to look at those. In the meantime the patch allows the test to pass (and passes codetest)

Confirmed that it's good so far.

  Changed 10 years ago by coke

Applied in spirit - this test file now passes again. Spawned another ticket for some syntax I'm not sure is/was ever valid, another for a segfault in some test code.

This test may fail occasionally as we wrap more and more old sample code in the begin/end PIR syntax.

To skip a sample, use something like

=begin PIR - See TT #483
...
=end PIR - See TT #483

  Changed 10 years ago by coke

  • owner set to coke

  Changed 10 years ago by coke

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.