diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..24b6e3b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*.{pm,pl,t}] +indent_size = 3 diff --git a/Build.PL b/Build.PL index ff12268..c2b031c 100644 --- a/Build.PL +++ b/Build.PL @@ -8,7 +8,7 @@ use XS::Parse::Keyword::Builder; my $build = Module::Build->new( module_name => "Syntax::Keyword::Try", test_requires => { - 'Test::More' => '0.88', # done_testing + 'Test2::V0' => 0, }, configure_requires => { 'Module::Build' => '0.4004', # test_requires diff --git a/Changes b/Changes index e17e9a8..70076cf 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,18 @@ Revision history for Syntax-Keyword-Try +0.29 2023-07-13 + [CHANGES] + * Updates to compile cleanly on perl v5.38 + * Remember to implement `no Syntax::Keyword::Try` to disable the + syntax + * Swap all the unit tests to `Test2::V0` + +0.28 2022-12-08 + [CHANGES] + * Account for the new structure of ->cop_warnings in perl v5.37.6 + * Updated to latest hax/ support files; accounting for newPADxVOP in + latest bleadperl + 0.27 2022-02-22 [CHANGES] * Updates to support Feature::Compat::Try 0.05 with new `finally {}` diff --git a/LICENSE b/LICENSE index 7f7fca7..2404a71 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -This software is copyright (c) 2022 by Paul Evans . +This software is copyright (c) 2023 by Paul Evans . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2022 by Paul Evans . +This software is Copyright (c) 2023 by Paul Evans . This is free software, licensed under: @@ -272,7 +272,7 @@ That's all there is to it! --- The Artistic License 1.0 --- -This software is Copyright (c) 2022 by Paul Evans . +This software is Copyright (c) 2023 by Paul Evans . This is free software, licensed under: diff --git a/MANIFEST b/MANIFEST index 8748c52..f2696cd 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,3 +1,4 @@ +.editorconfig Build.PL Changes hax/newOP_CUSTOM.c.inc @@ -8,7 +9,11 @@ hax/perl-backcompat.c.inc lib/Syntax/Keyword/Try.pm lib/Syntax/Keyword/Try.xs lib/Syntax/Keyword/Try/Deparse.pm +LICENSE MANIFEST This list of files +META.json +META.yml +README t/00use.t t/01trycatch.t t/02tryfinally.t @@ -28,7 +33,3 @@ t/80defer+SKT.t t/90rt123547.t t/90rt125971.t t/99pod.t -README -LICENSE -META.yml -META.json diff --git a/META.json b/META.json index d0d154e..aedac14 100644 --- a/META.json +++ b/META.json @@ -33,18 +33,18 @@ }, "test" : { "requires" : { - "Test::More" : "0.88" + "Test2::V0" : "0" } } }, "provides" : { "Syntax::Keyword::Try" : { "file" : "lib/Syntax/Keyword/Try.pm", - "version" : "0.27" + "version" : "0.29" }, "Syntax::Keyword::Try::Deparse" : { "file" : "lib/Syntax/Keyword/Try/Deparse.pm", - "version" : "0.27" + "version" : "0.29" } }, "release_status" : "stable", @@ -54,6 +54,6 @@ ], "x_IRC" : "irc://irc.perl.org/#io-async" }, - "version" : "0.27", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "0.29", + "x_serialization_backend" : "JSON::PP version 4.07" } diff --git a/META.yml b/META.yml index 59ef11c..afe5f5d 100644 --- a/META.yml +++ b/META.yml @@ -4,7 +4,7 @@ author: - 'Paul Evans ' build_requires: ExtUtils::CBuilder: '0' - Test::More: '0.88' + Test2::V0: '0' configure_requires: Module::Build: '0.4004' XS::Parse::Keyword::Builder: '0.06' @@ -18,15 +18,15 @@ name: Syntax-Keyword-Try provides: Syntax::Keyword::Try: file: lib/Syntax/Keyword/Try.pm - version: '0.27' + version: '0.29' Syntax::Keyword::Try::Deparse: file: lib/Syntax/Keyword/Try/Deparse.pm - version: '0.27' + version: '0.29' requires: XS::Parse::Keyword: '0.06' perl: '5.014' resources: IRC: irc://irc.perl.org/#io-async license: http://dev.perl.org/licenses/ -version: '0.27' +version: '0.29' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/hax/optree-additions.c.inc b/hax/optree-additions.c.inc index 8133785..c04e80e 100644 --- a/hax/optree-additions.c.inc +++ b/hax/optree-additions.c.inc @@ -16,15 +16,6 @@ static OP *S_newAELEMOP(pTHX_ U32 flags, OP *first, I32 key) return newBINOP(OP_AELEM, flags, first, newSVOP(OP_CONST, 0, newSViv(key))); } -#define newPADxVOP(type, padix, flags, private) S_newPADxVOP(aTHX_ type, padix, flags, private) -static OP *S_newPADxVOP(pTHX_ I32 type, PADOFFSET padix, I32 flags, U32 private) -{ - OP *op = newOP(type, flags); - op->op_targ = padix; - op->op_private = private; - return op; -} - #if HAVE_PERL_VERSION(5, 22, 0) # define HAVE_UNOP_AUX #endif @@ -80,3 +71,14 @@ static OP *S_newMETHOD_REDIR_OP(pTHX_ SV *rclass, SV *methname, I32 flags) return op; } + +/* If `@_` is called "snail", then elements of it can be called "slugs"; i.e. + * snails without their container + */ +#define newSLUGOP(idx) S_newSLUGOP(aTHX_ idx) +static OP *S_newSLUGOP(pTHX_ int idx) +{ + OP *op = newGVOP(OP_AELEMFAST, 0, PL_defgv); + op->op_private = idx; + return op; +} diff --git a/hax/perl-additions.c.inc b/hax/perl-additions.c.inc index 5c8d69e..82cc0f2 100644 --- a/hax/perl-additions.c.inc +++ b/hax/perl-additions.c.inc @@ -1,9 +1,5 @@ /* vi: set ft=c : */ -#ifndef av_count -# define av_count(av) (AvFILL(av) + 1) -#endif - #if HAVE_PERL_VERSION(5, 22, 0) # define PadnameIsNULL(pn) (!(pn)) #else @@ -30,16 +26,6 @@ static char *S_save_strndup(pTHX_ char *s, STRLEN l) return ret; } -#define sv_setrv(s, r) S_sv_setrv(aTHX_ s, r) -static void S_sv_setrv(pTHX_ SV *sv, SV *rv) -{ - sv_setiv(sv, (IV)rv); -#if !HAVE_PERL_VERSION(5, 24, 0) - SvIOK_off(sv); -#endif - SvROK_on(sv); -} - static char *PL_savetype_name[] PERL_UNUSED_DECL = { /* These have been present since 5.16 */ [SAVEt_ADELETE] = "ADELETE", @@ -249,15 +235,19 @@ static bool MY_lex_consume_unichar(pTHX_ U32 c) return TRUE; } -#if HAVE_PERL_VERSION(5, 16, 0) - /* TODO: perl 5.14 lacks HvNAMEUTF8, HvNAMELEN, sv_derived_from_pvn */ -# define sv_derived_from_hv(sv, hv) MY_sv_derived_from_hv(aTHX_ sv, hv) -static bool MY_sv_derived_from_hv(pTHX_ SV *sv, HV *hv) +#define av_push_from_av_inc(dst, src) S_av_push_from_av(aTHX_ dst, src, TRUE) +#define av_push_from_av_noinc(dst, src) S_av_push_from_av(aTHX_ dst, src, FALSE) +static void S_av_push_from_av(pTHX_ AV *dst, AV *src, bool refcnt_inc) { - char *hvname = HvNAME(hv); - if(!hvname) - return FALSE; + SSize_t count = av_count(src); + SSize_t i; - return sv_derived_from_pvn(sv, hvname, HvNAMELEN(hv), HvNAMEUTF8(hv) ? SVf_UTF8 : 0); + av_extend(dst, av_count(dst) + count - 1); + + SV **vals = AvARRAY(src); + + for(i = 0; i < count; i++) { + SV *sv = vals[i]; + av_push(dst, refcnt_inc ? SvREFCNT_inc(sv) : sv); + } } -#endif /* HAVE_PERL_VERSION(5, 16, 0) */ diff --git a/hax/perl-backcompat.c.inc b/hax/perl-backcompat.c.inc index 788c7c2..5380102 100644 --- a/hax/perl-backcompat.c.inc +++ b/hax/perl-backcompat.c.inc @@ -23,6 +23,7 @@ typedef AV PADNAMELIST; typedef SV PADNAME; # define PadnamePV(pn) (SvPOKp(pn) ? SvPVX(pn) : NULL) # define PadnameLEN(pn) SvCUR(pn) +# define PadnameIsSTATE(pn) (!!SvPAD_STATE(pn)) # define PadnameOUTER(pn) (SvFAKE(pn) && !SvPAD_STATE(pn)) # define PadnamelistARRAY(pnl) AvARRAY(pnl) # define PadnamelistMAX(pnl) AvFILLp(pnl) @@ -31,6 +32,24 @@ typedef SV PADNAME; # define PadMAX(pad) AvFILLp(pad) #endif +#if !HAVE_PERL_VERSION(5, 22, 0) +# define CvPADLIST_set(cv, padlist) (CvPADLIST(cv) = padlist) +# define newPADNAMEpvn(p,n) S_newPADNAMEpvn(aTHX_ p,n) +static PADNAME *S_newPADNAMEpvn(pTHX_ const char *pv, STRLEN n) +{ + PADNAME *pn = newSVpvn(pv, n); + /* PADNAMEs need to be at least SVt_PVNV in order to store the COP_SEQ_* + * fields */ + sv_upgrade(pn, SVt_PVNV); + return pn; +} +# define PadnameREFCNT_dec(pn) SvREFCNT_dec(pn) +#endif + +#ifndef av_count +# define av_count(av) (AvFILL(av) + 1) +#endif + #ifndef av_top_index # define av_top_index(av) AvFILL(av) #endif @@ -43,6 +62,10 @@ typedef SV PADNAME; # define block_start(a) Perl_block_start(aTHX_ a) #endif +#ifndef cophh_exists_pvs +# define cophh_exists_pvs(a,b,c) cBOOL(cophh_fetch_pvs(a,b,c)) +#endif + #ifndef cv_clone # define cv_clone(a) Perl_cv_clone(aTHX_ a) #endif @@ -69,6 +92,10 @@ typedef SV PADNAME; # define OpSIBLING(op) ((op)->op_sibling) #endif +#ifndef OpHAS_SIBLING +# define OpHAS_SIBLING(op) (cBOOL(OpSIBLING(op))) +#endif + #ifndef OpMORESIB_set # define OpMORESIB_set(op,sib) ((op)->op_sibling = (sib)) #endif @@ -123,7 +150,7 @@ static OP *S_op_convert_list(pTHX_ I32 type, I32 flags, OP *o) /* On Perl 5.14 this had a different name */ #ifndef pad_add_name_pvn #define pad_add_name_pvn(name, len, flags, typestash, ourstash) MY_pad_add_name(aTHX_ name, len, flags, typestash, ourstash) -PADOFFSET MY_pad_add_name(pTHX_ const char *name, STRLEN len, U32 flags, HV *typestash, HV *ourstash) +static PADOFFSET MY_pad_add_name(pTHX_ const char *name, STRLEN len, U32 flags, HV *typestash, HV *ourstash) { /* perl 5.14's Perl_pad_add_name requires a NUL-terminated name */ SV *namesv = sv_2mortal(newSVpvn(name, len)); @@ -136,3 +163,60 @@ PADOFFSET MY_pad_add_name(pTHX_ const char *name, STRLEN len, U32 flags, HV *typ # define isIDFIRST_utf8_safe(s, e) (PERL_UNUSED_ARG(e), isIDFIRST_utf8(s)) # define isIDCONT_utf8_safe(s, e) (PERL_UNUSED_ARG(e), isIDCONT_utf8(s)) #endif + +#ifndef CXp_EVALBLOCK +/* before perl 5.34 this was called CXp_TRYBLOCK */ +# define CXp_EVALBLOCK CXp_TRYBLOCK +#endif + +#if !HAVE_PERL_VERSION(5, 26, 0) +# define sv_set_undef(sv) sv_setsv(sv, &PL_sv_undef) +#endif + +#ifndef newAVav +# define newAVav(av) S_newAVav(aTHX_ av) +static AV *S_newAVav(pTHX_ AV *av) +{ + AV *ret = newAV(); + U32 count = av_count(av); + U32 i; + for(i = 0; i < count; i++) + av_push(ret, newSVsv(AvARRAY(av)[i])); + return ret; +} +#endif + +#if !defined(sv_derived_from_hv) && HAVE_PERL_VERSION(5, 16, 0) +# define sv_derived_from_hv(sv, hv) MY_sv_derived_from_hv(aTHX_ sv, hv) +static bool MY_sv_derived_from_hv(pTHX_ SV *sv, HV *hv) +{ + char *hvname = HvNAME(hv); + if(!hvname) + return FALSE; + + return sv_derived_from_pvn(sv, hvname, HvNAMELEN(hv), HvNAMEUTF8(hv) ? SVf_UTF8 : 0); +} +#endif + +#ifndef xV_FROM_REF +# ifdef PERL_USE_GCC_BRACE_GROUPS +# define xV_FROM_REF(XV, ref) \ + ({ SV *_ref = ref; assert(SvROK(_ref)); assert(SvTYPE(SvRV(_ref)) == SVt_PV ## XV); (XV *)(SvRV(_ref)); }) +# else +# define xV_FROM_REF(XV, ref) ((XV *)SvRV(ref)) +# endif + +# define AV_FROM_REF(ref) xV_FROM_REF(AV, ref) +# define CV_FROM_REF(ref) xV_FROM_REF(CV, ref) +# define HV_FROM_REF(ref) xV_FROM_REF(HV, ref) +#endif + +#ifndef newPADxVOP +# define newPADxVOP(type, flags, padix) S_newPADxVOP(aTHX_ type, flags, padix) +static OP *S_newPADxVOP(pTHX_ I32 type, I32 flags, PADOFFSET padix) +{ + OP *op = newOP(type, flags); + op->op_targ = padix; + return op; +} +#endif diff --git a/lib/Syntax/Keyword/Try.pm b/lib/Syntax/Keyword/Try.pm index 69ae7e0..27b5cea 100644 --- a/lib/Syntax/Keyword/Try.pm +++ b/lib/Syntax/Keyword/Try.pm @@ -1,9 +1,9 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2016-2022 -- leonerd@leonerd.org.uk +# (C) Paul Evans, 2016-2023 -- leonerd@leonerd.org.uk -package Syntax::Keyword::Try 0.27; +package Syntax::Keyword::Try 0.29; use v5.14; use warnings; @@ -353,38 +353,49 @@ L. sub import { - my $class = shift; + my $pkg = shift; my $caller = caller; - $class->import_into( $caller, @_ ); + $pkg->import_into( $caller, @_ ); +} + +sub unimport +{ + my $pkg = shift; + my $caller = caller; + + $pkg->unimport_into( $caller, @_ ); } my @EXPERIMENTAL = qw( typed ); -sub import_into +sub import_into { shift->apply( sub { $^H{ $_[0] }++ }, @_ ) } +sub unimport_into { shift->apply( sub { delete $^H{ $_[0] } }, @_ ) } + +sub apply { - my $class = shift; - my ( $caller, @syms ) = @_; + my $pkg = shift; + my ( $cb, $caller, @syms ) = @_; @syms or @syms = qw( try ); my %syms = map { $_ => 1 } @syms; - $^H{"Syntax::Keyword::Try/try"}++ if delete $syms{try}; + $cb->( "Syntax::Keyword::Try/try" ) if delete $syms{try}; # Largely for Feature::Compat::Try's benefit - $^H{"Syntax::Keyword::Try/no_finally"}++ if delete $syms{"-no_finally"}; - $^H{"Syntax::Keyword::Try/require_catch"}++ if delete $syms{"-require_catch"}; - $^H{"Syntax::Keyword::Try/require_var"}++ if delete $syms{"-require_var"}; + $cb->( "Syntax::Keyword::Try/no_finally" ) if delete $syms{"-no_finally"}; + $cb->( "Syntax::Keyword::Try/require_catch" ) if delete $syms{"-require_catch"}; + $cb->( "Syntax::Keyword::Try/require_var" ) if delete $syms{"-require_var"}; # stablised experiments delete $syms{":experimental($_)"} for qw( var ); foreach ( @EXPERIMENTAL ) { - $^H{"Syntax::Keyword::Try/experimental($_)"}++ if delete $syms{":experimental($_)"}; + $cb->( "Syntax::Keyword::Try/experimental($_)" ) if delete $syms{":experimental($_)"}; } if( delete $syms{":experimental"} ) { - $^H{"Syntax::Keyword::Try/experimental($_)"}++ for @EXPERIMENTAL; + $cb->( "Syntax::Keyword::Try/experimental($_)" ) for @EXPERIMENTAL; } # Ignore requests for these, as they come automatically with `try` diff --git a/lib/Syntax/Keyword/Try.xs b/lib/Syntax/Keyword/Try.xs index c3430f2..a04fdab 100644 --- a/lib/Syntax/Keyword/Try.xs +++ b/lib/Syntax/Keyword/Try.xs @@ -179,7 +179,16 @@ static OP *MY_newLOCALISEOP(pTHX_ GV *gv) static OP *MY_newSTATEOP_nowarnings(pTHX) { OP *op = newSTATEOP(0, NULL, NULL); +#if HAVE_PERL_VERSION(5,37,6) + /* cop_warnings no longer has the weird STRLEN prefix on it + * https://github.com/Perl/perl5/pull/20469 + */ + char *warnings = ((COP *)op)->cop_warnings; +# define WARNING_BITS warnings +#else STRLEN *warnings = ((COP *)op)->cop_warnings; +# define WARNING_BITS (char *)(warnings + 1) +#endif char *warning_bits; if(warnings == pWARN_NONE) @@ -191,15 +200,17 @@ static OP *MY_newSTATEOP_nowarnings(pTHX) else if(warnings == pWARN_ALL) warning_bits = WARN_ALLstring; else - warning_bits = (char *)(warnings + 1); + warning_bits = WARNING_BITS; warnings = Perl_new_warnings_bitfield(aTHX_ warnings, warning_bits, WARNsize); ((COP *)op)->cop_warnings = warnings; - warning_bits = (char *)(warnings + 1); + warning_bits = WARNING_BITS; warning_bits[(2*WARN_EXITING) / 8] &= ~(1 << (2*WARN_EXITING % 8)); return op; + +#undef WARNING_BITS } static void rethread_op(OP *op, OP *old, OP *new) @@ -437,14 +448,14 @@ static int build_try(pTHX_ OP **out, XSParseKeywordPiece *args[], size_t nargs, OP *type = args[argi++]->op; #ifdef HAVE_OP_ISA condop = newBINOP(OP_ISA, 0, - newPADxVOP(OP_PADSV, catchvar, 0, 0), type); + newPADxVOP(OP_PADSV, 0, catchvar), type); #else /* Allow a bareword on RHS of `isa` */ if(type->op_type == OP_CONST) type->op_private &= ~(OPpCONST_BARE|OPpCONST_STRICT); condop = newBINOP_CUSTOM(&pp_isa, 0, - newPADxVOP(OP_PADSV, catchvar, 0, 0), type); + newPADxVOP(OP_PADSV, 0, catchvar), type); #endif break; } @@ -460,7 +471,7 @@ static int build_try(pTHX_ OP **out, XSParseKeywordPiece *args[], size_t nargs, regexp->op_targ = catchvar; #else /* Older perls need a stacked OP_PADSV op */ - cPMOPx(regexp)->op_first = newPADxVOP(OP_PADSV, catchvar, 0, 0); + cPMOPx(regexp)->op_first = newPADxVOP(OP_PADSV, 0, catchvar); regexp->op_flags |= OPf_KIDS|OPf_STACKED; #endif condop = regexp; @@ -492,7 +503,7 @@ static int build_try(pTHX_ OP **out, XSParseKeywordPiece *args[], size_t nargs, if(catchvar) { /* my $var = $@ */ assignop = newBINOP(OP_SASSIGN, 0, - newGVOP(OP_GVSV, 0, PL_errgv), newPADxVOP(OP_PADSV, catchvar, OPf_MOD, OPpLVAL_INTRO)); + newGVOP(OP_GVSV, 0, PL_errgv), newPADxVOP(OP_PADSV, OPf_MOD | OPpLVAL_INTRO << 8, catchvar)); } if(condop) { diff --git a/lib/Syntax/Keyword/Try/Deparse.pm b/lib/Syntax/Keyword/Try/Deparse.pm index d3daabb..f92571d 100644 --- a/lib/Syntax/Keyword/Try/Deparse.pm +++ b/lib/Syntax/Keyword/Try/Deparse.pm @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2021 -- leonerd@leonerd.org.uk -package Syntax::Keyword::Try::Deparse 0.27; +package Syntax::Keyword::Try::Deparse 0.29; use v5.14; use warnings; diff --git a/t/00use.t b/t/00use.t index 74a7da6..1e97a65 100644 --- a/t/00use.t +++ b/t/00use.t @@ -3,8 +3,9 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; -use_ok( "Syntax::Keyword::Try" ); +require Syntax::Keyword::Try; +pass( "Modules loaded" ); done_testing; diff --git a/t/01trycatch.t b/t/01trycatch.t index 1b92efc..12d90df 100644 --- a/t/01trycatch.t +++ b/t/01trycatch.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; @@ -120,4 +120,12 @@ use Syntax::Keyword::Try; ok( $destroyed, 'catch ($var) does not retain value' ); } +{ + no Syntax::Keyword::Try; + + sub try { return "normal function" } + + is( try, "normal function", 'try() parses as a normal function call' ); +} + done_testing; diff --git a/t/02tryfinally.t b/t/02tryfinally.t index f46aaeb..3090ff0 100644 --- a/t/02tryfinally.t +++ b/t/02tryfinally.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/03trycatchfinally.t b/t/03trycatchfinally.t index 71597be..a65ce78 100644 --- a/t/03trycatchfinally.t +++ b/t/03trycatchfinally.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/04catch-types.t b/t/04catch-types.t index 14378ce..ba56c9d 100644 --- a/t/04catch-types.t +++ b/t/04catch-types.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try qw( try :experimental ); diff --git a/t/10snail.t b/t/10snail.t index 9d87842..4c9350a 100644 --- a/t/10snail.t +++ b/t/10snail.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; @@ -15,7 +15,7 @@ use Syntax::Keyword::Try; catch ($e) {} } )->( 1, 2, 3 ); - is_deeply( \@args, [ 1, 2, 3 ], 'try{} sees surrounding @_' ); + is( \@args, [ 1, 2, 3 ], 'try{} sees surrounding @_' ); } # catch sees @_ @@ -26,7 +26,7 @@ use Syntax::Keyword::Try; catch ($e) { @args = @_ } } )->( 4, 5, 6 ); - is_deeply( \@args, [ 4, 5, 6 ], 'catch{} sees @_' ); + is( \@args, [ 4, 5, 6 ], 'catch{} sees @_' ); } done_testing; diff --git a/t/11loop.t b/t/11loop.t index c89315f..7dd1370 100644 --- a/t/11loop.t +++ b/t/11loop.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/12return.t b/t/12return.t index e14db63..bca787b 100644 --- a/t/12return.t +++ b/t/12return.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; @@ -33,7 +33,7 @@ use Syntax::Keyword::Try; # return LIST from try { - is_deeply( + is( [ sub { try { return qw( A B C ) } catch ($e) {} }->() ], diff --git a/t/13die-in-finally.t b/t/13die-in-finally.t index 6cf46a9..f3f8701 100644 --- a/t/13die-in-finally.t +++ b/t/13die-in-finally.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/14try-localises.t b/t/14try-localises.t index 765fd7e..c60212a 100644 --- a/t/14try-localises.t +++ b/t/14try-localises.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/15context.t b/t/15context.t index b97f6ad..80a1a40 100644 --- a/t/15context.t +++ b/t/15context.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/16final-expr.t b/t/16final-expr.t index 8a63071..e419cac 100644 --- a/t/16final-expr.t +++ b/t/16final-expr.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; @@ -19,7 +19,7 @@ use Syntax::Keyword::Try; try { 1, 2, 3 } catch ($e) { 4, 5, 6 } }; - is_deeply(\@list, [1, 2, 3], 'do { try } in list context'); + is(\@list, [1, 2, 3], 'do { try } in list context'); } # catch as final expression yields correct value @@ -34,7 +34,7 @@ use Syntax::Keyword::Try; try { die "Oops" } catch ($e) { 4, 5, 6 } }; - is_deeply(\@list, [4, 5, 6], 'do { try/catch } in list context'); + is(\@list, [4, 5, 6], 'do { try/catch } in list context'); $scalar = do { try { die "Oops" } diff --git a/t/30compat.t b/t/30compat.t index d8f1e82..aad148c 100644 --- a/t/30compat.t +++ b/t/30compat.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; diff --git a/t/70deparse.t b/t/70deparse.t index 5fc0ab9..d85d33e 100644 --- a/t/70deparse.t +++ b/t/70deparse.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; use Syntax::Keyword::Try::Deparse; diff --git a/t/80await+SKT.t b/t/80await+SKT.t index 9718cf0..d199280 100644 --- a/t/80await+SKT.t +++ b/t/80await+SKT.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; BEGIN { plan skip_all => "Future is not available" diff --git a/t/80defer+SKT.t b/t/80defer+SKT.t index 6fc9e36..2f939e4 100644 --- a/t/80defer+SKT.t +++ b/t/80defer+SKT.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; BEGIN { plan skip_all => "Syntax::Keyword::Defer >= 0.02 is not available" diff --git a/t/90rt123547.t b/t/90rt123547.t index dae78cb..906e787 100644 --- a/t/90rt123547.t +++ b/t/90rt123547.t @@ -3,7 +3,8 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; +use Test2::IPC; # RT123547 observes that if S:K:T is loaded late after multiple threads # are actually started, it will crash diff --git a/t/90rt125971.t b/t/90rt125971.t index ec09019..9dba30e 100644 --- a/t/90rt125971.t +++ b/t/90rt125971.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; use Syntax::Keyword::Try; @@ -31,7 +31,7 @@ sub outer return @result; } -is_deeply [ outer() ], [ 1, 123 ], "No extra data in return"; +is [ outer() ], [ 1, 123 ], "No extra data in return"; done_testing; diff --git a/t/99pod.t b/t/99pod.t index d1972ce..c70eec2 100644 --- a/t/99pod.t +++ b/t/99pod.t @@ -3,7 +3,7 @@ use v5.14; use warnings; -use Test::More; +use Test2::V0; eval "use Test::Pod 1.00"; plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;