Skip to content

t/op/try.t: one test fails during deparsing tests #22495

Open
@jkeenan

Description

@jkeenan

In #22488 (comment), @iabyn noted that t/op/try.t was no longer passing when being run through TEST -deparse.

It turns out that the code which is failing has never passed when testing deparsing. It was added this past April in b8caf0c:

commit b8caf0c1f256ef2e52bae4109552667742ab2b2a
Author:     Paul Evans <[email protected]>
AuthorDate: Fri Apr 5 17:26:32 2024 +0000
Commit:     Paul Evans <[email protected]>
CommitDate: Thu Apr 11 16:07:33 2024 +0100

    Remove experimental warnings from basic try/catch syntax
    
    try/catch/finally remains experimental because of questions around
    double-exception

...

diff --git a/t/op/try.t b/t/op/try.t
index 79ee66a171..83d5565d21 100644
--- a/t/op/try.t
+++ b/t/op/try.t
...
+# experimental warnings
+{
+    my $warnings;
+    BEGIN { $SIG{__WARN__} = sub { $warnings .= shift; }; }
+
+    my ($lfinally) = (__LINE__+5);
+    try {
+    }
+    catch ($e) {
+    }
+    finally {
+    }
+
+    is($warnings, "try/catch/finally is experimental at $0 line $lfinally.\n",
+        'compiletime warnings');
+    BEGIN { undef $SIG{__WARN__}; }
+}
+
+no warnings 'experimental::try';
+
$ git checkout b8caf0c1f25; sh ./Configure -des -Dusedevel && make test_prep; cd t; ./TEST -deparse op/try.t; cd -

------------------------------------------------------------------------------
TESTING DEPARSER
------------------------------------------------------------------------------
t/op/try ... # Failed test 23 - compiletime warnings at op/try.t line 276
#      got "try/catch/finally is experimental at op/try.t line 275.\n"
# expected "try/catch/finally is experimental at op/try.t line 273.\n"
#  diff at 53
#    after "ally is experimental at op/try.t line 27"
#     have "5.\n"
#     want "3.\n"
FAILED at test 23
Failed 1 test out of 0, 0.00% okay.
	op/try.t
...

Since I've just begun to get familiar with TEST -deparse, I don't know whether this a bug or a nit. @leonerd, could you take a look? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions