The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

#!/usr/bin/perl
use strict;
BEGIN { $ENV{PERL_BSON_BACKEND} = "" }
BEGIN { $INC{"BSON/XS.pm"} = undef }
if ( eval("use Test::Exception; 1") ) {
plan tests => 2;
}
else {
plan skip_all => 'No Test::Exception installed'
}
use BSON qw/encode decode/;
dies_ok( sub{ decode("something") }, "Incorrect BSON");
dies_ok( sub{ decode("\5\0\0\0 1234\0") }, "Unsupported type" )