exercism / exercism/perl5-test-runner

Invalid output for ETL exercise

Open
#62 1 comment 0 reactions 1 assignee Claimed by @m-dango View on GitHub
Dominant language
Perl
Stars
0
Forks
6
PR merge metrics
No merged PRs in 30d

Description

When submitting the following solution to the `etl` exercise:

```perl5
use experimental qw( signatures switch );

sub transform ( $data ) {

return reverse %$data;

my %result;

for my $key ( keys %$data ) {
for my $value ( %$data{ $key } ) {
$result->{ lc $value }++; # = [ $result{ lc $value }, lc $key ];
}
}

# for my $key (keys %$data) {
# %results->{ lc %$data->{$_} } = $_;
# }

return \%result;

}

use strict; use warnings;
use Exporter qw; our @EXPORT_OK = qw
```

the test runner returns invalid JSON:

```json
{
"status" : "fail",
"tests" : [
{
"name" : "Imported symbol: transform",
"output" : null,
"status" : "pass"
},
{
"message" : "+-----------------------+----+-------+\n| GOT | OP | CHECK |\n+-----------------------+----+-------+\n| ARRAY(0x5654e8335858) | eq | 1 |\n+-----------------------+----+-------+single letter",
"name" : {
"a" : 1
},
"output" : null,
"status" : "fail"
},
{
"message" : "+-----------------------+----+-------+\n| GOT | OP | CHECK |\n+-----------------------+----+-------+\n| ARRAY(0x5654e7386458) | eq | 1 |\n+-----------------------+----+-------+single score with multiple letters",
"name" : {
"a" : 1,
"e" : 1,
"i" : 1,
"o" : 1,
"u" : 1
},
"output" : null,
"status" : "fail"
},
{
"message" : "+-----------------------+----+-------+\n| GOT | OP | CHECK |\n+-----------------------+----+-------+\n| ARRAY(0x5654e79cb540) | eq | 2 |\n+-----------------------+----+-------+1HASH(0x55f9ca8e2620)multiple scores with multiple letters",
"name" : [
"A",
"E"
],
"output" : null,
"status" : "fail"
},
{
"message" : "+-----------------------+----+-------+\n| GOT | OP | CHECK |\n+-----------------------+----+-------+\n| ARRAY(0x5654e7378b50) | eq | 8 |\n+-----------------------+----+-------+2ARRAY(0x55f9ca8e2350)5ARRAY(0x55f9ca8e2a88)1ARRAY(0x55f9caad4d38)4ARRAY(0x55f9caad4c90)10ARRAY(0x55f9caad4480)3HASH(0x55f9ca8e26b0)multiple scores with differing numbers of letters",
"name" : [
"D",
"G"
],
"output" : null,
"status" : "fail"
}
],
"version" : 2
}
```

How how the `name` key is a `string`, `object` and `array`. We only accept strings for the name though, so the others likely indicate some issue with the test runner.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.