Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some Perl array tests #259

Merged
merged 4 commits into from
Oct 24, 2023
Merged

Conversation

Mingun
Copy link
Contributor

@Mingun Mingun commented Oct 24, 2023

This PR fixes the following tests from the latest run

[info] - perl:[0, 1, 100500] *** FAILED ***
[info]   "[[0, 1, 100500]]" was not equal to "[(0, 1, 100500)]" (TranslatorSpec.scala:718)
[info]   Analysis:
[info]   "[[0, 1, 100500]]" -> "[(0, 1, 100500)]"
...
[info] - perl:a[42] *** FAILED ***
[info]   no expected result, but actual result is @{$self->a()}[42] (TranslatorSpec.scala:720)
...
[info] - perl:a[42 - 2] *** FAILED ***
[info]   no expected result, but actual result is @{$self->a()}[(42 - 2)] (TranslatorSpec.scala:720)
...
[info] - perl:a.first *** FAILED ***
[info]   no expected result, but actual result is @{$self->a()}[0] (TranslatorSpec.scala:720)
...
[info] - perl:a.last *** FAILED ***
[info]   no expected result, but actual result is @{$self->a()}[-1] (TranslatorSpec.scala:720)
[info] - perl:a.size *** FAILED ***
[info]   "scalar([@{$self->a()}])" was not equal to "scalar([$self->a()])" (TranslatorSpec.scala:718)
[info]   Analysis:
[info]   "scalar([@{$self->a()}])" -> "scalar([$self->a()])"
...
[info] - perl:"12345".to_i *** FAILED ***
[info]   ""12345"[ + 0]" was not equal to ""12345"[]" (TranslatorSpec.scala:718)
[info]   Analysis:
[info]   ""12345"[ + 0]" -> ""12345"[]"
...
[info] - perl:[].as<u1[]> *** FAILED ***
[info]   "[[]]" was not equal to "[()]" (TranslatorSpec.scala:718)
[info]   Analysis:
[info]   "[[]]" -> "[()]"
...
[info] - perl:[].as<f8[]> *** FAILED ***
[info]   "[[]]" was not equal to "[()]" (TranslatorSpec.scala:718)
[info]   Analysis:
[info]   "[[]]" -> "[()]"
...
[info] - perl:[0, 1, 2].as<u1[]> *** FAILED ***
[info]   "[[0, 1, 2]]" was not equal to "[(0, 1, 2)]" (TranslatorSpec.scala:718)
[info]   Analysis:
[info]   "[[0, 1, 2]]" -> "[(0, 1, 2)]"

Note: I do not known Perl, but those issues seems easy to fix

…eral others

Since 7ff2eda Perl expression translator uses [] instead of ().
Fix tests to reflect that
.first and .last and subscript was implemented initially in c20661a
Copy link
Member

@generalmimon generalmimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @Mingun!

Note: arrays in square brackets [] are indeed correct in Perl, as @dgburr explains in detail in #251 (comment).

@generalmimon generalmimon merged commit d370048 into kaitai-io:master Oct 24, 2023
0 of 3 checks passed
@Mingun Mingun deleted the perl-array-fixes branch October 24, 2023 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants