| Server IP : 164.138.27.172 / Your IP : 216.73.216.143 Web Server : nginx/1.27.4 System : Linux cookingdream 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64 User : www-adm ( 1001) PHP Version : 8.3.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /home/jonasn/.cpan/build/YAML-1.30-0/t/ |
Upload File : |
use strict;
use lib -e 't' ? 't' : 'test';
use TestYAML tests => 6;
use YAML ();
use YAML::Dumper;
$YAML::QuoteNumericStrings = 1;
filters { perl => [qw'eval yaml_dump'], };
ok( YAML::Dumper->is_literal_number(1), '1 is a literal number' );
ok( !YAML::Dumper->is_literal_number("1"), '"1" is not a literal number' );
ok( YAML::Dumper->is_literal_number( "1" + 1 ), '"1" +1 is a literal number' );
run_is;
__DATA__
=== Mixed Literal and Stringy ints
+++ perl
+{ foo => '2', baz => 1 }
+++ yaml
---
baz: 1
foo: '2'
=== Mixed Literal and Stringy floats
+++ perl
+{ foo => '2.000', baz => 1.000 }
+++ yaml
---
baz: 1
foo: '2.000'
=== Numeric Keys
+++ perl
+{ 10 => '2.000', 20 => 1.000, '030' => 2.000 }
+++ yaml
---
'030': 2
'10': '2.000'
'20': 1