⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.67
Server IP:
50.6.168.112
Server:
Linux server-617809.webnetzimbabwe.com 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.4.10
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
.cpan
/
build
/
JSON-4.10-0
/
t
/
View File Name :
22_comment_at_eof.t
# copied over from JSON::XS and modified to use JSON # the original test case was provided by IKEGAMI@cpan.org use strict; use warnings; use Test::More tests => 13; BEGIN { $ENV{PERL_JSON_BACKEND} ||= "JSON::backportPP"; } use JSON; use Data::Dumper qw( Dumper ); sub decoder { my ($str) = @_; my $json = JSON->new->relaxed; $json->incr_parse($_[0]); my $rv; if (!eval { $rv = $json->incr_parse(); 1 }) { $rv = "died with $@"; } local $Data::Dumper::Useqq = 1; local $Data::Dumper::Terse = 1; local $Data::Dumper::Indent = 0; return Dumper($rv); } is( decoder( "[]" ), '[]', 'array baseline' ); is( decoder( " []" ), '[]', 'space ignored before array' ); is( decoder( "\n[]" ), '[]', 'newline ignored before array' ); is( decoder( "# foo\n[]" ), '[]', 'comment ignored before array' ); is( decoder( "# fo[o\n[]"), '[]', 'comment ignored before array' ); is( decoder( "# fo]o\n[]"), '[]', 'comment ignored before array' ); is( decoder( "[# fo]o\n]"), '[]', 'comment ignored inside array' ); is( decoder( "" ), 'undef', 'eof baseline' ); is( decoder( " " ), 'undef', 'space ignored before eof' ); is( decoder( "\n" ), 'undef', 'newline ignored before eof' ); is( decoder( "#,foo\n" ), 'undef', 'comment ignored before eof' ); is( decoder( "# []o\n" ), 'undef', 'comment ignored before eof' ); is( decoder(qq/#\n[#foo\n"#\\n"#\n]/), '["#\n"]', 'array and string in multiple lines' );