Config-JSON-Enhanced

 view release on metacpan or  search on metacpan

t/130-config2perl-remove-comments-from-strings.t  view on Meta::CPAN

#!perl

use 5.010;
use strict;
use warnings;

use Test::More;
use File::Temp qw/tempfile/;
use Test2::Plugin::UTF8; # rids of the Wide Character in TAP message!
use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;

our $VERSION = '0.10';

use Config::JSON::Enhanced;

# check if we can deal with comments
my $jsonstr_C = <<'EOJ';
{
/* gone1 */ "/*comment1*/κατούρ/*comment2*/" /*gone2*/: /* gone 


3  */{ /* gone */
	"φονο/*comment1*/κατούρ/*comment2*/" : /* gone10 */ 12,
  /*abcb*//* gone
 more
	*/"φονο/*comment1*/κατούρ/*comment2*/2" : /* gone10 */ [12,/*gone 15*/13 /* goneind 
13 */
	]
     }
}
EOJ

my $jsonstr_CPP = <<'EOJ';
{
// gone1 */
  "/*comment1*/κατούρ/*comment2*/" : // gone
    { // gone
	"φονο/*comment1*/κατούρ/*comment2*/" : 12, // gone10
  // abcd gone
	"φονο/*comment1*/κατούρ/*comment2*/2" : [12,13 // gone
	]
     }
}
EOJ

my $jsonstr_mixed = <<EOJ;
{
	"C" : ${jsonstr_C},
	"CPP" : ${jsonstr_CPP}
}
EOJ

# data for verbatim sections, same as above but with verbatim
my $jsonstr_C_verbatim = <<'EOJ';
{
/* gone1 */ "/*comment1*/κατούρ/*comment2*/" /*gone2*/: /* gone 


3  */{ /* gone */
	"φονο/*comment1*/κατούρ/*comment2*/" : /* gone10 */ 12,
  /*abcb*//* gone
 more
	*/"φονο/*comment1*/κατούρ/*comment2*/2" : /* gone10 */ [12,/*gone 15*/13 /* goneind 
13 */
	]
     },
     "αούρ" :  {
                "script" : ["/usr/bin/bash",
/* verbatim sections: will be quoted in " " and remove all newlines
  (optionally followed by spaces) and substituted with a single '\n'   



( run in 0.922 second using v1.01-cache-2.11-cpan-39bf76dae61 )