PATH=/usr/bin:/bin Start 2019-03-15T02:00:24 ActivePerl-2400 CPAN-2.10 Reading '/data/fly2400/cpanfly-5.24/var/cpan/Metadata' Database was generated on Thu, 14 Mar 2019 05:41:03 GMT Checksum for /data/fly2400/cpanfly-5.24/var/cpan/sources/authors/id/P/PR/PRBRENAN/Data-Edit-Xml-20190314.tar.gz ok Data-Edit-Xml-20190314 Data-Edit-Xml-20190314/Build.PL Data-Edit-Xml-20190314/MANIFEST Data-Edit-Xml-20190314/META.json Data-Edit-Xml-20190314/META.yml Data-Edit-Xml-20190314/test.pl Data-Edit-Xml-20190314/lib Data-Edit-Xml-20190314/lib/Data Data-Edit-Xml-20190314/lib/Data/Edit Data-Edit-Xml-20190314/lib/Data/Edit/Xml.pm Configuring P/PR/PRBRENAN/Data-Edit-Xml-20190314.tar.gz with Build.PL >>> /data/fly2400/ap2400-300558/bin/perl-static Build.PL Checking prerequisites... requires: ! Data::Table::Text (20190204) is installed, but we need version >= 20190314 ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions of the modules indicated above before proceeding with this installation Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'Data-Edit-Xml' version '20190314' PRBRENAN/Data-Edit-Xml-20190314.tar.gz /data/fly2400/ap2400-300558/bin/perl-static Build.PL -- OK Running Build for P/PR/PRBRENAN/Data-Edit-Xml-20190314.tar.gz ---- Unsatisfied dependencies detected during ---- ---- PRBRENAN/Data-Edit-Xml-20190314.tar.gz ---- Data::Table::Text [requires] Running test for module 'Data::Table::Text' Checksum for /data/fly2400/cpanfly-5.24/var/cpan/sources/authors/id/P/PR/PRBRENAN/Data-Table-Text-20190314.tar.gz ok Data-Table-Text-20190314 Data-Table-Text-20190314/Build.PL Data-Table-Text-20190314/MANIFEST Data-Table-Text-20190314/META.json Data-Table-Text-20190314/META.yml Data-Table-Text-20190314/test.pl Data-Table-Text-20190314/lib Data-Table-Text-20190314/lib/Data Data-Table-Text-20190314/lib/Data/Table Data-Table-Text-20190314/lib/Data/Table/Text.pm Configuring P/PR/PRBRENAN/Data-Table-Text-20190314.tar.gz with Build.PL >>> /data/fly2400/ap2400-300558/bin/perl-static Build.PL Created MYMETA.yml and MYMETA.json Creating new 'Build' script for 'Data-Table-Text' version '20190314' PRBRENAN/Data-Table-Text-20190314.tar.gz /data/fly2400/ap2400-300558/bin/perl-static Build.PL -- OK Running Build for P/PR/PRBRENAN/Data-Table-Text-20190314.tar.gz >>> ./Build Building Data-Table-Text PRBRENAN/Data-Table-Text-20190314.tar.gz ./Build -- OK Running Build test >>> ./Build test verbose=1 test.pl .. 1..518 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8 ok 9 ok 10 ok 11 ok 12 ok 13 ok 14 ok 15 ok 16 ok 17 ok 18 ok 19 ok 20 ok 21 ok 22 ok 23 ok 24 ok 25 ok 26 ok 27 ok 28 ok 29 ok 30 ok 31 ok 32 ok 33 ok 34 ok 35 ok 36 ok 37 ok 38 ok 39 ok 40 ok 41 ok 42 ok 43 ok 44 ok 45 ok 46 ok 47 ok 48 ok 49 ok 50 ok 51 ok 52 ok 53 ok 54 ok 55 ok 56 ok 57 ok 58 ok 59 ok 60 ok 61 ok 62 ok 63 ok 64 ok 65 ok 66 ok 67 ok 68 ok 69 ok 70 ok 71 ok 72 ok 73 ok 74 ok 75 ok 76 ok 77 ok 78 ok 79 ok 80 ok 81 ok 82 ok 83 ok 84 ok 85 ok 86 ok 87 ok 88 ok 89 ok 90 ok 91 ok 92 ok 93 ok 94 ok 95 ok 96 ok 97 ok 98 ok 99 ok 100 ok 101 ok 102 ok 103 ok 104 ok 105 ok 106 ok 107 ok 108 ok 109 ok 110 ok 111 ok 112 ok 113 ok 114 ok 115 ok 116 ok 117 ok 118 ok 119 ok 120 ok 121 ok 122 ok 123 ok 124 ok 125 ok 126 ok 127 ok 128 ok 129 ok 130 # skip Takes too much time ok 131 # skip Takes too much time ok 132 # skip Takes too much time ok 133 # skip Takes too much time ok 134 # skip Takes too much time ok 135 # skip Takes too much time ok 136 # skip Takes too much time ok 137 # skip Takes too much time ok 138 # skip Takes too much time ok 139 # skip Takes too much time ok 140 # skip Takes too much time ok 141 ok 142 ok 143 ok 144 ok 145 ok 146 ok 147 ok 148 ok 149 ok 150 ok 151 ok 152 ok 153 ok 154 ok 155 ok 156 ok 157 ok 158 ok 159 ok 160 ok 161 ok 162 ok 163 ok 164 ok 165 ok 166 ok 167 ok 168 ok 169 ok 170 ok 171 ok 172 ok 173 ok 174 ok 175 ok 176 ok 177 ok 178 ok 179 ok 180 ok 181 ok 182 ok 183 ok 184 ok 185 ok 186 ok 187 ok 188 ok 189 ok 190 ok 191 ok 192 ok 193 ok 194 ok 195 ok 196 ok 197 ok 198 ok 199 ok 200 ok 201 ok 202 ok 203 ok 204 ok 205 ok 206 ok 207 ok 208 ok 209 ok 210 ok 211 ok 212 ok 213 ok 214 ok 215 ok 216 ok 217 ok 218 ok 219 ok 220 ok 221 ok 222 ok 223 ok 224 ok 225 ok 226 ok 227 ok 228 ok 229 ok 230 ok 231 ok 232 ok 233 ok 234 ok 235 ok 236 ok 237 ok 238 ok 239 ok 240 ok 241 ok 242 ok 243 ok 244 ok 245 ok 246 ok 247 ok 248 ok 249 ok 250 ok 251 ok 252 ok 253 ok 254 ok 255 ok 256 ok 257 ok 258 ok 259 ok 260 ok 261 ok 262 ok 263 ok 264 ok 265 ok 266 ok 267 ok 268 ok 269 ok 270 ok 271 ok 272 ok 273 ok 274 ok 275 ok 276 ok 277 ok 278 ok 279 ok 280 ok 281 ok 282 ok 283 ok 284 ok 285 ok 286 ok 287 ok 288 ok 289 ok 290 ok 291 ok 292 ok 293 ok 294 ok 295 ok 296 ok 297 ok 298 ok 299 ok 300 ok 301 ok 302 ok 303 ok 304 ok 305 ok 306 ok 307 ok 308 ok 309 ok 310 ok 311 ok 312 ok 313 ok 314 ok 315 ok 316 ok 317 ok 318 ok 319 ok 320 - ok 321 ok 322 ok 323 ok 324 ok 325 ok 326 ok 327 ok 328 ok 329 ok 330 ok 331 ok 332 ok 333 ok 334 ok 335 ok 336 ok 337 ok 338 ok 339 ok 340 ok 341 ok 342 ok 343 ok 344 ok 345 ok 346 ok 347 ok 348 ok 349 ok 350 ok 351 ok 352 ok 353 ok 354 ok 355 ok 356 ok 357 ok 358 ok 359 ok 360 ok 361 ok 362 ok 363 ok 364 ok 365 ok 366 ok 367 ok 368 ok 369 ok 370 ok 371 ok 372 ok 373 ok 374 ok 375 ok 376 ok 377 ok 378 ok 379 ok 380 ok 381 ok 382 ok 383 ok 384 ok 385 ok 386 ok 387 ok 388 ok 389 ok 390 ok 391 ok 392 ok 393 ok 394 ok 395 ok 396 ok 397 ok 398 ok 399 ok 400 ok 401 ok 402 ok 403 ok 404 ok 405 ok 406 ok 407 ok 408 ok 409 ok 410 ok 411 ok 412 ok 413 ok 414 ok 415 ok 416 ok 417 ok 418 ok 419 ok 420 ok 421 ok 422 ok 423 ok 424 ok 425 ok 426 ok 427 ok 428 ok 429 ok 430 ok 431 ok 432 ok 433 ok 434 ok 435 ok 436 ok 437 ok 438 ok 439 ok 440 ok 441 ok 442 ok 443 ok 444 ok 445 ok 446 ok 447 ok 448 ok 449 ok 450 ok 451 ok 452 ok 453 ok 454 ok 455 ok 456 ok 457 ok 458 ok 459 ok 460 ok 461 ok 462 ok 463 ok 464 ok 465 ok 466 ok 467 ok 468 ok 469 ok 470 ok 471 ok 472 ok 473 ok 474 ok 475 ok 476 ok 477 ok 478 ok 479 ok 480 ok 481 ok 482 ok 483 ok 484 ok 485 ok 486 ok 487 ok 488 ok 489 ok 490 ok 491 ok 492 ok 493 ok 494 ok 495 ok 496 ok 497 ok 498 ok 499 ok 500 ok 501 ok 502 ok 503 ok 504 ok 505 ok 506 ok 507 ok 508 ok 509 ok 510 ok 511 ok 512 ok 513 ok 514 ok 515 ok 516 ok 517 ok 518 ok All tests successful. Files=1, Tests=518, 3 wallclock secs ( 0.06 usr 0.01 sys + 0.83 cusr 1.31 csys = 2.21 CPU) Result: PASS PRBRENAN/Data-Table-Text-20190314.tar.gz ./Build test verbose=1 -- OK Philip R Brenan <philiprbrenan@gmail.com> Write data in tabular text format >>> (cd /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Table-Text-20190314-xw0FTq && tar cvf - Data-Table-Text-20190314.ppd blib) | gzip -c >/data/fly2400/cpanfly-5.24/var/REPO/P/PR/PRBRENAN/Data-Table-Text-20190314.tar.gz Data-Table-Text-20190314.ppd blib/ blib/lib/ blib/lib/Data/ blib/lib/Data/Table/ blib/lib/Data/Table/Text.pm PRBRENAN/Data-Edit-Xml-20190314.tar.gz Has already been unwrapped into directory /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Edit-Xml-20190314-gP2rqa PRBRENAN/Data-Edit-Xml-20190314.tar.gz Has already been prepared Running Build for P/PR/PRBRENAN/Data-Edit-Xml-20190314.tar.gz Prepending /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Table-Text-20190314-xw0FTq/blib/arch /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Table-Text-20190314-xw0FTq/blib/lib to PERL5LIB for 'make' >>> ./Build Building Data-Edit-Xml PRBRENAN/Data-Edit-Xml-20190314.tar.gz ./Build -- OK Prepending /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Table-Text-20190314-xw0FTq/blib/arch /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Table-Text-20190314-xw0FTq/blib/lib to PERL5LIB for 'test' Running Build test >>> ./Build test verbose=1 Include: /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Edit-Xml-20190314-gP2rqa/in1/a.xml Include: /data/fly2400/cpanfly-5.24/var/tmp/cpan_build/Data-Edit-Xml-20190314-gP2rqa/in2/b.xml Cannot make path: /home/phil/z/z/z at /data/fly2400/cpanfly-5.24/var/megalib/Data/Table/Text.pm line 798. Data::Table::Text::makePath("/home/phil/z/z/z/out.xml") called at /data/fly2400/cpanfly-5.24/var/megalib/Data/Table/Text.pm line 807 Data::Table::Text::overWriteFile("/home/phil/z/z/z/out.xml", "\x{a} \x{a} <taskbody>\x{a} <context>\x{a} <p"...) called at (eval 101) line 6246 eval 'use Test::More tests=>1137; use warnings FATAL=>qw(all); use strict; use Data::Table::Text qw(:all); use Time::HiRes qw(time); use Carp qw(confess); my $windows = $^O =~ m(MSWin32)is; my $mac = $^O =~ m(darwin)is; Test::More->builder->output("/dev/null") # Show only errors during testing if ((caller(1))[0]//\'Data::Edit::Xml\') eq "Data::Edit::Xml"; my $startTime = time; sub sample1{my $x = Data::Edit::Xml::new(); $x->input = <<END; $x->parse} # Sample test XML <foo start="yes"> <head id="a" key="aaa bbb" start="123">Hello <em>there</em> </head> <bar>Howdy <ref/> </bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b> </head> <tail> <foot id="11"/> <middle id="mm"/> <foot id="22"/> </tail> </foo> END if (1) {my $x = Data::Edit::Xml::new; #Tparse $x->inputString = <<END; #Tparse <a id="aa"><b id="bb"><c id="cc"/></b></a> END $x->parse; #Tparse ok -p $x eq <<END; #Tparse <a id="aa"> <b id="bb"> <c id="cc"/> </b> </a> END } sub sample2 {my $x = Data::Edit::Xml::new; #TinputString $x->inputString = <<END; #TinputString <a id="aa"><b id="bb"><c id="cc"/></b></a> END $x->parse; #TinputString } if (1) # Parse and string {my $x = sample1; if (my $s = $x->string) {ok $s eq trim(<<END); <foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><foot id="11"/><middle id="mm"/><foot id="22"/></tail></foo> END # ok nn($x->prettyString) eq \'<foo start="yes">N <head id="a" key="aaa bbb" start="123">HelloN N <em>thereN </em>N </head>N <bar>HowdyN N <ref/>N </bar>NdoNdooN N <head id="A" key="AAAA BBBB" start="123">HHHHelloN N <b>to youN </b>N </head>N <tail>N <foot id="11"/>N <middle id="mm"/>N <foot id="22"/>N </tail>N</foo>N\'; ok nn($x->stringContent) eq \'<head id="a" key="aaa bbb" start="123">HelloN <em>there</em></head><bar>HowdyN <ref/></bar>doNdooN <head id="A" key="AAAA BBBB" start="123">HHHHelloN <b>to you</b></head><tail><foot id="11"/><middle id="mm"/><foot id="22"/></tail>\'; ok $x->attr(qq(start)) eq "yes"; $x->id = 11; ok $x->id == 11; $x->deleteAttr(qq(id)); ok !$x->id; ok join(\' \', $x->go(qw(head))->attrs(qw(id start))) eq "a 123"; # ok nn($x->prettyStringContent) eq \'<head id="a" key="aaa bbb" start="123">HelloN N <em>thereN </em>N</head>N<bar>HowdyN N <ref/>N</bar>NdoNdooN N<head id="A" key="AAAA BBBB" start="123">HHHHelloN N <b>to youN </b>N</head>N<tail>N <foot id="11"/>N <middle id="mm"/>N <foot id="22"/>N</tail>N\'; ok $x->countTags == 17; ok $x->go(qw(head 1))->countTags == 4; } if (1) # Conditions {my $m = $x->go(qw(tail middle)); $m->addConditions(qw(middle MIDDLE)); # Add ok join(\' \', $m->listConditions) eq \'MIDDLE middle\'; # List $m->deleteConditions(qw(MIDDLE)); # Remove ok join(\'\', $m->listConditions) eq \'middle\'; $_->addConditions(qw(foot)) for $x->go(qw(tail foot *)); ok $x->stringWithConditions(qw(middle)) eq trim(<<END); <foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><middle id="mm"/></tail></foo> END ok $x->stringWithConditions(qw(foot)) eq trim(<<END); <foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><foot id="11"/><foot id="22"/></tail></foo> END ok $x->stringWithConditions(qw(none)) eq trim(<<END); <foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail/></foo> END ok $x->stringWithConditions(qw(foot middle)) eq $x->string; ok $x->stringWithConditions eq $x->string; } if (my $h = $x->go(qw(head))) {ok $h->id eq q(a)} else {ok 0} # Attributes and sub nodes # Contents is_deeply [map {$_->tag} $x->contents] , [qw(head bar CDATA head tail)]; is_deeply [map {$_->tag} $x->go(qw(head)) ->contentAfter], [qw(bar CDATA head tail)]; is_deeply [map {$_->tag} $x->go(qw(head), 1)->contentBefore], [qw(head bar CDATA)]; ok $x->contentAsTags eq join \' \', qw(head bar CDATA head tail); ok $x->go(qw(head),0)->contentAfterAsTags eq join \' \', qw( bar CDATA head tail); ok $x->go(qw(head),1)->contentBeforeAsTags eq join \' \', qw(head bar CDATA); ok $x->over(qr(\\Ahead bar CDATA head tail\\Z)); ok $x->go(qw(head),0)->matchAfter (qr(\\Abar CDATA head tail\\Z)); ok $x->go(qw(head),1)->matchBefore(qr(\\Ahead bar CDATA\\Z)); ok $x->c(qw(head)) == 2; ok $x->go(qw(tail))->present(qw(foot middle aaa bbb)) == 2; # Presence of the specified tags ok $x->go(qw(tail))->present(qw(foot aaa bbb)) == 1; ok $x->go(qw(tail))->present(qw( aaa bbb)) == 0; ok $x->go(qw(tail foot))->present(qw(aaa bbb)) == 0; if (1) {my $c = $x->count(qw(head tail aaa)); ok $c == 3; my @c = $x->count(qw(head tail aaa)); ok "@c" eq "2 1 0"; my $t = $x->count(qw(CDATA)); ok $t == 1; my $T = $x->count; ok $T == 5; } if (1) # First child {ok $x->go(qw(tail))->firstIn(qw(foot middle))->id == 11; ok $x->go(qw(tail))-> lastIn(qw(feet middle))->id eq qq(mm); } ok $x->go(qw(head *)) == 2; ok $x->go(qw(head),1)->position == 3; ok $x->go(qw(tail))->first->id == 11; ok $x->go(qw(tail))->last ->id == 22; ok $x->go(qw(tail))->first->isFirst; ok $x->go(qw(tail))->last ->isLast; ok !$x->go(qw(tail))->last->isOnlyChild; ok $x->go(qw(tail))->first->next->id eq \'mm\'; ok $x->go(qw(tail))->last->prev->prev->isFirst; ok $x->go(qw(head))->go(qw(em))->first->at(qw(CDATA em head foo)); # At if (1) # Through {my @t; $x->first->by(sub {my ($o) = @_; push @t, $o->tag}); is_deeply [@t], [qw(CDATA CDATA em head)]; } if (1) {my @t; $x->last->by(sub {my ($o) = @_; push @t, $o->tag}); is_deeply [@t], [qw(foot middle foot tail)]; } # Editing - outermost - wrapWith ok sample1->wrapWith("out")->string eq trim(<<END); <out><foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><foot id="11"/><middle id="mm"/><foot id="22"/></tail></foo></out> END ok sample1->wrapContentWith("out")->parent->string eq trim(<<END); <foo start="yes"><out><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><foot id="11"/><middle id="mm"/><foot id="22"/></tail></out></foo> END # Editing - inner - wrapWith ok sample1->go(qw(tail))->go(qw(middle))->wrapWith("MIDDLE")->parent->parent->string eq trim(<<END); <foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><foot id="11"/><MIDDLE><middle id="mm"/></MIDDLE><foot id="22"/></tail></foo> END ok sample1->go(qw(tail))->go(qw(middle))->wrapContentWith("MIDDLE")->parent->parent->parent->string eq trim(<<END); <foo start="yes"><head id="a" key="aaa bbb" start="123">Hello <em>there</em></head><bar>Howdy <ref/></bar>do doo <head id="A" key="AAAA BBBB" start="123">HHHHello <b>to you</b></head><tail><foot id="11"/><middle id="mm"><MIDDLE/></middle><foot id="22"/></tail></foo> END # Editing - cut/put if (1) {my $a = sample2; ok $a->go(qw(b)) ->id eq q(bb); ok $a->go(qw(b c))->id eq q(cc); ok -p $a eq <<END; #TputFirst #Tcut #TcountTags <a id="aa"> <b id="bb"> <c id="cc"/> </b> </a> END ok $a->countTags == 3; #TcountTags my $c = $a->go(qw(b c))->cut; #TputFirst #Tcut ok -p $a eq <<END; #Tcut <a id="aa"> <b id="bb"/> </a> END $a->putFirst($c); #TputFirst ok -p $a eq <<END; #TputFirst #TputLast <a id="aa"> <c id="cc"/> <b id="bb"/> </a> END $a->putLast($a->go(qw(c))->cut); #TputLast ok -p $a eq <<END; #TputLast #TputNext <a id="aa"> <b id="bb"/> <c id="cc"/> </a> END $a->go(qw(c))->putNext($a->go(q(b))->cut); #TputNext ok -p $a eq <<END; #TputNext #TputPrev <a id="aa"> <c id="cc"/> <b id="bb"/> </a> END $a->go(qw(c))->putPrev($a->go(q(b))->cut); #TputPrev ok -p $a eq <<END; #TputPrev <a id="aa"> <b id="bb"/> <c id="cc"/> </a> END } # Editing - unwrap ok sample2->go(qw(b))->unwrap->string eq \'<a id="aa"><c id="cc"/></a>\'; ok sample2->go(qw(b c))->putFirst(sample2)->parent->parent->parent->string eq \'<a id="aa"><b id="bb"><c id="cc"><a id="aa"><b id="bb"><c id="cc"/></b></a></c></b></a>\'; ok sample2->go(qw(b c))->replaceWith(sample2)->go(qw(b c))->upUntil(qw(a b))->string eq \'<a id="aa"><b id="bb"><c id="cc"/></b></a>\'; if (1) {my $x = sample2; $x->go(qw(b c))->unwrap; ok -s $x eq \'<a id="aa"><b id="bb"/></a>\'; $x->go(q(b))->unwrap; ok -s $x eq \'<a id="aa"/>\'; eval {$x->unwrap }; ok $@ =~ m(\\ACannot unwrap the outer most node)s; } if (1) { my $x = Data::Edit::Xml::new(qq(<a><b><c><d>DD</d>EE<f>FF</f></c></b></a>));#TunwrapContentsKeepingText ok -p $x eq <<END; #TunwrapContentsKeepingText <a> <b> <c> <d>DD</d> EE <f>FF</f> </c> </b> </a> END $x->go(qw(b))->unwrapContentsKeepingText; #TunwrapContentsKeepingText ok -p $x eq <<END; #TunwrapContentsKeepingText <a> <b> DD EE FF </b> </a> END } if (1) {my $x = Data::Edit::Xml::new(qq(<a><b><c id="cc"/></b></a>)); #TreplaceWith $x->go(qw(b c))->replaceWith($x->newTag(qw(d id dd))); #TreplaceWith ok -s $x eq \'<a><b><d id="dd"/></b></a>\'; #TreplaceWith } if (1) {my $x = Data::Edit::Xml::new(qq(<a><b><c id="cc"/></b></a>)); #TreplaceWithText $x->go(qw(b c))->replaceWithText(qq(BBBB)); #TreplaceWithText ok -s $x eq \'<a><b>BBBB</b></a>\'; #TreplaceWithText } if (1) {my $x = Data::Edit::Xml::new(qq(<a><b/><c/></a>)); #TreplaceContentWith $x->replaceContentWith(map {$x->newTag($_)} qw(B C)); #TreplaceContentWith ok -s $x eq \'<a><B/><C/></a>\'; #TreplaceContentWith } if (1) {my $x = Data::Edit::Xml::new(qq(<a><b/><c/></a>)); #TreplaceContentWithText $x->replaceContentWithText(qw(b c)); #TreplaceContentWithText ok -s $x eq \'<a>bc</a>\'; #TreplaceContentWithText } if (1) {my $x = Data::Edit::Xml::new(qq(<a><b><c id="cc"/></b></a>)); #TreplaceWithBlank $x->go(qw(b c))->replaceWithBlank; #TreplaceWithBlank ok -s $x eq \'<a><b> </b></a>\'; #TreplaceWithBlank } # Editing - tag /attributes ok sample2->go(q(b))->change(qw(B b a))->parent->string eq \'<a id="aa"><B id="bb"><c id="cc"/></B></a>\'; ok !sample2->go(q(b))->change(qw(B c a)); ok sample2->go(q(b))->setAttr(aa=>11, bb=>22)->parent->string eq \'<a id="aa"><b aa="11" bb="22" id="bb"><c id="cc"/></b></a>\'; ok sample2->go(qw(b c))->setAttr(aa=>11, bb=>22)->parent->parent->string eq \'<a id="aa"><b id="bb"><c aa="11" bb="22" id="cc"/></b></a>\'; ok sample2->deleteAttr(qw(id))->string eq \'<a><b id="bb"><c id="cc"/></b></a>\'; ok sample2->renameAttr(qw(id ID))->string eq \'<a ID="aa"><b id="bb"><c id="cc"/></b></a>\'; ok sample2->changeAttr(qw(ID id))->id eq qq(aa); ok sample2->renameAttrValue(qw(id aa ID AA))->string eq \'<a ID="AA"><b id="bb"><c id="cc"/></b></a>\'; ok sample2->changeAttrValue(qw(ID AA id aa))->id eq qq(aa); } if (1) {my $a = Data::Edit::Xml::new(<<END); #TstringWithConditions <a> <b> <c/> <d/> </b> </a> END my $b = $a >= \'b\'; #TstringWithConditions my ($c, $d) = $b->contents; #TstringWithConditions $b->addConditions(qw(bb BB)); #TstringWithConditions #TaddConditions #TlistConditions #Tcondition #TanyCondition #TallConditions $c->addConditions(qw(cc CC)); #TstringWithConditions #Tcondition #TanyCondition #TallConditions ok $c->condition(q(cc)); #Tcondition ok !$c->condition(q(dd)); #Tcondition ok $c->condition(q(cc), qw(c b a)); #Tcondition ok $b->anyCondition(qw(bb cc)); #TanyCondition ok !$b->anyCondition(qw(cc CC)); #TanyCondition ok $b->allConditions(qw(bb BB)); #TallConditions ok !$b->allConditions(qw(bb cc)); #TallConditions ok join(\' \', $b->listConditions) eq \'BB bb\'; #TdeleteConditions #TaddConditions #TlistConditions $b->deleteConditions(qw(BB)); #TdeleteConditions ok join(\' \', $b->listConditions) eq \'bb\'; #TdeleteConditions ok $a->stringWithConditions eq \'<a><b><c/><d/></b></a>\'; #TstringWithConditions ok $a->stringWithConditions(qw(bb)) eq \'<a><b><d/></b></a>\'; #TstringWithConditions ok $a->stringWithConditions(qw(cc)) eq \'<a/>\'; #TstringWithConditions } if (1) {my $x = Data::Edit::Xml::new(my $s = <<END); #Tattr <a number="1"/> END ok $x->attr(qq(number)) == 1; #Tattr $x->attr(qq(number)) = 2; #Tattr ok $x->attr(qq(number)) == 2; #Tattr ok -s $x eq \'<a number="2"/>\'; #Tattr $x->attr(qq(delete)) = "me"; ok -s $x eq \'<a delete="me" number="2"/>\'; #TdeleteAttr $x->deleteAttr(qq(delete)); #TdeleteAttr ok -s $x eq \'<a number="2"/>\'; #TdeleteAttr #TsetAttr $x->setAttr(first=>1, second=>2, last=>undef); #TsetAttr ok -s $x eq \'<a first="1" number="2" second="2"/>\'; #TdeleteAttrs #Tattrs #TsetAttr #TgetAttrs #TattrCount ok $x->attrCount == 3; #TattrCount ok $x->attrCount(qw(first second third)) == 1; #TattrCount is_deeply [$x->attrs(qw(third second first ))], [undef, 2, 1]; #Tattrs is_deeply [$x->getAttrs], [qw(first number second)]; #TgetAttrs $x->deleteAttrs(qw(first second third number)); #TdeleteAttrs ok -s $x eq \'<a/>\'; #TdeleteAttrs } if (1) {my $a = newTag(undef, q(a), id=>"aa", a=>"1", b=>"1"); ok q(<a a="1" b="1" id="aa"/>) eq -s $a; #Tset $a->set(a=>11, b=>undef, c=>3, d=>4, e=>5); #Tset ok q(<a a="11" c="3" d="4" e="5" id="aa"/>) eq -s $a; } #Tset if (1) {my $a = Data::Edit::Xml::new(\'<a number="1"/>\'); #TopAttr ok $a % qq(number) == 1; #TopAttr } #if (1) # {my $a = Data::Edit::Xml::new("<a/>"); TopSetTag # $a += qq(b); TopSetTag # ok -s $a eq "<b/>"; TopSetTag # } if (1) {my $c = Data::Edit::Xml::new("<c/>"); #TopWrapWith my $b = $c / qq(b); #TopWrapWith ok -s $b eq "<b><c/></b>"; #TopWrapWith my $a = $b / qq(a); #TopWrapWith ok -s $a eq "<a><b><c/></b></a>"; #TopWrapWith } if (1) {my $a = Data::Edit::Xml::new("<a><b><c/></b></a>"); #TopUnWrap my $b = $a >= \'b\'; #TopUnWrap ++$b; #TopUnWrap ok -s $a eq "<a><c/></a>"; #TopUnWrap } if (1) {my $x = Data::Edit::Xml::new(my $s = <<END); #TprintAttributes <a no="1" word="first"/> END ok $x->printAttributes eq qq( no="1" word="first"); #TrenameAttr #TprintAttributes $x->renameAttr(qw(no number)); #TrenameAttr ok $x->printAttributes eq qq( number="1" word="first"); #TrenameAttr #TchangeAttr $x->changeAttr(qw(number word)); #TchangeAttr ok $x->printAttributes eq qq( number="1" word="first"); #TchangeAttr #TrenameAttrValue $x->renameAttrValue(qw(number 1 numeral I)); #TrenameAttrValue ok $x->printAttributes eq qq( numeral="I" word="first"); #TrenameAttrValue #TchangeAttrValue $x->changeAttrValue(qw(word second greek mono)); #TchangeAttrValue ok $x->printAttributes eq qq( numeral="I" word="first"); #TchangeAttrValue $x->changeAttrValue(qw(word first greek mono)); #TchangeAttrValue ok $x->printAttributes eq qq( greek="mono" numeral="I"); #TchangeAttrValue } if (1) {my $x = Data::Edit::Xml::new(my $s = <<END); #TwrapTo #Tgo <aa> <a> <b/> <c id="1"/><c id="2"/><c id="3"/><c id="4"/> <d/> </a> </aa> END ok $x->go(qw(a c)) ->id == 1; #Tgo ok $x->go(qw(a c -2))->id == 3; #Tgo ok $x->go(qw(a c *)) == 4; #Tgo ok 1234 == join \'\', map {$_->id} $x->go(qw(a c *)); #Tgo $x->go(qw(a c))->wrapTo($x->go(qw(a c -1)), qq(C), id=>1234); #TwrapTo ok -p $x eq <<END; #TwrapTo <aa> <a> <b/> <C id="1234"> <c id="1"/> <c id="2"/> <c id="3"/> <c id="4"/> </C> <d/> </a> </aa> END my $C = $x->go(qw(a C)); #TwrapTo $C->wrapTo($C, qq(D)); #TwrapTo ok -p $x eq <<END; #TwrapTo <aa> <a> <b/> <D> <C id="1234"> <c id="1"/> <c id="2"/> <c id="3"/> <c id="4"/> </C> </D> <d/> </a> </aa> END } if (1) {my $a = Data::Edit::Xml::new(my $s = <<END); #TwrapFrom <a> <b> <c id="0"/><c id="1"/><c id="2"/><c id="3"/> </b> </a> END my $b = $a->first; #TwrapFrom my @c = $b->contents; #TwrapFrom $c[1]->wrapFrom($c[0], qw(D id DD)); #TwrapFrom ok -p $a eq <<END; #TwrapFrom <a> <b> <D id="DD"> <c id="0"/> <c id="1"/> </D> <c id="2"/> <c id="3"/> </b> </a> END $c[2]->wrapTo ($c[2], qw(E id EE)); $c[3]->wrapTo ($c[3], qw(F id FF)); ok -p $a eq <<END; #TwrapTo <a> <b> <D id="DD"> <c id="0"/> <c id="1"/> </D> <E id="EE"> <c id="2"/> </E> <F id="FF"> <c id="3"/> </F> </b> </a> END } if (1) # Blank text {my $f = temporaryFile; overWriteFile($f, "<a> <b/> <c/> <d/> </a>"); my $x = Data::Edit::Xml::new($f); unlink $f; $x->putFirstAsText(\' \'); $x->go(q(b))->putNextAsText(\' \'); $x->go(q(d))->putPrevAsText(\' \'); $x->putLastAsText(\' \'); ok $x->countTags == 8; ok $x->contentAsTags eq "CDATA b CDATA c CDATA d CDATA"; my $c = $x->go(qw(c)); $c->replaceWithBlank; ok $x->countTags == 6; ok $x->contentAsTags eq "CDATA b CDATA d CDATA"; } if (1) # Blank text {my $f = temporaryFile; overWriteFile($f, "<a> </a>"); my $x = Data::Edit::Xml::new(); $x->inputFile = $f; $x->parse; unlink $f; $x->putFirstAsText(\' \') for 1..10; $x->putLastAsText(\' \') for 1..10; ok $x->countTags == 2; ok -s $x eq "<a> </a>"; } if (!$windows) {my @files = #TexpandIncludes (writeFile("in1/a.xml", q(<a id="a"><include href="../in2/b.xml"/></a>)), #TexpandIncludes writeFile("in2/b.xml", q(<b id="b"><include href="c.xml"/></b>)), #TexpandIncludes writeFile("in2/c.xml", q(<c id="c"/>))); #TexpandIncludes my $x = Data::Edit::Xml::new(fpf(currentDirectory, $files[0])); #TexpandIncludes $x->expandIncludes; #TexpandIncludes ok <<END eq -p $x; #TexpandIncludes <a id="a"> <b id="b"> <c id="c"/> </b> </a> END map{unlink $_} @files; map{rmdir $_} map {my ($p) = parseFileName $_; $p} @files; } else # Skip because absFromRel in expandIncludes does not work on windows {ok 1; } if (1) {my $a = Data::Edit::Xml::new("<a><b>A</b></a>"); #TprettyStringCDATA my $b = $a->first; #TprettyStringCDATA $b->first->replaceWithBlank; #TprettyStringCDATA ok $a->prettyStringCDATA eq <<END; #TprettyStringCDATA #TisText #TisBlankText <a> <b><CDATA> </CDATA></b> </a> END ok $b->first->isText; #TisText ok $b->first->isText(qw(b a)); #TisText ok $b->first->isBlankText; #TisBlankText } if (1) # Text {my $x = Data::Edit::Xml::new(<<END); #Tcount #TisEmpty <a> </a> END ok $x->count == 0; #Tcount ok $x->isEmpty; #TisEmpty ok -s $x eq "<a/>"; $x->putFirstAsText(\' \'); ok $x->count == 1; $x->putFirstAsText("\\n"); ok $x->countTags == 2; $x->putFirstAsText(\'3\'); ok nn($x->string) eq "<a>3N </a>"; ok $x->countTags == 2; ok !$x->isEmpty; $x->putFirstAsText(\' \'); ok $x->countTags == 2; $x->putFirstAsText(\' \'); ok $x->countTags == 2; $x->putFirstAsText(\' 2 \'); ok $x->countTags == 2; $x->putFirstAsText("\\n"); ok $x->countTags == 2; $x->putFirstAsText(\' \'); ok $x->countTags == 2; $x->putFirstAsText(\' 1 \'); ok $x->countTags == 2; $x->putFirstAsText(\' \'); ok $x->countTags == 2; $x->putFirstAsText(\' \'); ok $x->first->tag eq qq(CDATA); ok $x->first->isText; ok $x->countTags == 2; ok nn($x->string) eq "<a> 1 N 2 3N </a>"; } if (1) # Text and tags {my $x = Data::Edit::Xml::new(<<END); <a> <b/> <c/> </a> END $x->by(sub {my ($o) = @_; $o->putFirstAsText($_) for (\' \', \'F\', \'\', \'F\', \' \', \'\'); $o->putLastAsText ($_) for (\' \', \'L\', \'\', \'L\', \'\', \' \'); unless($o == $x) {$o->putNextAsText ($_) for (\' N \', \' N \', \'\', \' N \', \' \', \' N \'); # N will always be preceded and succeeded by spaces $o->putPrevAsText ($_) for (\' P\', \'\' , \'\', \' P\', \' \', \' P\') # P will always be preceded by spaces } }); ok -s $x eq "<a> FF P P P<b> FF LL </b> N N N N P P P<c> FF LL </c> N N N N LL </a>"; } if (1) {my $x = Data::Edit::Xml::new(<<END); #TcontentAsTags #TcontentAfterAsTags #TcontentBeforeAsTags #TcontentAfter #Tover #Tover2 #TmatchAfter #TmatchAfter2 #TcontentAfterAsTags2 #TmatchBefore #TmatchBefore2 #TcontentBefore #TcontentBeforeAsTags2 <a> <b> <c/><d/><e/><f/><g/> </b> </a> END ok $x->go(q(b))->contentAsTags eq \'c d e f g\'; #TcontentAsTags ok \'f g\' eq join \' \', map {$_->tag} $x->go(qw(b e))->contentAfter; #TcontentAfterAsTags ok \'c d\' eq join \' \', map {$_->tag} $x->go(qw(b e))->contentBefore; #TcontentBeforeAsTags ok $x->go(qw(b e))->contentAfterAsTags eq \'f g\'; #TcontentAfterAsTags ok $x->go(qw(b e))->contentBeforeAsTags eq \'c d\'; #TcontentBeforeAsTags ok \'f g\' eq join \' \', map {$_->tag} $x->go(qw(b e))->contentAfter; #TcontentAfter ok \'c d\' eq join \' \', map {$_->tag} $x->go(qw(b e))->contentBefore; #TcontentBefore ok $x->go(q(b))->over(qr(d.+e)); #Tover ok $x->go(q(b))->over2(qr(\\A c d e f g \\Z)); #Tover2 ok $x->go(q(b))->contentAsTags eq q(c d e f g) ; #Tover2 ok $x->go(q(b))->contentAsTags2 eq q( c d e f g ); #TcontentAsTags2 ok $x->go(qw(b e))->matchAfter (qr(\\Af g\\Z)); #TmatchAfter ok $x->go(qw(b e))->matchAfter2 (qr(\\A f g \\Z)); #TmatchAfter2 ok $x->go(qw(b e))->contentAfterAsTags2 eq q( f g ); #TcontentAfterAsTags2 ok $x->go(qw(b e))->matchBefore (qr(\\Ac d\\Z)); #TmatchBefore ok $x->go(qw(b e))->matchBefore2(qr(\\A c d \\Z)); #TmatchBefore2 ok $x->go(qw(b e))->contentBeforeAsTags2 eq q( c d ); #TcontentBeforeAsTags2 } if (1) {my $a = Data::Edit::Xml::new(<<END); #TopString #TopContents <a> <b><c>ccc</c></b> <d><e>eee</e></d> </a> END my ($b, $d) = @$a; #TopContents ok -c $b eq q(b a); #TopContents my ($c) = @$b; #TopContents my ($e) = @$d; ok -c $c eq q(c b a); #TopContents -X $c; ok -p $a eq <<END; <a> <b/> <d> <e>eee</e> </d> </a> END -W $e; ok -p $a eq <<END; <a> <b/> <d>eee</d> </a> END -R $d; ok -p $a eq <<END; <a> <b/> <required-cleanup><d>eee</d> </required-cleanup> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tnew #TopString #TbyList #TbyReverseList #TprintNode <a> <b> <c id="42" match="mm"/> </b> <d> <e/> </d> </a> END my ($c, $b, $e, $d) = $a->byList; #TopString ok $c->printNode eq q(c id="42" match="mm"); #TopString #TprintNode ok -A $c eq q(c id="42" match="mm"); #TopString my ($E, $D, $C, $B) = $a->byReverseList; #TbyReverseList ok -A $C eq q(c id="42" match="mm"); #TbyReverseList ok -b $e; #TopString ok -c $e eq q(e d a); #TopString #TbyList ok -f $b eq $c; #TopString ok -l $a eq $d; #TopString ok -O $a, q( b d ); #TopString ok -o $a, q(b d); #TopString ok -w $a eq q(\'<a><b><c id="42" match="mm"/></b><d><e/></d></a>\'); #TopString ok -p $a eq <<END; #TdownReverse #TdownReverseX #Tby #TopBy #TbyX #TbyReverse #TbyReverseX #Tnew #Tstring #TopString #Tcontext #TisFirst #TisLast #TopGo #TopAt <a> <b> <c id="42" match="mm"/> </b> <d> <e/> </d> </a> END ok -s $a eq \'<a><b><c id="42" match="mm"/></b><d><e/></d></a>\'; #TopString #Tstring ok -t $a eq \'a\'; #TopString $a->numberTree; #TopString #TnumberTree ok -z $a eq <<END; #TopString #TnumberTree <a id="1"> <b id="2"> <c id="42" match="mm"/> </b> <d id="4"> <e id="5"/> </d> </a> END ok \'bd\' eq join \'\', map {$_->tag} @$a ; ok (($a >= [qw(d e)]) <= [qw(e d a)]); #TopGo #TopAt ok $a->go(qw(d e))->context eq \'e d a\'; #Tcontext ok $a->go(q(b))->isFirst; #TisFirst ok $a->go(q(d))->isLast; #TisLast if (1) {my $s; $a->down(sub{$s .= $_->tag}); ok $s eq "abcde" #Tdown #TdownX } if (1) {my $s; $a->downReverse(sub{$s .= $_->tag}); ok $s eq "adebc" #TdownReverse #TdownReverseX } if (1) {my $s; $a->by(sub{$s .= $_->tag}); ok $s eq "cbeda" #Tby } if (1) {my $s; $a->byX(sub{$s .= $_->tag}); ok $s eq "cbeda" #TbyX } if (1) {my $s; $a x= sub{$s .= -t $_}; ok $s eq "cbeda" #TopBy } if (1) {my $s; $a->byReverse(sub{$s .= $_->tag}); ok $s eq "edcba" #TbyReverse #TbyReverseX } if (1) {my $s; my $n = sub{$s .= $_->tag}; $a->through($n, $n); #Tthrough #TthroughX ok $s eq "abccbdeeda" #Tthrough #TthroughX } } if (1) {my $x = Data::Edit::Xml::new(<<END); #TopCut <a> <b><c/></b> </a> END my $b = $x >= qq(b); #TopCut --$b; #TopCut ok -s $x eq "<a/>"; #TopCut ok -s $b eq "<b><c/></b>"; #TopCut } if (1) {my $a = Data::Edit::Xml::new(\'<a/>\'); ok -p $a eq <<END; #TopPutFirst <a/> END my $f = $a >> qq(first); #TopPutFirst ok -p $a eq <<END; #TopPutFirst #TopPutLast <a> <first/> </a> END my $l = $a << qq(last); #TopPutLast ok -p $a eq <<END; #TopPutLast #TopPutNext <a> <first/> <last/> </a> END $f += qq(next); #TopPutNext ok -p $a eq <<END; #TopPutNext #TopPutPrev <a> <first/> <next/> <last/> </a> END $l -= qq(prev); #TopPutPrev ok -p $a eq <<END; #TopPutPrev <a> <first/> <next/> <prev/> <last/> </a> END } if (1) {my $a = Data::Edit::Xml::new(\'<a/>\'); ok -p $a eq <<END; #TopPutFirstAssign <a/> END my $n = $a ** qq(z); ok $n->tag eq q(z); $a >>= qq(first); #TopPutFirstAssign ok -p $a eq <<END; #TopPutFirstAssign #TopPutLastAssign <a> <first/> </a> END $a <<= qq(last); #TopPutLastAssign ok -p $a eq <<END; #TopPutLastAssign #TopPutNextAssign <a> <first/> <last/> </a> END my $f = -f $a; #TopPutNextAssign $f += qq(next); #TopPutNextAssign ok -p $a eq <<END; #TopPutNextAssign #TopPutPrevAssign <a> <first/> <next/> <last/> </a> END my $l = -l $a; #TopPutPrevAssign $l -= qq(prev); #TopPutPrevAssign ok -p $a eq <<END; #TopPutPrevAssign <a> <first/> <next/> <prev/> <last/> </a> END } if (1) {my $a = Data::Edit::Xml::new("<a/>"); #TopNew my $b = $a ** q(b); #TopNew ok -s $b eq "<b/>"; #TopNew } if (1) # NextOn {my $a = Data::Edit::Xml::new("<a><b><c id=\'1\'/><d id=\'2\'/><c id=\'3\'/><d id=\'4\'/><e id=\'5\'/></b></a>"); ok -p $a eq <<END; #TnextOn #TprevOn <a> <b> <c id="1"/> <d id="2"/> <c id="3"/> <d id="4"/> <e id="5"/> </b> </a> END my $c = $a->firstContextOf(qw(c)); my $e = $a->lastContextOf(qw(e)); ok $c->id == 1; #TnextOn #TprevOn ok $e->id == 5; #TnextOn #TprevOn ok $c->nextOn(qw(d)) ->id == 2; #TnextOn ok $c->nextOn(qw(c d))->id == 4; #TnextOn ok $e->nextOn(qw(c d)) == $e; #TnextOn ok $e->prevOn(qw(d)) ->id == 4; #TprevOn ok $e->prevOn(qw(c d)) == $c; #TprevOn my $x = $a >= [qw(b c 1)]; my $w = $x->prev; my $y = $x->next; ok -s $w eq \'<d id="2"/>\'; ok -s $y eq \'<d id="4"/>\'; is_deeply {$a->first->present}, {c=>2, d=>2, e=>1}; #Tpresent } if (1) # Put as text {my $x = Data::Edit::Xml::new(<<END); <a id="aa"><b id="bb"><c id="cc"/></b></a> END ok -p $x eq <<END; #TputFirstAsText <a id="aa"> <b id="bb"> <c id="cc"/> </b> </a> END $x->go(qw(b c))->putFirstAsText("<d id=\\"dd\\">DDDD</d>"); #TputFirstAsText ok -p $x eq <<END; #TputFirstAsText #TputLastAsText <a id="aa"> <b id="bb"> <c id="cc"><d id="dd">DDDD</d></c> </b> </a> END $x->go(qw(b c))->putLastAsText("<e id=\\"ee\\">EEEE</e>"); #TputLastAsText ok -p $x eq <<END; #TputLastAsText #TputNextAsText <a id="aa"> <b id="bb"> <c id="cc"><d id="dd">DDDD</d><e id="ee">EEEE</e></c> </b> </a> END $x->go(qw(b c))->putNextAsText("<n id=\\"nn\\">NNNN</n>"); #TputNextAsText ok -p $x eq <<END; #TputNextAsText #TputPrevAsText <a id="aa"> <b id="bb"> <c id="cc"><d id="dd">DDDD</d><e id="ee">EEEE</e></c> <n id="nn">NNNN</n> </b> </a> END $x->go(qw(b c))->putPrevAsText("<p id=\\"pp\\">PPPP</p>"); #TputPrevAsText ok -p $x eq <<END; #TputPrevAsText <a id="aa"> <b id="bb"><p id="pp">PPPP</p> <c id="cc"><d id="dd">DDDD</d><e id="ee">EEEE</e></c> <n id="nn">NNNN</n> </b> </a> END } if (1) #TfirstText #TlastText #TnextText #TprevText {my $a = Data::Edit::Xml::new("<a>AA<b/>BB<c/>CC<d/><e/><f/>DD<g/>HH</a>"); ok -p $a eq <<END; #TfirstText #TlastText #TnextText #TprevText <a>AA <b/> BB <c/> CC <d/> <e/> <f/> DD <g/> HH </a> END ok $a->firstText_a__text eq q(AA); ok !$a->go_c__firstText_c_a; ok !$a->go_c__firstText_c_b; ok $a->lastText__text eq q(HH); ok $a->lastText_a__text eq q(HH); ok !$a->go_c__lastText; ok $a->go_c__nextText_c_a__text eq q(CC); ok !$a->go_e__nextText; ok $a->go_c__prevText_c__text eq q(BB); ok !$a->go_e__prevText; } if (1) {my $a = Data::Edit::Xml::new(<<END); <a> <b> <c> <d>ddd</d> </c> </b> </a> END $a->first->replaceContentWithMovedContent($a->go(qw(b c d))); ok -p $a eq <<END; <a> <b>ddd</b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TreplaceContentWithMovedContent <a> <b> <b1/> <b2/> </b> <c> <c1/> <c2/> </c> <d> <d1/> <d2/> </d> </a> END my ($b, $c, $d) = $a->contents; #TreplaceContentWithMovedContent $d->replaceContentWithMovedContent($c, $b); #TreplaceContentWithMovedContent ok -p $a eq <<END; #TreplaceContentWithMovedContent <a> <b/> <c/> <d> <c1/> <c2/> <b1/> <b2/> </d> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TreplaceContentWithMovedContent <a> <d> <b> <b1/> <b2/> </b> <c> <c1/> <c2/> </c> </d> </a> END my ($d) = $a->contents; #TreplaceContentWithMovedContent my ($b, $c) = $d->contents; #TreplaceContentWithMovedContent $d->replaceContentWithMovedContent($c, $b); #TreplaceContentWithMovedContent ok -p $a eq <<END; #TreplaceContentWithMovedContent <a> <d> <c1/> <c2/> <b1/> <b2/> </d> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tfirst #Tlast #Tnext #Tprev #TfirstBy #TlastBy #Tindex #Tposition #TfirstSibling #TlastSibling <a id="11"> <b id="12"> <c id="13"/> <d id="14"/> <b id="15"> <c id="16"/> <d id="17"/> <e id="18"/> <f id="19"/> <g id="20"/> </b> <f id="21"/> <g id="22"/> </b> <b id="23"> <c id="24"/> <d id="25"/> <b id="26"> <c id="27"/> <d id="28"/> <e id="29"/> <f id="30"/> <g id="31"/> </b> <f id="32"/> <g id="33"/> </b> </a> END ok $a->go(qw(b 1))->id == 23; #Tindex ok $a->go(qw(b 1))->index == 1; #Tindex ok $a->go(qw(b 1 b))->id == 26; #Tposition ok $a->go(qw(b 1 b))->position == 2; #Tposition ok $a->go(q(b))->first->id == 13; #Tfirst ok $a->go(q(b))->first(qw(c b a)); #Tfirst ok !$a->go(q(b))->first(qw(b a)); #Tfirst ok $a->go(qw(b b))->firstSibling->id == 13; #TfirstSibling ok $a->go(qw(b b))->lastSibling ->id == 22; #TlastSibling ok $a->go(q(b))->last ->id == 22; #Tlast ok $a->go(q(b))->last(qw(g b a)); #Tlast ok !$a->go(q(b))->last(qw(b a)); #Tlast ok !$a->go(q(b))->last(qw(b a)); #Tlast ok $a->go(qw(b b e))->next ->id == 19; #Tnext ok $a->go(qw(b b e))->next(qw(f b b a)); #Tnext ok !$a->go(qw(b b e))->next(qw(f b a)); #Tnext ok $a->go(qw(b b e))->prev ->id == 17; #Tprev ok $a->go(qw(b b e))->prev(qw(d b b a)); #Tprev ok !$a->go(qw(b b e))->prev(qw(d b a)); #Tprev if (1) {my %f = $a->firstBy; #TfirstBy ok $f{b}->id == 12; #TfirstBy } if (1) {my %f = $a->firstDown; #TfirstDown ok $f{b}->id == 15; #TfirstDown } if (1) {my %l = $a->lastBy; #TlastBy ok $l{b}->id == 23; #TlastBy } if (1) {my %l = $a->lastDown; #TlastDown ok $l{b}->id == 26; #TlastDown } } if (1) {my $x = Data::Edit::Xml::new(<<END); #TfirstContextOf #TlastContextOf <a id="a1"> <b1 id="b1"> <c id="c1"> <d id="d1">DD11</d> <e id="e1">EE11</e> </c> </b1> <b2 id="b2"> <c id="c2"> <d id="d2">DD22</d> <e id="e2">EE22</e> </c> </b2> <b3 id="b3"> <c id="c3"> <d id="d3">DD33</d> <e id="e3">EE33</e> </c> </b3> </a> END ok $x->firstContextOf(qw(d c)) ->id eq qq(d1); #TfirstContextOf ok $x->firstContextOf(qw(e c b2)) ->id eq qq(e2); #TfirstContextOf ok $x->firstContextOf(qw(CDATA d c b2))->string eq qq(DD22); #TfirstContextOf ok $x-> lastContextOf(qw(d c)) ->id eq qq(d3); #TlastContextOf ok $x-> lastContextOf(qw(e c b2 )) ->id eq qq(e2); #TlastContextOf ok $x-> lastContextOf(qw(CDATA e c b2))->string eq qq(EE22); #TlastContextOf } if (1) # New {my $x = Data::Edit::Xml::newTree("a", id=>1, class=>"aa"); #TnewTree #TnewTag ok -s $x eq \'<a class="aa" id="1"/>\'; #TnewTree ok $x->attrCount == 2; $x->putLast($x->newTag("b", id=>2, class=>"bb")); #TnewTag ok $x->go(q(b))->attrCount == 2; ok -p $x eq <<END; #TnewText #TnewTag <a class="aa" id="1"> <b class="bb" id="2"/> </a> END $x->putLast($x->newText("t")); #TnewText ok -p $x eq <<END; #TnewText <a class="aa" id="1"> <b class="bb" id="2"/> t </a> END } if (1) # Well known attributes {my $a = Data::Edit::Xml::newTree("a", id=>1, class=>2, href=>3, outputclass=>4); #TcountOutputClasses ok $a->id == 1; ok $a->class == 2; ok $a->href == 3; ok $a->outputclass == 4; is_deeply { 4 => 1 }, $a->countOutputClasses; #TcountOutputClasses } if (1) # Spares {my $c = Data::Edit::Xml::newTree("c", id=>33); #TwrapUp my ($b, $a) = $c->wrapUp(qw(b a)); #TwrapUp ok -p $a eq <<\'END\'; #TwrapUp <a> <b> <c id="33"/> </b> </a> END } if (1) {my $a = Data::Edit::Xml::newTree("a", id=>33); #TwrapDown my ($b, $c) = $a->wrapDown(qw(b c)); #TwrapDown ok $a->tag eq qq(a); ok $b->tag eq qq(b); ok $c->tag eq qq(c); ok $a->id == 33; ok -p $a eq <<END; #TwrapDown <a id="33"> <b> <c/> </b> </a> END } if (1) # Matches text {my $x = Data::Edit::Xml::new(<<END); #TmatchesText <a> <b> <c>CDECD</c> </b> </a> END my $c = $x->go(qw(b c))->first; #TmatchesText ok !$c->matchesText(qr(\\AD)); #TmatchesText ok $c->matchesText(qr(\\AC), qw(c b a)); #TmatchesText ok !$c->matchesText(qr(\\AD), qw(c b a)); #TmatchesText is_deeply [qw(E)], [$c->matchesText(qr(CD(.)CD))]; #TmatchesText } if (1) # Create {my $x = Data::Edit::Xml::new(<<END); <a> <b> <C/> </b> <c> <D/> E </c> <d> <F/> <G/> <H/> </d> <e/> </a> END $x->go(qw(d G))->replaceWithBlank; ok $x->prettyStringCDATA eq <<END; #TbitsNodeTextBlank <a> <b> <C/> </b> <c> <D/> <CDATA> E </CDATA> </c> <d> <F/> <CDATA> </CDATA> <H/> </d> <e/> </a> END ok \'100\' eq -B $x; #TbitsNodeTextBlank ok \'100\' eq -B $x->go(q(b)); #TbitsNodeTextBlank ok \'110\' eq -B $x->go(q(c)); #TbitsNodeTextBlank ok \'111\' eq -B $x->go(q(d)); #TbitsNodeTextBlank ok !-B $x->go(qw(e)); #TbitsNodeTextBlank } if (!$windows) # Default error file {my $a = eval {Data::Edit::Xml::new("</a>")}; my ($m, $f) = split /\\n/, $@; ok $m =~ m(Xml parse error, see file:)s; ok -e $f; unlink $f; $f =~ s\'out.data\'\'; rmdir $f; } else {ok 1 for 1..2; } if (1) {my $a = Data::Edit::Xml::new(<<END); #TisAllBlankText <a> <b> <c> <z/> </c> </b> <d/> </a> END $a->by(sub{$_->replaceWithBlank(qw(z))}); #TisAllBlankText my ($b, $c, $d) = $a->firstBy(qw(b c d)); #TisAllBlankText ok !$b->isEmpty; ok !$b->isAllBlankText; ok !$c->isEmpty; ok $c->isAllBlankText; #TisAllBlankText ok $c->isAllBlankText(qw(c b a)); #TisAllBlankText ok !$c->isAllBlankText(qw(c a)); #TisAllBlankText ok $d->isEmpty; ok $d->isEmpty(qw(d a)); ok !$d->isEmpty(qw(d b)); ok $d->isAllBlankText; ok $d->isAllBlankText(qw(d a)); ok !$d->isAllBlankText(qw(d b)); ok $a->first(qw(b a)) == $b; ok !$a->first(qw(a)); ok $a->last(qw(d a)) == $d; ok !$a->last(qw(a)); ok $b->next(qw(d a)) == $d; ok !$b->next(qw(a)); ok $d->prev(qw(b a)) == $b; ok !$d->prev(qw(a)); ok $b->isFirst; ok $b->isFirst(qw(b a)); ok !$b->isFirst(qw(a)); ok $d->isLast; ok $d->isLast(qw(d a)); ok !$d->isLast(qw(a)); $d->props = q(Props); $d->otherprops = q(OtherProps); $d->style = q(Style); ok $d->printAttributes eq q( otherprops="OtherProps" props="Props" style="Style"); my $D = $d->countAttrNames; is_deeply $D, { otherprops => 1, props => 1, style => 1 }; ok $c->at(q(c), undef, q(a)); ok !$c->cut(qw(b a)); } if (1) # Unwrap {my $x = Data::Edit::Xml::new("<a><b><c/></b></a>"); $x->go(qw(b c))->unwrap; $x->checkParentage; ok -s $x eq "<a><b/></a>"; $x->go(q(b))->unwrap; ok -s $x eq "<a/>"; eval {$x->unwrap}; ok $@ =~ /\\ACannot unwrap the outer most node/gs; } if (1) {my $a = Data::Edit::Xml::new("<a> </a>"); #Tequals #Tclone my $A = $a->clone; #Tequals #Tclone ok -s $A eq q(<a/>); #Tequals #Tclone ok $a->equals($A); #Tequals #Tclone } if (1) {my $a = Data::Edit::Xml::new("<a/>"); #Trenew $a->putFirstAsText(qq(<b/>)); #Trenew ok !$a->go(q(b)); #Trenew my $A = $a->renew; #Trenew ok -t $A->go(q(b)) eq q(b) #Trenew } if (1) #TnumberTree #TfindByNumber #Tnumber {my $a = Data::Edit::Xml::new(<<END); <a><b><c/></b><d><e/></d></a> END $a->numberTree; ok -z $a eq <<END; <a id="1"> <b id="2"> <c id="3"/> </b> <d id="4"> <e id="5"/> </d> </a> END ok -t $a->findByNumber_4 eq q(d); ok $a->findByNumber_3__up__number == 2; } if (1) #Tup #Tupn #TupUntil #TupWhile {my $a = Data::Edit::Xml::new(<<END); <a><b><c><b><b><b><b><c/></b></b></b></b></c></b></a> END $a->numberTree; ok -z $a eq <<END; <a id="1"> <b id="2"> <c id="3"> <b id="4"> <b id="5"> <b id="6"> <b id="7"> <c id="8"/> </b> </b> </b> </b> </c> </b> </a> END my $c = $a->findByNumber(8); ok -t $c eq q(c); ok $c->up_b__number == 7; ok $c->upn_2__number == 6; ok $c->upWhile_b__number == 4; ok $c->upWhile_a_b__number == 4; ok $c->upWhile_b_c__number == 2; ok $c->upUntil__number == 7; ok $c->upUntil_b_c__number == 4; } if (1) {ok Data::Edit::Xml::cdata eq q(CDATA); #Tcdata ok Data::Edit::Xml::replaceSpecialChars(q(<">)) eq q(<">); #TreplaceSpecialChars ok Data::Edit::Xml::undoSpecialChars(q(<">)) eq q(<">); #TundoSpecialChars } if (1) # Break in and out {my $A = Data::Edit::Xml::new("<a><b><d/><c/><c/><e/><c/><c/><d/></b></a>"); #TbreakOut ok -p $A eq <<END; <a> <b> <d/> <c/> <c/> <e/> <c/> <c/> <d/> </b> </a> END if (1) {my $a = $A->clone; $a->go(q(b))->breakOut($a, qw(d e)); #TbreakOut ok -p $a eq <<END; #TbreakOut #TbreakIn <a> <d/> <b> <c/> <c/> </b> <e/> <b> <c/> <c/> </b> <d/> </a> END $a->go(qw(b 1))->breakIn; #TbreakIn ok -p $a eq <<END; #TbreakIn <a> <b> <d/> <c/> <c/> <e/> <c/> <c/> <d/> </b> </a> END $a->go(q(b))->breakOut($a, qw(d e)); # Break backwards ok -p $a eq <<END; #TbreakInBackwards <a> <d/> <b> <c/> <c/> </b> <e/> <b> <c/> <c/> </b> <d/> </a> END $a->go(qw(b 1))->breakInBackwards; #TbreakInBackwards ok -p $a eq <<END; #TbreakInBackwards <a> <b> <d/> <c/> <c/> <e/> <c/> <c/> </b> <d/> </a> END my $d = $a->go(q(d))->cut; eval {$d->putLast($d)}; ok $@ =~ m/\\ARecursive insertion attempted/s; $a->go(q(b))->putLast($d); ok $A->equals($a); $a->go(q(b))->breakOut($a, qw(d e)); ok -p $a eq <<END; #TbreakInForwards <a> <d/> <b> <c/> <c/> </b> <e/> <b> <c/> <c/> </b> <d/> </a> END $a->go(q(b))->breakInForwards; #TbreakInForwards ok -p $a eq <<END; #TbreakInForwards <a> <d/> <b> <c/> <c/> <e/> <c/> <c/> <d/> </b> </a> END my $D = $a->go(q(d))->cut; eval {$D->putFirst($D)}; ok $@ =~ m/\\ARecursive insertion attempted/s; $a->go(q(b))->putFirst($D); ok $A->equals($a); } } if (1) {my @tags = qw(a b c d e); my $x = Data::Edit::Xml::new(<<END); #Tordered #Tpath #Tdisordered #Tabove #Tbelow #Tbefore #Tafter #TabovePath #TbelowPath <a id=\'a1\'> <b id=\'b1\'> <c id=\'c1\'/> <c id=\'c2\'/> <d id=\'d1\'> <e id=\'e1\'/> </d> <c id=\'c3\'/> <c id=\'c4\'/> <d id=\'d2\'> <e id=\'e2\'/> </d> <c id=\'c5\'/> <c id=\'c6\'/> </b> </a> END my ($a, $b, $c, $d, $e) = $x->firstDown(@tags); #TabovePath #TbelowPath my ($A, $B, $C, $D, $E) = $x->lastDown(@tags); is_deeply [$b, $d, $e], [$b->abovePath($e)]; #TabovePath is_deeply [$e, $d, $b], [$e->belowPath($b)]; #TbelowPath is_deeply [], [$c->abovePath($d)]; #TabovePath is_deeply [$c], [$c->belowPath($c)]; #TbelowPath ok eval \' $\'.$_ .\'->tag eq "\'.$_.\'"\' for @tags; # Tags equal their variable names ok eval \' $\'.uc($_).\'->tag eq "\'.$_.\'"\' for @tags; # Tags equal their lowercased uppercase variable names ok eval \' $\'.$_ .\'->ordered($\'.uc($_).\')->tag eq $\'.$_.\'->tag\' for @tags;# Lowercase nodes precede uppercase nodes ok eval \'!$\'.uc($_).\'->ordered($\'.$_ .\') or $\'.$_.\' == $\'.uc($_) for @tags;# Uppercase nodes equal lowercase nodes or do not precede them ok $A == $a; ok $B == $b; ok $C == $b->go(qw(c 5)); ok $D == $b->go(qw(d -1)); ok $E == $D->go(qw(e)); is_deeply [$x->go(qw(b d 1 e))->path], [qw(b d 1 e)]; #Tpath $x->by(sub {ok $x->go($_->path) == $_}); #Tpath ok $a->id eq \'a1\'; ok $b->id eq \'b1\'; #Tdisordered #Tabove ok $c->id eq \'c1\'; #Tdisordered #Tafter ok $d->id eq \'d1\'; #Tdisordered #Tbelow ok $e->id eq "e1"; #Tordered #Tabove #Tbelow #Tdisordered #Tbefore #Tafter ok $E->id eq "e2"; #Tordered #Tabove #Tbefore ok $b->above($e); #Tabove ok !$E->above($e); #Tabove ok !$d->below($e); #Tbelow ok $e->disordered($c )->id eq "c1"; #Tdisordered ok $b->disordered($c, $e, $d)->id eq "d1"; #Tdisordered ok !$c->disordered($e); #Tdisordered ok $e->ordered($E); #Tordered ok !$E->ordered($e); #Tordered ok $e->ordered($e); #Tordered ok $e->ordered; #Tordered ok $a->ordered($b,$c,$d,$e); ok $A->ordered($B,$D,$E,$C); is_deeply[map{$_->tag}$a->firstDown(@tags)],[map{$_->tag}$a-> lastBy(@tags)]; is_deeply[map{$_->tag}$a-> lastDown(@tags)],[map{$_->tag}$a->firstBy(@tags)]; ok $e->before($E); #Tbefore ok $e->after($c); #Tafter } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tat <a> <b> <c> <d/> </c> <c> <e/> </c> <c> <f/> </c> </b> </a> END ok $a->go(qw(b c -1 f))->at(qw(f c b a)); #Tat ok $a->go(qw(b c 1 e))->at(undef, qr(c|d), undef, qq(a)); #Tat my $d = $a->go(qw(b c d)); ok $d->context eq q(d c b a); #Tat #TatOrBelow ok $d->at(qw(d c b), undef); #Tat ok !$d->at(qw(d c b), undef, undef); #Tat ok !$d->at(qw(d e b)); #Tat ok $d->atOrBelow(qw(d c b a)); #TatOrBelow ok $d->atOrBelow(qw( c b a)); #TatOrBelow ok $d->atOrBelow(qw( b a)); #TatOrBelow ok !$d->atOrBelow(qw( c a)); #TatOrBelow } if (1) {my $a = Data::Edit::Xml::new(qq(<a> </a>)); ok !$a->bitsNodeTextBlank && $a->isEmpty; } if (1) {my $a = Data::Edit::Xml::new(qq(<a><b>B</b><c/> </a>)); ok $a->bitsNodeTextBlank && !$a->isEmpty; } if (1) # Numbered {my $a = Data::Edit::Xml::new(<<END); <a> <b> <c> <e/> </c> <d> <e/> </d> <c> <d> <e/> </d> </c> <d> <e/> </d> <c> <d> <e/> </d> </c> </b> </a> END $a->numberTree; ok -z $a eq <<END; #TpathString #TfirstInIndex #TlastInIndex #TcommonAncestor #Tdepth #Tto #Tfrom #TfromTo <a id="1"> <b id="2"> <c id="3"> <e id="4"/> </c> <d id="5"> <e id="6"/> </d> <c id="7"> <d id="8"> <e id="9"/> </d> </c> <d id="10"> <e id="11"/> </d> <c id="12"> <d id="13"> <e id="14"/> </d> </c> </b> </a> END is_deeply [$a->findByNumber(11)->path], [(qw(b d 1 e))]; # FindByNumber ok $a->findByNumber(9)->pathString eq \'b c 1 d e\'; #TpathString ok !$a->above($a); # Above ok $a->findByNumber(12)->above($a->findByNumber(14)); ok !$a->findByNumber( 7)->above($a->findByNumber(12)); ok !$a->below($a); # Below ok $a->findByNumber( 9)->below($a->findByNumber(7)); ok !$a->findByNumber( 8)->below($a->findByNumber(10)); ok $a->findByNumber(13)->after($a->findByNumber(10)); if (1) {my ($m, $n) = $a->findByNumbers(5, 10); ok $m->before($n); } ok $a->findByNumber (5)->firstInIndex; #TfirstInIndex ok $a->findByNumber(10)->lastInIndex; #TlastInIndex ok !$a->findByNumber(7) ->firstInIndex; #TfirstInIndex ok !$a->findByNumber(7) ->lastInIndex; #TlastInIndex if (1) {my ($b, $e, @n) = $a->findByNumbers(2, 4, 6, 9); #TcommonAncestor ok -t $b eq \'b\'; ok -t $e eq \'e\'; ok $e == $e->commonAncestor; #TcommonAncestor ok $e == $e->commonAncestor($e); #TcommonAncestor ok $b == $e->commonAncestor($b); #TcommonAncestor ok $e == $e->commonAncestor($e, $e); ok $b == $e->commonAncestor($e, $b); ok $b == $e->commonAncestor(@n); #TcommonAncestor } if (1) {my ($d, $c, $D) = $a->findByNumbers(5, 7, 10); #TfromTo #Tto #Tfrom ok -t $d eq \'d\'; ok -t $c eq \'c\'; ok -t $D eq \'d\'; my @r = $d->fromTo($D); #TfromTo ok @r == 3; #TfromTo my @R = $d->fromTo($D, qw(c)); #TfromTo ok @R == 1; #TfromTo ok -M $R[0] == 7; #TfromTo ok !$D->fromTo($d); #TfromTo ok 1 == $d->fromTo($d); #TfromTo my @f = $d->from; #Tfrom ok @f == 4; #Tfrom ok $d == $f[0]; #Tfrom my @F = $d->from(qw(c)); #Tfrom ok @F == 2; #Tfrom ok -M $F[1] == 12; #Tfrom my @t = $D->to; #Tto ok $D == $t[-1]; #Tfrom ok @t == 4; #Tto my @T = $D->to(qw(c)); #Tto ok @T == 2; #Tto ok -M $T[1] == 7; #Tto } ok 0 == $a->depth; #Tdepth ok 4 == $a->findByNumber(14)->depth; #Tdepth } if (1) {my $a = Data::Edit::Xml::new(<<END); #TfirstOf #TlastOf <a><b><c/><d/><d/><e/><d/><d/><c/></b></a> END is_deeply [qw(c d d)], [map {-t $_} $a->go(q(b))->firstOf(qw(c d))]; #TfirstOf is_deeply [qw(d d c)], [map {-t $_} $a->go(q(b))->lastOf (qw(c d))]; #TlastOf } if (1) # IsOnlyChild {my $a = Data::Edit::Xml::new("<a><b><c><d/></c></b></a>"); ok $a->go(qw(b c d))->isOnlyChild; ok $a->go(qw(b c d))->isOnlyChild(qw(d)); ok $a->go(qw(b c d))->isOnlyChild(qw(d c)); ok $a->go(qw(b c d))->isOnlyChild(qw(d c b)); } if (1) {my $a = Data::Edit::Xml::new("<a><b>bb</b><c>cc<d/>ee</c></a>"); #TcontainsSingleText ok $a->go(q(b))->containsSingleText->text eq q(bb); #TcontainsSingleText ok !$a->go(q(c))->containsSingleText; #TcontainsSingleText } if (1) # Cut {my $x = Data::Edit::Xml::new("<a><b><c/></b></a>"); $x->go(qw(b c))->cut; $x->checkParentage; ok -s $x eq "<a><b/></a>"; $x->go(q(b))->cut; ok -s $x eq "<a/>"; eval {$x->cut}; ok !$@; # Permit multiple cut outs of the same node } if (1) # Cut blank {my $x = Data::Edit::Xml::new("<a>A<b/>B</a>"); my $b = $x->go(q(b)); $b->putFirst($x->newText(\' c \')); ok -s $x eq "<a>A<b> c </b>B</a>"; #Tunwrap $b->unwrap; #Tunwrap ok -s $x eq "<a>A c B</a>"; #Tunwrap } if (1) # Errors {my $f = temporaryFile; my $e = temporaryFile; overWriteFile($f, <<END); <a> END my $x = Data::Edit::Xml::new(); $x->input = $f; $x->errorsFile = $e; eval {$x->parse}; ok $@ =~ /\\AXml parse error, see file:/; ok -e $e; my $s = readFile($e); ok CORE::index($s, $f) > 0; ok $s =~ /no element found at line 2, column 0, byte 4/s; unlink $e, $f; } if (1) # Unwrap/Cut in by {my $f = temporaryFile; overWriteFile($f, <<END); <a> <b><c/><C/><c/></b> <b><c/><c/><C/></b> <B><c/><c/><C/></B> <b><c/><c/><C/></b> <b><C/><C/><c/></b> <B><C/><C/><C/></B> <B><c/><c/><C/></B> </a> END my $x = Data::Edit::Xml::new(); $x->input = $f; $x->parse; unlink $f; my $A = 0; $x->checkParser; $x->by(sub # Add stuff and move things around {my ($o) = @_; for my $t(\'\', \' \', \'aa\', 11) {$o->putFirst($x->newTag(q(a))) if ++$A % 3 == 0; $o->putLast ($x->newTag(q(b))) if ++$A % 5 == 0; if ($o->parent) {$o->putNext ($x->newTag(q(c))) if ++$A % 7 == 0; $o->putPrev ($x->newTag(q(d))) if ++$A % 2 == 0; $o->putFirstAsText($t) if ++$A % 3 == 0; $o->putLastAsText ($t) if ++$A % 2 == 0; $o->putNextAsText ($t) if ++$A % 3 == 0; $o->putPrevAsText ($t) if ++$A % 2 == 0; } $o->wrapContentWith(qw(ww)) if ++$A % 5 == 0; $o->wrapWith(qw(xx)) if ++$A % 3 == 0; $o->wrapUp (qw(aa bb)) if ++$A % 5 == 0; $o->wrapDown(qw(cc dd)) if ++$A % 7 == 0; if (my $p = $o->parent) {if(!$p->above($o)) {$p->putFirst ($o->cut) if ++$A % 2 == 0; $p->putLast ($o->cut) if ++$A % 5 == 0; $p->replaceWith ($o->cut) if ++$A % 2 == 0; if (my $q = $p->parent) {$p->putNext ($o->cut) if ++$A % 2 == 0; $p->putPrev ($o->cut) if ++$A % 2 == 0; $q->putLast ($o->cut) if ++$A % 3 == 0; $q->putNext ($o->cut) if ++$A % 5 == 0; $q->putPrev ($o->cut) if ++$A % 3 == 0; $q->putFirst ($o->cut) if ++$A % 3 == 0; $q->replaceWith($o->cut) if ++$A % 3 == 0; } } } } }); is_deeply $x->countTagNames, {a => 1, aa => 22, b => 27, B => 3, bb => 22, C => 10, c => 27, cc => 16, CDATA => 168, d => 112, dd => 16, ww => 23, }; ok $x->countTags == 447; $x->checkParentage; ok $x->equals($x); # Equals and clone my $y = $x->clone; my $z = $y->clone; ok $y->equals($x); ok $y->equals($y); ok $y->equals($z); ok $x->equals($z); ok $y->by(sub {if ($_->at(q(C))) {$_->change(q(D)); } }); ok !$y->equals($z); if (1) # Save restore {my $f = temporaryFile; unlink $f; my $y1 = eval {Data::Edit::Xml::restore($f)}; ok $@ =~ /Cannot restore from a non existent file/gs; $y->save($f); #Tsave #Trestore my $Y = Data::Edit::Xml::restore($f); #Tsave #Trestore unlink $f; ok $Y->equals($y); #Tsave #Trestore } my $a = 0; # Cut and unwrap $x->by(sub {my $t = $_->tag; eval {$x->cut}; eval {$x->unwrap}; eval {$_->cut} if ++$a % 2; eval {$_->unwrap} if ++$a % 2; }); $x->checkParentage; ok -s $x eq "<a/>"; } if (1) # First of {my $x = Data::Edit::Xml::new(<<END); #Tc #Tcontents <a> <b id="b1"><c id="1"/></b> <d id="d1"><c id="2"/></d> <e id="e1"><c id="3"/></e> <b id="b2"><c id="4"/></b> <d id="d2"><c id="5"/></d> <e id="e2"><c id="6"/></e> </a> END ok !$x->firstContextOf(qw(c a)); ok !$x-> lastContextOf(qw(c a)); ok $x->firstContextOf(qw(c b))->id == 1; ok $x->firstContextOf(qw(c d))->id == 2; ok $x->firstContextOf(qw(c e))->id == 3; ok $x-> lastContextOf(qw(c b))->id == 4; ok $x-> lastContextOf(qw(c d))->id == 5; ok $x-> lastContextOf(qw(c e))->id == 6; is_deeply [map{-u $_} $x->c(q(d))], [qw(d1 d2)]; #Tc is_deeply [map{-u $_} $x->contents], [qw(b1 d1 e1 b2 d2 e2)]; #Tcontents } if (1) # Special characters {my $t = \'<a id=""<>"<>">"<>"<></a>\'; my $x = Data::Edit::Xml::new($t); ok -s $x eq $t; } if (1) {my $s = <<END; #TprettyString #Tconcatenate #TprettyStringContent #TprettyStringNumbered #TstringContent #TstringQuoted <a> <b> <A/> <B/> </b> <c> <C/> <D/> </c> </a> END my $a = Data::Edit::Xml::new($s); #TprettyString #Tconcatenate ok $s eq $a->prettyString; #TprettyString ok $s eq -p $a; #TprettyString ok $a->stringContent eq "<b><A/><B/></b><c><C/><D/></c>"; #TstringContent ok $a->stringQuoted eq q(\'<a><b><A/><B/></b><c><C/><D/></c></a>\'); #TstringQuoted ok $a->prettyStringContent eq <<END; #TprettyStringContent <b> <A/> <B/> </b> <c> <C/> <D/> </c> END $a->numberTree; #TprettyStringNumbered #TfindByNumber #TfindByNumbers #Tancestry ok $a->prettyStringNumbered eq <<END; #TprettyStringNumbered #TfindByNumber #TfindByNumbers #Tancestry #TtocNumbers <a id="1"> <b id="2"> <A id="3"/> <B id="4"/> </b> <c id="5"> <C id="6"/> <D id="7"/> </c> </a> END if (1) {my $t = $a->tocNumbers(qw(b A B)); is_deeply {map {$_=>$t->{$_}->tag} keys %$t}, {"1"=>"b", "1 1"=>"A", "1 2"=>"B"} } if (1) {my $t = $a->tocNumbers(qw(b c A B C)); is_deeply {map {$_=>$t->{$_}->tag} keys %$t}, { "1" => "b", "1 1" => "A", "1 2" => "B", "2" => "c", "2 1" => "C" } } if (1) { my $t = $a->tocNumbers(); #TtocNumbers is_deeply {map {$_=>$t->{$_}->tag} keys %$t}, #TtocNumbers {"1" =>"b", #TtocNumbers "1 1"=>"A", #TtocNumbers "1 2"=>"B", #TtocNumbers "2" =>"c", #TtocNumbers "2 1"=> "C", #TtocNumbers "2 2"=>"D" #TtocNumbers } #TtocNumbers } ok q(D) eq -t $a->findByNumber(7); #TfindByNumber is_deeply [map {-t $_} $a->findByNumbers(1..3)], [qw(a b A)]; #TfindByNumbers is_deeply [map {-t $_} $a->findByNumber(7)->ancestry], [qw(D c a)]; #Tancestry $a->go(q(b))->concatenate($a->go(q(c))); #Tconcatenate my $t = <<END; #Tconcatenate <a> <b> <A/> <B/> <C/> <D/> </b> </a> END ok $t eq -p $a; #Tconcatenate } if (1) {my $s = <<END; #TprettyStringContentNumbered <a> <b> <c/> </b> </a> END my $a = Data::Edit::Xml::new($s); #TprettyStringContentNumbered $a->numberTree; #TprettyStringContentNumbered ok $a->prettyStringContentNumbered eq <<END; #TprettyStringContentNumbered <b id="2"> <c id="3"/> </b> END ok $a->go(qw(b))->prettyStringContentNumbered eq <<END; #TprettyStringContentNumbered <c id="3"/> END } if (1) # concatenateSiblings {my $a = Data::Edit::Xml::new(\'<a><b><c id="1"/></b><b><c id="2"/></b><b><c id="3"/></b><b><c id="4"/></b></a>\'); ok -p $a eq <<END; #TconcatenateSiblings <a> <b> <c id="1"/> </b> <b> <c id="2"/> </b> <b> <c id="3"/> </b> <b> <c id="4"/> </b> </a> END $a->go(qw(b 3))->concatenateSiblings; #TconcatenateSiblings ok -p $a eq <<END; #TconcatenateSiblings <a> <b> <c id="1"/> <c id="2"/> <c id="3"/> <c id="4"/> </b> </a> END $a->concatenateSiblings; ok -s $a eq \'<a><b><c id="1"/><c id="2"/><c id="3"/><c id="4"/></b></a>\'; } if (1) {my $a = Data::Edit::Xml::new(\'<a/>\'); #Tchange $a->change(qq(b)); #Tchange ok -s $a eq \'<b/>\'; #Tchange } if (1) {my $x = Data::Edit::Xml::new(<<END); #TcountTagNames #TcountAttrNames #TcountAttrValues <a A="A" B="B" C="C"> <b B="B" C="C"> <c C="C"> </c> <c/> </b> <b C="C"> <c/> </b> </a> END is_deeply $x->countTagNames, { a => 1, b => 2, c => 3 }; #TcountTagNames is_deeply $x->countAttrNames, { A => 1, B => 2, C => 4 }; #TcountAttrNames is_deeply $x->countAttrValues, { A => 1, B => 2, C => 4 }; #TcountAttrValues } if (1) # *NonBlank {my $a = Data::Edit::Xml::new ("<a>1<A/>2<B/>3<C/>4<D/>5<E/>6<F/>7<G/>8<H/>9</a>"); map {$_->replaceWithBlank} grep {$_->isText} $a->contents; map {$_->cut} grep {$_->tag =~ m/\\A[BDFH]\\Z/} $a->contents; ok $a->prettyStringCDATA eq <<\'END\'; #TfirstNonBlank #TnextNonBlank #TfirstIn #TnextIn #TlastNonBlank #TprevNonBlank #TlastIn #TprevIn <a><CDATA> </CDATA> <A/> <CDATA> </CDATA> <C/> <CDATA> </CDATA> <E/> <CDATA> </CDATA> <G/> <CDATA> </CDATA> </a> END ok $a->firstNonBlank->tag eq qq(A); #TfirstNonBlank ok $a->firstNonBlank(qw(A a)); #TfirstNonBlank ok $a->firstNonBlank->nextNonBlank->tag eq qq(C); #TnextNonBlank ok $a->firstNonBlank->nextNonBlank(qw(C a)); #TnextNonBlank ok $a->firstIn(qw(b B c C))->tag eq qq(C); #TfirstIn ok $a->firstIn(qw(b B c C))->nextIn(qw(A G))->tag eq qq(G); #TnextIn ok $a->lastNonBlank->tag eq qq(G); #TlastNonBlank ok $a->lastNonBlank(qw(G a)); #TlastNonBlank ok $a->lastNonBlank->prevNonBlank->tag eq qq(E); #TprevNonBlank ok $a->lastNonBlank->prevNonBlank(qw(E a)); #TprevNonBlank ok $a->lastIn(qw(e E f F))->tag eq qq(E); #TlastIn ok $a->lastIn(qw(e E f F))->prevIn(qw(A G))->tag eq qq(A); #TprevIn } if (1) {my $a = Data::Edit::Xml::new(<<END); #TisOnlyChild #TisOnlyChildToDepth #TisEmpty #TisFirstToDepth #TisLastToDepth <a> <b> <c> <d/> </c> </b> <e> <f/> </e> </a> END my ($d, $c, $b, $f, $e) = $a->byList; #TisOnlyChild #TisOnlyChildToDepth #TisEmpty #TisFirstToDepth #TisLastToDepth ok $d->parent->isOnlyChild; ok $d->isOnlyChild; #TisOnlyChild ok $d->isOnlyChild(qw(d c)); ok $d->isOnlyChild(qw(d c b)); ok $d->isOnlyChild(qw(d c b a)); ok !$d->isOnlyChild(qw(b)); #TisOnlyChild ok $d->isOnlyChildToDepth(1, qw(d c b a)); #TisOnlyChildToDepth ok $d->isOnlyChildToDepth(2, qw(d c b a)); #TisOnlyChildToDepth ok !$d->isOnlyChildToDepth(3, qw(d c b a)); #TisOnlyChildToDepth ok $d->isEmpty; #TisEmpty ok $d->isFirstToDepth(4); #TisFirstToDepth ok !$f->isFirstToDepth(2); #TisFirstToDepth ok $f->isFirstToDepth(1); #TisFirstToDepth ok !$f->isFirstToDepth(3); #TisFirstToDepth ok $c->isLastToDepth(1); #TisLastToDepth ok !$c->isLastToDepth(3); #TisLastToDepth ok $d->isLastToDepth(2); #TisLastToDepth ok !$d->isLastToDepth(4); #TisLastToDepth } #if (1) # Operators # {my $a = Data::Edit::Xml::new("<a id=\'1\'><b id=\'2\'><c id=\'3\'/></b></a>"); # my $b = $a >= [qw(b)]; ok $b->id == 2; # my $c = $b >= [qw(c)]; ok $c->id == 3; # # ok $c <= [qw(c b a)]; # $a x= sub {ok $_->id == 3 if $_ <= [qw(c b a)]}; # # my $A = $a >> \'<b id="4"/>\'; # ok -s $A eq \'<b id="4"/>\'; # ok -s $a eq \'<a id="1"><b id="4"/><b id="2"><c id="3"/></b></a>\'; # # my $B = $b > \'<b id="5"/>\'; # ok -s $B eq \'<b id="5"/>\'; # ok -s $a eq \'<a id="1"><b id="4"/><b id="2"><c id="3"/></b><b id="5"/></a>\'; # # my $C = $b < \'<b id="6"/>\'; # ok -s $C eq \'<b id="6"/>\'; # ok -s $a eq \'<a id="1"><b id="4"/><b id="6"/><b id="2"><c id="3"/></b><b id="5"/></a>\'; # # my $D = $b << qq(<d id="7"/>); # ok -s $D eq \'<d id="7"/>\'; # ok -s $a eq \'<a id="1"><b id="4"/><b id="6"/><b id="2"><c id="3"/><d id="7"/></b><b id="5"/></a>\'; Trenew # my $x = $a->renew; Trenew # ok -s $a eq \'<a id="1"><b id="4"/><b id="6"/><b id="2"><c id="3"/><d id="7"/></b><b id="5"/></a>\'; Trenew # ok 4 == grep{$_ <= [qw(b a)] } @$x; # ok $a % \'id\' == 1; # ok $b % \'id\' == 2; # ok $c % \'id\' == 3; # $a += qq(aa); # ok -t $a eq \'aa\'; # my $e = $a / qq(ee); # ok -s $e eq \'<ee><aa id="1"><b id="4"/><b id="6"/><b id="2"><c id="3"/><d id="7"/></b><b id="5"/></aa></ee>\'; # # my $f = $a * qq(f); # ok -s $e eq \'<ee><aa id="1"><f><b id="4"/><b id="6"/><b id="2"><c id="3"/><d id="7"/></b><b id="5"/></f></aa></ee>\'; # # --$c; # ok -s $e eq \'<ee><aa id="1"><f><b id="4"/><b id="6"/><b id="2"><d id="7"/></b><b id="5"/></f></aa></ee>\'; # # ++$a; # ok -s $e eq \'<ee><f><b id="4"/><b id="6"/><b id="2"><d id="7"/></b><b id="5"/></f></ee>\'; # } if (1) # Labels {my $x = Data::Edit::Xml::new("<a><b><c/></b></a>"); ok $x->stringReplacingIdsWithLabels eq \'<a><b><c/></b></a>\'; #TaddLabels #TcountLabels #TgetLabels #TstringNode my $b = $x->go(q(b)); #TaddLabels #TcountLabels #TgetLabels #TstringNode my $c = $b->go(q(c)); ok $b->countLabels == 0; #TaddLabels #TcountLabels #TgetLabels ok $c->countLabels == 0; $b->addLabels(1..2); #TaddLabels #TcountLabels #TgetLabels #TstringNode $b->addLabels(3..4); #TaddLabels #TcountLabels #TgetLabels #TstringNode ok $x->stringReplacingIdsWithLabels eq \'<a><b id="1, 2, 3, 4"><c/></b></a>\'; #TaddLabels #TgetLabels #TcopyLabels #TcountLabels #TstringNode $b->numberTree; #TstringNode ok -S $b eq "b(2) 0:1 1:2 2:3 3:4"; #TstringNode ok $b->countLabels == 4; #TcountLabels is_deeply [1..4], [$b->getLabels]; #TgetLabels $b->copyLabels($c) for 1..2; #TcopyLabels ok $x->stringReplacingIdsWithLabels eq \'<a><b id="1, 2, 3, 4"><c id="1, 2, 3, 4"/></b></a>\'; #TcopyLabels #TdeleteLabels ok $b->countLabels == 4; ok $c->countLabels == 4; is_deeply [1..4], [$b->getLabels]; is_deeply [1..4], [$c->getLabels]; $b->deleteLabels(1,4) for 1..2; #TdeleteLabels ok $x->stringReplacingIdsWithLabels eq \'<a><b id="2, 3"><c id="1, 2, 3, 4"/></b></a>\'; #TdeleteLabels #TmoveLabels ok $b->countLabels == 2; ok $c->countLabels == 4; is_deeply [2..3], [$b->getLabels]; is_deeply [1..4], [$c->getLabels]; $b->moveLabels($c) for 1..2; #TmoveLabels ok $x->stringReplacingIdsWithLabels eq \'<a><b><c id="1, 2, 3, 4"/></b></a>\'; #TmoveLabels ok $b->countLabels == 0; ok $c->countLabels == 4; is_deeply [], [$b->getLabels]; is_deeply [1..4], [$c->getLabels]; ok -s $x eq \'<a><b><c/></b></a>\'; $c->id = 11; ok -s $x eq \'<a><b><c id="11"/></b></a>\'; ok $x->stringReplacingIdsWithLabels eq \'<a><b><c id="1, 2, 3, 4"/></b></a>\'; ok -p $x eq <<END; #TwrapWith <a> <b> <c id="11"/> </b> </a> END $x->go(qw(b c))->wrapWith(qw(C id 1)); #TwrapWith ok -p $x eq <<END; #TwrapWith <a> <b> <C id="1"> <c id="11"/> </C> </b> </a> END $c->wrapContentWith(qw(D id 2)); # WrapContentWIth ok -s $x eq \'<a><b><C id="1"><c id="11"><D id="2"/></c></C></b></a>\'; $c->wrapContentWith(qw(E id 3)); ok -s $x eq \'<a><b><C id="1"><c id="11"><E id="3"><D id="2"/></E></c></C></b></a>\'; ok $x->stringReplacingIdsWithLabels eq \'<a><b><C><c id="1, 2, 3, 4"><E><D/></E></c></C></b></a>\'; $c->wrapUp(qw(A B)); # WrapUp ok -s $x eq \'<a><b><C id="1"><B><A><c id="11"><E id="3"><D id="2"/></E></c></A></B></C></b></a>\'; $c->wrapDown(qw(G F)); # WrapDown ok -s $x eq \'<a><b><C id="1"><B><A><c id="11"><G><F><E id="3"><D id="2"/></E></F></G></c></A></B></C></b></a>\'; } if (1) {my $x = Data::Edit::Xml::new("<a><b><c/></b></a>"); my $b = $x->go(q(b)); my $c = $x->go(qw(b c)); ok $x->stringReplacingIdsWithLabels eq \'<a><b><c/></b></a>\'; #TstringReplacingIdsWithLabels $b->addLabels(1..4); #TstringReplacingIdsWithLabels $c->addLabels(5..8); #TstringReplacingIdsWithLabels ok $x->stringReplacingIdsWithLabels eq \'<a><b id="1, 2, 3, 4"><c id="5, 6, 7, 8"/></b></a>\'; #TstringReplacingIdsWithLabels my $s = $x->stringReplacingIdsWithLabels; #TstringReplacingIdsWithLabels ok $s eq \'<a><b id="1, 2, 3, 4"><c id="5, 6, 7, 8"/></b></a>\'; #TstringReplacingIdsWithLabels $b->deleteLabels; $c->deleteLabels; ok $x->stringReplacingIdsWithLabels eq \'<a><b><c/></b></a>\'; } if (1) # X versions {my $x = Data::Edit::Xml::new("<a><b><c/><c/><c/></b></a>"); ok -p $x eq <<END; #TwrapContentWith <a> <b> <c/> <c/> <c/> </b> </a> END $x->go(q(b))->wrapContentWith(qw(D id DD)); #TwrapContentWith ok -p $x eq <<END; #TwrapContentWith <a> <b> <D id="DD"> <c/> <c/> <c/> </D> </b> </a> END } if (1) # X versions {my $a = Data::Edit::Xml::new(<<END); <a> <b id="1"/><c id="2"/><d id="3"/><c id="4"/><d id="5"/> <e id="6"/> <b id="7"/><c id="8"/><d id="9"/> <f id="10"/> </a> END ok -p $a eq <<END; #TwrapContentWith <a> <b id="1"/> <c id="2"/> <d id="3"/> <c id="4"/> <d id="5"/> <e id="6"/> <b id="7"/> <c id="8"/> <d id="9"/> <f id="10"/> </a> END my ($b, $e, $f) = $a->firstBy(qw(b e f)); ok $b->id == 1; ok $e->id == 6; ok $f->id == 10; ok $b->nextOn(qw(c)) ->id == 2; ok $b->nextOn(qw(c d))->id == 5; ok \'1 2 3 4 5\' eq join \' \', map {$_->id} $b->nextOn(qw(b c d)); ok $e->prevOn(qw(b c d))->id == 1; ok \'6 5 4 3 2 1\' eq join \' \', map {$_->id} $e->prevOn(qw(b c d)); ok \'6 5 4 3 2\' eq join \' \', map {$_->id} $e->prevOn(qw( c d)); } if (0) # X versions {my $a = Data::Edit::Xml::new("<a><b><c/></b></a>"); eval {my $c = $a->go(qw(b c)); my $d = $a->goX(qw(b c d)); ok 0; }; } if (1) {my $a = Data::Edit::Xml::new(<<END); <sli> <li> <p>Diagnose the problem</p> <p>This can be quite difficult</p> <p>Sometimes impossible</p> </li> <li> <p><pre>ls -la</pre></p> <p><pre> drwxr-xr-x 2 phil phil 4096 Jun 15 2016 Desktop drwxr-xr-x 2 phil phil 4096 Nov 9 20:26 Downloads </pre></p> </li> </sli> END # Transform to Dita step 1 $a->by(sub {my ($o, $p) = @_; if ($o->at(qw(pre p li sli)) and $o->isOnlyChild) {$o->change($p->isFirst ? qw(cmd) : qw(stepresult)); $p->unwrap; } elsif ($o->at(qw(li sli)) and $o->over(qr(\\Ap( p)+\\Z))) {$_->change($_->isFirst ? qw(cmd) : qw(info)) for $o->contents; } }); # Transform to Dita step 2 $a->by(sub {my ($o) = @_; $o->change(qw(step)) if $o->at(qw(li sli)); $o->change(qw(steps)) if $o->at(qw(sli)); $o->id = \'s\'.($o->position+1) if $o->at(qw(step)); $o->id = \'i\'.($o->index+1) if $o->at(qw(info)); $o->wrapWith(qw(screen)) if $o->at(qw(CDATA stepresult)); }); # Print the results is_deeply [split //, (-p $a) =~ s/\\s+//gsr], [split //, <<END =~ s/\\s+//gsr];# Dita <steps> <step id="s1"> <cmd>Diagnose the problem </cmd> <info id="i1">This can be quite difficult </info> <info id="i2">Sometimes impossible </info> </step> <step id="s2"> <cmd>ls -la </cmd> <stepresult> <screen> drwxr-xr-x 2 phil phil 4096 Jun 15 2016 Desktop drwxr-xr-x 2 phil phil 4096 Nov 9 20:26 Downloads </screen> </stepresult> </step> </steps> END } if (1) # Delete in context - methods {my $a = Data::Edit::Xml::new q(<a><b><c/></b><d><c/></d></a>); ok -s $a -> by(sub {$_ -> cut(qw(c b a))}) eq \'<a><b/><d><c/></d></a>\'; } if (1) # Delete in context - methods {my $a = Data::Edit::Xml::new q(<a><b><c/></b><d><c/></d></a>); ok -s $a -> by(sub {$_ -> cut_c_b_a}) eq \'<a><b/><d><c/></d></a>\'; } if (1) # Delete in context - chaining {my $a = Data::Edit::Xml::new("<a><b><c/></b><d><c/></d></a>"); $a->go_b_c__cut; ok -s $a eq \'<a><b/><d><c/></d></a>\'; } if (1) # Delete in context - operators {my $a = Data::Edit::Xml::new("<a><b><c/></b><d><c/></d></a>"); ok -s ($a x sub {--$_ if $_ <= [qw(c b a)]}) eq \'<a><b/><d><c/></d></a>\'; } if (1) # Delete in context - operators {my $a = Data::Edit::Xml::new("<a><b><c/></b><d><c/></d></a>"); ok -s ($a x sub{$_->cut_c_b_a}) eq \'<a><b/><d><c/></d></a>\'; } if (1) # Delete in context - exit chaining {my $a = Data::Edit::Xml::new("<a><b><c/></b><d><c/></d></a>"); ok -s $a->byX(sub {$_->at(qw(c b a))->cut}) eq \'<a><b/><d><c/></d></a>\'; } if (1) # Delete in context - exit chaining {my $a = Data::Edit::Xml::new("<a><b><c/></b></a>"); $a->byX(sub {die "found: c\\n" if $_->at(qw(c b a))}); ok $@ =~ m(\\Afound: c)s } if (1) # Delete in context - exit chaining {my $a = Data::Edit::Xml::new(<<END); <a> <p>• Minimum 1 number</p> <p>• No leading, trailing, or embedded spaces</p> <p>• Not case-sensitive</p> </a> END $a->by(sub # Bulleted list to <ul> {if ($_->at(qw(p))) # <p> {if (my $t = $_->containsSingleText) # <p> with single text {if ($t->text =~ s(\\A\\x{2022}\\s*) ()s) # Starting with a bullet {$_->change(qw(li)); # <p> to <li> if (my $p = $_->prev(qw(ul))) # Previous element is ul? {$p->putLast($_->cut); # Put in preceding list or create a new list } else {$_->wrapWith(qw(ul)) } } } } }); ok -p $a eq <<END; <a> <ul> <li>Minimum 1 number</li> <li>No leading, trailing, or embedded spaces</li> <li>Not case-sensitive</li> </ul> </a> END } if (1) # Bulleted list to <ul> {my $a = Data::Edit::Xml::new(<<END); <a> <p>• Minimum 1 number</p> <p>• No leading, trailing, or embedded spaces</p> <p>• Not case-sensitive</p> </a> END $a->change_ul->by(sub {$_->up__change_li if $_->text_p and $_->text =~ s/\\A•\\s*//s }); ok -p $a eq <<END; # Results <ul> <li>Minimum 1 number</li> <li>No leading, trailing, or embedded spaces</li> <li>Not case-sensitive</li> </ul> END } if (1) {my $x = Data::Edit::Xml::new(<<END); #TcopyAttrs #TmoveAttrs <x> <a a="1" b="2"/> <b b="3" c="4"/> <c/> </x> END my ($a, $b, $c) = $x->contents; #TcopyAttrs #TmoveAttrs $a->copyAttrs($b, qw(aa bb)); #TcopyAttrs ok <<END eq -p $x; #TcopyAttrs <x> <a a="1" b="2"/> <b b="3" c="4"/> <c/> </x> END $a->copyAttrs($b); #TcopyAttrs ok <<END eq -p $x; #TcopyAttrs <x> <a a="1" b="2"/> <b a="1" b="2" c="4"/> <c/> </x> END $a->moveAttrs($c, qw(aa bb)); #TmoveAttrs ok <<END eq -p $x; #TmoveAttrs <x> <a a="1" b="2"/> <b a="1" b="2" c="4"/> <c/> </x> END $b->moveAttrs($c); #TmoveAttrs ok <<END eq -p $x; #TmoveAttrs <x> <a a="1" b="2"/> <b/> <c a="1" b="2" c="4"/> </x> END } if (1) {my $x = Data::Edit::Xml::new(<<END); #TcopyNewAttrs #TmoveNewAttrs <x> <a a="1" b="2"/> <b b="3" c="4"/> <c/> </x> END my ($a, $b, $c) = $x->contents; #TcopyNewAttrs #TmoveNewAttrs $a->copyNewAttrs($b, qw(aa bb)); #TcopyNewAttrs ok <<END eq -p $x; #TcopyNewAttrs <x> <a a="1" b="2"/> <b b="3" c="4"/> <c/> </x> END $a->copyNewAttrs($b); #TcopyNewAttrs ok <<END eq -p $x; #TcopyNewAttrs <x> <a a="1" b="2"/> <b a="1" b="3" c="4"/> <c/> </x> END $b->moveNewAttrs($c, qw(aa bb)); #TmoveNewAttrs ok <<END eq -p $x; #TmoveNewAttrs <x> <a a="1" b="2"/> <b a="1" b="3" c="4"/> <c/> </x> END $b->moveNewAttrs($c); #TmoveNewAttrs ok <<END eq -p $x; #TmoveNewAttrs #Tswap <x> <a a="1" b="2"/> <b/> <c a="1" b="3" c="4"/> </x> END $a->swap($c); #Tswap ok <<END eq -p $x; #TmoveNewAttrs #Tswap <x> <c a="1" b="3" c="4"/> <b/> <a a="1" b="2"/> </x> END } if (1) {my $x = Data::Edit::Xml::new(<<END); #TisFirstText #TisLastText <x> <a>aaa <b>bbb</b> ccc <d>ddd</d> eee </a> </x> END my $a = $x->first; #TisFirstText my ($ta, $b, $tc, $d, $te) = $a->contents; #TisFirstText ok $ta ->isFirstText(qw(a x)); #TisFirstText ok $b->first->isFirstText(qw(b a x)); #TisFirstText ok $b->prev ->isFirstText(qw(a x)); #TisFirstText ok $d->last ->isFirstText(qw(d a x)); #TisFirstText ok $d->next ->isLastText (qw(a x)); #TisLastText ok $d->last ->isLastText (qw(d a x)); #TisLastText ok $te ->isLastText (qw(a x)); #TisLastText } if (1) {my $x = Data::Edit::Xml::new(<<END); #Tdiff #Tclone <x> <a>aaa <b>bbb</b> ccc <d>ddd</d> eee </a> </x> END ok !$x->diff($x); #Tdiff my $y = $x->clone; #Tdiff #Tclone ok !$x->diff($y); #Tdiff #Tclone $y->first->putLast($x->newTag(q(f))); #Tdiff ok nws(<<END) eq nws(-p $y); #Tdiff <x> <a>aaa <b>bbb</b> ccc <d>ddd</d> eee <f/> </a> </x> END is_deeply [$x->diff($y)], ["<d>ddd</d> eee <", "/a></x>", "f/></a></x>"]; #Tdiff is_deeply [diff(-p $x, $y)], ["<d>ddd</d> eee <", "/a></x>", "f/></a></x>"]; #Tdiff is_deeply [$x->diff(-p $y)], ["<d>ddd</d> eee <", "/a></x>", "f/></a></x>"]; #Tdiff my $X = writeFile(undef, -p $x); #Tdiff my $Y = writeFile(undef, -p $y); #Tdiff is_deeply [diff($X, $Y)], ["<d>ddd</d> eee <", "/a></x>", "f/></a></x>"]; #Tdiff unlink $X, $Y; } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tdata <a id="1"> <b id="2"/> <c id="3"/> <d id="4"/> </a> END my ($b, $c, $d) = $a->contents; #Tdata $c->data->{transform} = 1; #Tdata ok <<END eq -p $a; #Tdata <a id="1"> <b id="2"/> <c id="3"/> <d id="4"/> </a> END $a x= sub #Tdata {$_->cut if $_->data->{transform}; }; ok <<END eq -p $a; #Tdata <a id="1"> <b id="2"/> <d id="4"/> </a> END } ok xmlHeader("<a/>") eq <<END; #TxmlHeader <?xml version="1.0" encoding="UTF-8"?> <a/> END if (1) {my $a = Data::Edit::Xml::new("<a><b/></a>"); #Tcrc my ($b) = $a->contents; #Tcrc changeReasonCommentSelectionSpecification = {ccc=>1, ddd=>1}; #Tcrc #TchangeReasonCommentSelectionSpecification $b->putFirst(my $c = $b->newTag(q(c))); #Tcrc $c->crc($_) for qw(aaa ccc); #Tcrc ok <<END eq -p $a; #Tcrc <a> <b><!--ccc--> <c/> </b> </a> END changeReasonCommentSelectionSpecification = undef; #Tcrc #TchangeReasonCommentSelectionSpecification $c->putFirst(my $d = $c->newTag(q(d))); #Tcrc $d->crc($_) for qw(aaa ccc); #Tcrc ok <<END eq -p $a; #Tcrc <a> <b><!--ccc--> <c> <d/> </c> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TrequiredCleanUp <a> <b> <c> ccc </c> </b> </a> END my ($b) = $a->contents; #TrequiredCleanUp $b->requiredCleanUp(q(33)); #TrequiredCleanUp ok -p $a eq <<END; #TrequiredCleanUp <a> <required-cleanup outputclass="33"><b> <c> ccc </c> </b> </required-cleanup> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TreplaceWithRequiredCleanUp <a> <b/> </a> END my ($b) = $a->contents; #TreplaceWithRequiredCleanUp $b->replaceWithRequiredCleanUp(q(bb)); #TreplaceWithRequiredCleanUp ok -p $a eq <<END; #TreplaceWithRequiredCleanUp <a> <required-cleanup>bb</required-cleanup> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TunwrapParentsWithSingleChild <a> <b> <c> <d/> </c> </b> <e/> </a> END $a->go(qw(b c d))->unwrapParentsWithSingleChild; #TunwrapParentsWithSingleChild ok -p $a eq <<END; #TunwrapParentsWithSingleChild <a> <d/> <e/> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TputFirstRequiredCleanUp <a> <b/> </a> END $a->putFirstRequiredCleanUp(qq(1111\\n)); #TputFirstRequiredCleanUp ok -p $a eq <<END; #TputFirstRequiredCleanUp #TputLastRequiredCleanUp <a> <required-cleanup>1111 </required-cleanup> <b/> </a> END $a->putLastRequiredCleanUp(qq(4444\\n)); #TputLastRequiredCleanUp ok -p $a eq <<END; #TputLastRequiredCleanUp #TputNextRequiredCleanUp <a> <required-cleanup>1111 </required-cleanup> <b/> <required-cleanup>4444 </required-cleanup> </a> END $a->go(q(b))->putNextRequiredCleanUp(qq(3333\\n)); #TputNextRequiredCleanUp ok -p $a eq <<END; #TputNextRequiredCleanUp #TputPrevRequiredCleanUp <a> <required-cleanup>1111 </required-cleanup> <b/> <required-cleanup>3333 </required-cleanup> <required-cleanup>4444 </required-cleanup> </a> END $a->go(q(b))->putPrevRequiredCleanUp(qq(2222\\n)); #TputPrevRequiredCleanUp ok -p $a eq <<END; #TputPrevRequiredCleanUp <a> <required-cleanup>1111 </required-cleanup> <required-cleanup>2222 </required-cleanup> <b/> <required-cleanup>3333 </required-cleanup> <required-cleanup>4444 </required-cleanup> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tinvert <a> <b id="b"> <c id="c"> <d/> <e/> </c> </b> </a> END $a->first->invert; #Tinvert ok -p $a eq <<END; #Tinvert <a> <c id="c"> <b id="b"> <d/> <e/> </b> </c> </a> END $a->first->invert; #Tinvert ok -p $a eq <<END; #Tinvert <a> <b id="b"> <c id="c"> <d/> <e/> </c> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TinvertFirst #TinvertLast <a> <b> <c> <d/> <e/> </c> <f/> <g/> </b> </a> END $a->first->invertFirst; ok -p $a eq <<END; #TinvertFirst #TinvertLast <a> <c> <d/> <e/> <b> <f/> <g/> </b> </c> </a> END $a->first->invertLast; ok -p $a eq <<END; #TinvertLast <a> <b> <c> <d/> <e/> </c> <f/> <g/> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TmergeDuplicateChildWithParent #ThasSingleChild <a> <b id="b" b="bb"> <b id="c" c="cc"/> </b> </a> END my ($c, $b) = $a->byList; #TmergeDuplicateChildWithParent #ThasSingleChild is_deeply [$b->id, $c->id], [qw(b c)]; #TmergeDuplicateChildWithParent #ThasSingleChild ok $c == $b->hasSingleChild; #TmergeDuplicateChildWithParent #ThasSingleChild $b->mergeDuplicateChildWithParent; #TmergeDuplicateChildWithParent ok -p $a eq <<END; #TmergeDuplicateChildWithParent <a> <b b="bb" c="cc" id="b"/> </a> END ok $b == $a->hasSingleChild; #TmergeDuplicateChildWithParent #ThasSingleChild } # Dita tests if (1) {my $a = Data::Edit::Xml::new(<<END); #TditaObviousChanges <dita> <ol> <li><para>aaa</para></li> <li><para>bbb</para></li> </ol> </dita> END $a->ditaObviousChanges; #TditaObviousChanges ok -p $a eq <<END; #TditaListToSteps #TditaStepsToList #TditaObviousChanges <dita> <ol> <li> <p>aaa</p> </li> <li> <p>bbb</p> </li> </ol> </dita> END $a->first->ditaListToSteps; #TditaListToSteps ok -p $a eq <<END; #TditaListToSteps <dita> <steps> <step> <cmd>aaa</cmd> </step> <step> <cmd>bbb</cmd> </step> </steps> </dita> END $a->first->ditaStepsToList; #TditaStepsToList ok -p $a eq <<END; #TditaStepsToList #TditaListToStepsUnordered <dita> <ol> <li>aaa</li> <li>bbb</li> </ol> </dita> END $a->first->ditaListToStepsUnordered; #TditaListToStepsUnordered ok -p $a eq <<END; #TditaListToStepsUnordered <dita> <steps-unordered> <step> <cmd>aaa</cmd> </step> <step> <cmd>bbb</cmd> </step> </steps-unordered> </dita> END ok Data::Edit::Xml::new(q(<concept/>))->ditaTopicHeaders eq <<END; #TditaTopicHeaders <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd" []> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TditaListToSubSteps <dita> <ol> <li>aaa</li> <li>bbb</li> </ol> </dita> END $a->first->ditaListToSubSteps; #TditaListToSubSteps ok -p $a eq <<END; #TditaListToSubSteps <dita> <substeps> <substep> <cmd>aaa</cmd> </substep> <substep> <cmd>bbb</cmd> </substep> </substeps> </dita> END } if (1) {my $x = Data::Edit::Xml::new(<<END); #ThtmlHeadersToSections #TdivideDocumentIntoSections <x> <h1>h1</h1> H1 <h2>h2</h2> H2 <h3>h3</h3> H3 <h3>h3</h3> H3 <h2>h2</h2> H2 <h4>h4</h4> H4 </x> END my %file; $x->htmlHeadersToSections; #ThtmlHeadersToSections #TdivideDocumentIntoSections $x->divideDocumentIntoSections(sub #ThtmlHeadersToSections #TdivideDocumentIntoSections {my ($topicref, $section) = @_; #ThtmlHeadersToSections #TdivideDocumentIntoSections my $file = keys %file; #ThtmlHeadersToSections #TdivideDocumentIntoSections $topicref->href = $file; #ThtmlHeadersToSections #TdivideDocumentIntoSections $file{$file} = -p $section; #ThtmlHeadersToSections #TdivideDocumentIntoSections $section->cut; #ThtmlHeadersToSections #TdivideDocumentIntoSections }); #ThtmlHeadersToSections #TdivideDocumentIntoSections ok -p $x eq <<END; #ThtmlHeadersToSections #TdivideDocumentIntoSections <x> <topicref href="0"> <topicref href="1"> <topicref href="2"/> <topicref href="3"/> </topicref> <topicref href="4"> <topicref href="5"/> </topicref> </topicref> </x> END ok nn(dump({map {$_=>nn($file{$_})} keys %file})) eq nn(dump( #ThtmlHeadersToSections #TdivideDocumentIntoSections {"0" => "<section level=\\"1\\">N <h1>h1</h1>NN H1NN</section>N", #ThtmlHeadersToSections #TdivideDocumentIntoSections "1" => "<section level=\\"2\\">N <h2>h2</h2>NN H2NN</section>N", #ThtmlHeadersToSections #TdivideDocumentIntoSections "2" => "<section level=\\"3\\">N <h3>h3</h3>NN H3NN</section>N", #ThtmlHeadersToSections #TdivideDocumentIntoSections "3" => "<section level=\\"3\\">N <h3>h3</h3>NN H3NN</section>N", #ThtmlHeadersToSections #TdivideDocumentIntoSections "4" => "<section level=\\"2\\">N <h2>h2</h2>NN H2NN</section>N", #ThtmlHeadersToSections #TdivideDocumentIntoSections "5" => "<section level=\\"4\\">N <h4>h4</h4>NN H4NN</section>N", #ThtmlHeadersToSections #TdivideDocumentIntoSections })); } if (1) {my $a = Data::Edit::Xml::new(<<END); #TnumberTreesJustIds <a>A <b id="bb">B <c/> <d>D <e id="ee"/> E <f/> F </d> G </b> H </a> END $a->numberTreesJustIds(q(T)); #TnumberTreesJustIds my $A = Data::Edit::Xml::new(<<END); #TnumberTreesJustIds <a id="T1">A <b id="bb">B <c id="T2"/> <d id="T3">D <e id="ee"/> E <f id="T4"/> F </d> G </b> H </a> END ok -p $a eq -p $A; #TnumberTreesJustIds } if (1) {my $a = Data::Edit::Xml::new(<<END); #TchangeText <a>Hello World</a> END $a->first->changeText(sub{s(l) (L)g}); #TchangeText ok -s $a eq q(<a>HeLLo WorLd</a>); #TchangeText } if (1) {my $a = Data::Edit::Xml::new(<<END); #TindexIds <a id="A"> <b id="B"> <c id="C"/> <d id="D"> <e id="E"/> <f id="F"/> </d> </b> </a> END my $i = $a->indexIds; #TindexIds ok $i->{C}->tag eq q(c); #TindexIds ok $i->{E}->tag eq q(e); #TindexIds } if (1) {my $a = Data::Edit::Xml::new(<<END); #TcreatePatch #TData::Edit::Xml::Patch::install <a>Aaaaa <b b1="b1" b2="b2">Bbbbb <c c1="c1" />Ccccc <d d1="d1" >Ddddd <e e1="e1" /> Eeeee <f f1="f1" /> Fffff </d> Ggggg </b> Hhhhhh </a> END my $A = Data::Edit::Xml::new(<<END); #TcreatePatch #TData::Edit::Xml::Patch::install <a>AaaAaaA <b b1="b1" b3="B3">BbbBbbB <c c1="C1" />Ccccc <d d2="D2" >DddDddD <e e3="E3" /> EeeEeeE <f f1="F1" /> FffFffF </d> GggGggG </b> Hhhhhh </a> END $a->numberTreesJustIds(q(a)); #TcreatePatch #TData::Edit::Xml::Patch::install $A->numberTreesJustIds(q(a)); #TcreatePatch #TData::Edit::Xml::Patch::install my $patches = $a->createPatch($A); #TcreatePatch #TData::Edit::Xml::Patch::install $patches->install($a); #TcreatePatch #TData::Edit::Xml::Patch::install ok !$a->diff ($A); #TcreatePatch #TData::Edit::Xml::Patch::install ok $a->equals($A); #TcreatePatch #TData::Edit::Xml::Patch::install } if (1) {my $a = Data::Edit::Xml::new(<<END); #TupThru <a> <b> <c/> <d> <e/> <f/> </d> </b> </a> END my ($c, $e, $f, $d, $b) = $a->byList; #TupThru ok -t $f eq q(f); #TupThru ok -t $f->upThru eq q(f); #TupThru ok -t $f->upThru(qw(d)) eq q(d); #TupThru ok -t eval{$f->upThru(qw(d))->last->prev} eq q(e); #TupThru ok ! eval{$f->upThru(qw(d b))->next}; #TupThru } if (1) {my $a = Data::Edit::Xml::newTree(q(a)); #TaddFirst $a->addFirst(qw(b id b)) for 1..2; #TaddFirst ok -p $a eq <<END; #TaddFirst #TaddLast <a> <b id="b"/> </a> END $a->addLast(qw(e id e)) for 1..2; #TaddLast ok -p $a eq <<END; #TaddLast #TaddNext <a> <b id="b"/> <e id="e"/> </a> END $a->addFirst(qw(b id B))->addNext(qw(c id c)); #TaddNext ok -p $a eq <<END; #TaddNext #TaddPrev <a> <b id="b"/> <c id="c"/> <e id="e"/> </a> END $a->addLast(qw(e id E))->addPrev(qw(d id d)); #TaddPrev ok -p $a eq <<END; #TaddPrev <a> <b id="b"/> <c id="c"/> <d id="d"/> <e id="e"/> </a> END } if (1) {my $a = Data::Edit::Xml::new(q(<a><b/></a>)); #TaddWrapWith my $b = $a->first; #TaddWrapWith $b->addWrapWith(qw(c id c)) for 1..2; #TaddWrapWith ok -p $a eq <<END; #TaddWrapWith #TaddSingleChild <a> <c id="c"> <b/> </c> </a> END $a->addSingleChild(q(d)) for 1..2; #TaddSingleChild ok -p $a eq <<END; #TaddSingleChild <a> <d> <c id="c"> <b/> </c> </d> </a> END } if (1) {my $a = Data::Edit::Xml::newTree(q(a)); #TaddFirstAsText $a->addFirstAsText(q(aaaa)) for 1..2; #TaddFirstAsText ok -s $a eq q(<a>aaaa</a>); #TaddFirstAsText #TaddLastAsText $a->addLastAsText(q(dddd)) for 1..2; #TaddLastAsText ok -s $a eq q(<a>aaaadddd</a>); #TaddLastAsText } if (1) {my $a = Data::Edit::Xml::new(q(<a><b/></a>)); #TaddNextAsText $a->go(q(b))->addNextAsText(q(bbbb)) for 1..2; #TaddNextAsText ok -p $a eq <<END; #TaddNextAsText #TaddPrevAsText <a> <b/> bbbb </a> END $a->go(q(b))->addPrevAsText(q(aaaa)) for 1..2; #TaddPrevAsText ok -p $a eq <<END; #TaddPrevAsText <a>aaaa <b/> bbbb </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TditaParagraphToNote <a> <p> Note: see over for details.</p> </a> END $a->ditaParagraphToNote(1); #TditaParagraphToNote ok -p $a eq <<END; #TditaParagraphToNote <a> <note> <p>See over for details.</p> </note> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tpropagate <a> <b b="B"> <b c="C"> <c/> <b d="D"> <d/> <b e="E"> <e/> </b> </b> </b> </b> </a> END $a->propagate(q(b)); #Tpropagate ok -p $a eq <<END; #Tpropagate <a> <c b="B" c="C"/> <d b="B" c="C" d="D"/> <e b="B" c="C" d="D" e="E"/> </a> END } if (1) {my $a = Data::Edit::Xml::new(q(<a><b/><c/><d/></a>)); #TwrapSiblingsBefore my ($b, $c, $d) = $a->byList; #TwrapSiblingsBefore $c->wrapSiblingsBefore(q(X)); #TwrapSiblingsBefore ok -p $a eq <<END; #TwrapSiblingsBefore <a> <X> <b/> </X> <c/> <d/> </a> END } if (1) {my $a = Data::Edit::Xml::new(q(<a><b/><c/><d/></a>)); #TwrapSiblingsAfter my ($b, $c, $d) = $a->byList; #TwrapSiblingsAfter $c->wrapSiblingsAfter(q(Y)); #TwrapSiblingsAfter ok -p $a eq <<END; #TwrapSiblingsAfter <a> <b/> <c/> <Y> <d/> </Y> </a> END } if (1) {my $a = Data::Edit::Xml::new(q(<a><b/><c/><d/></a>)); #TwrapSiblingsBetween my ($b, $c, $d) = $a->byList; #TwrapSiblingsBetween $b->wrapSiblingsBetween($d, q(Y)); #TwrapSiblingsBetween ok -p $a eq <<END; #TwrapSiblingsBetween <a> <b/> <Y> <c/> </Y> <d/> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TwordStyles <a> <text:list-style style:name="aa"> <text:list-level-style-bullet text:level="2"/> </text:list-style> </a> END my $styles = $a->wordStyles; #TwordStyles is_deeply $styles, {bulletedList=>{aa=>{2=>1}}}; #TwordStyles } if (1) {my $a = Data::Edit::Xml::new(<<END); #ThtmlTableToDita <table> <thead> <tr> <th>Month</th> <th>Savings</th> <th>Phone</th> <th>Comment</th> </tr> </thead> <tbody> <tr> <td>January</td> <td>100</td> <td>555-1212</td> </tr> <tr> <td>February</td> <td>80</td> </tr> </tbody> </table> END $a->htmlTableToDita; #ThtmlTableToDita ok -p $a eq <<END; #ThtmlTableToDita <table> <tgroup cols="4"> <colspec colname="c1" colnum="1" colwidth="1*"/> <colspec colname="c2" colnum="2" colwidth="1*"/> <colspec colname="c3" colnum="3" colwidth="1*"/> <colspec colname="c4" colnum="4" colwidth="1*"/> <thead> <row> <entry>Month</entry> <entry>Savings</entry> <entry>Phone</entry> <entry>Comment</entry> </row> </thead> <tbody> <row> <entry>January</entry> <entry>100</entry> <entry nameend="c4" namest="c3">555-1212</entry> </row> <row> <entry>February</entry> <entry nameend="c4" namest="c2">80</entry> </row> </tbody> </tgroup> </table> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TforestNumberTrees <a> <b id="b"> <c/> </b> <b id="B"> <d/> <e/> </b> </a> END my $e = $a->go(qw(b -1 e)); #TforestNumberTrees $e->forestNumberTrees(1); #TforestNumberTrees ok -p $a eq <<END; #TforestNumberTrees #TfindByForestNumber <a id="1_1"> <b id="1_2"> <c id="1_3"/> </b> <b id="1_4"> <d id="1_5"/> <e id="1_6"/> </b> </a> END my $b = $e->findByForestNumber(1, 2); is_deeply [$b->getLabels], ["b"]; my $B = $e->findByForestNumber(1, 4); #TfindByForestNumber is_deeply [$B->getLabels], ["B"]; #TfindByForestNumber } if (1) {my $a = Data::Edit::Xml::new(<<END); #TgoFish <a> <b> <c> <d/> </c> <c/> </b> <b/> </a> END if (1) { my ($good, $fail, $possible) = $a->goFish(qw(b c D)); #TgoFish ok $fail eq q(D); #TgoFish is_deeply $good, [qw(b c)]; #TgoFish is_deeply $possible, [q(d)]; #TgoFish } if (1) {my ($good, $fail, $possible) = $a->goFish(qw(b 3)); ok $fail eq q(3); is_deeply $good, [q(b)]; is_deeply $possible, [0..2]; } if (1) {my ($good, $fail, $possible) = $a->goFish(qw(b 0 c D)); ok $fail eq q(D); is_deeply $good, [qw(b 0 c)]; is_deeply $possible, [qw(d)]; } if (1) {my ($g, $f, $p) = $a->goFish(qw(b c d)); is_deeply $g, [qw(b c d)]; ok !$f; ok !$p; } } if (1) {my $a = Data::Edit::Xml::new(<<END); #TisFirst #TisLast #TisOnlyChild #ThowFirst #ThowLast #ThowOnlyChild #ThowFarAbove #ThowFarBelow #ThowFar #Tadjacent #TcommonAdjacentAncestors <a> <b> <c> <d/> </c> </b> <b> <c/> </b> <e> <f/> </e> </a> END my ($d, $c, $b, $C, $B, $f, $e) = $a->byList; #TisFirst #TisLast #TisOnlyChild #ThowFirst #ThowLast #ThowOnlyChild #ThowFarAbove #ThowFarBelow #ThowFar #Tadjacent #TcommonAdjacentAncestors is_deeply [$d->commonAdjacentAncestors($C)], [$b, $B]; #TcommonAdjacentAncestors #ThowFar ok $d->howFar($d) == 0; #ThowFar ok $d->howFar($a) == 3; #ThowFar ok $b->howFar($B) == 1; #ThowFar ok $d->howFar($f) == 5; #ThowFar ok $d->howFar($C) == 4; #ThowFar ok $a->isFirst; #TisFirst ok $a->isLast; #TisLast ok $a->isOnlyChild; #TisOnlyChild ok !$a->adjacent($B); #Tadjacent ok $b->adjacent($B); #Tadjacent ok $d->howFirst == 4; #ThowFirst ok $f->howLast == 3; #ThowLast ok $d->howOnlyChild == 2; #ThowOnlyChild ok $a->howFarAbove($d) == 3; #ThowFarAbove ok !$d->howFarAbove($c); #ThowFarAbove ok $d->howFarBelow($a) == 3; #ThowFarBelow ok !$c->howFarBelow($d); #ThowFarBelow } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tnot <a> <b/> </a> END ok $a->first->not_a_c; #Tnot } if (1) {my $a = Data::Edit::Xml::new(<<END); #TAUTOLOAD <a> <b> <c/> </b> </a> END my ($c, $b) = $a->byList; #TAUTOLOAD ok $c->at_c_b_a; #TAUTOLOAD ok !$c->at_b; #TAUTOLOAD ok -t $c->change_d_c_b eq q(d); #TAUTOLOAD ok ! $c->change_d_b; #TAUTOLOAD } if (1) {my $a = Data::Edit::Xml::new(<<END); #TditaMergeLists <a> <li id="1"/> <ol/> <ol> <li id="2"/> <li id="3"/> </ol> </a> END $a x= sub{$_->ditaMergeLists}; #TditaMergeLists ok -p $a eq <<END; #TditaMergeLists <a> <ol> <li id="1"/> <li id="2"/> <li id="3"/> </ol> </a> END } if (1) {my $a = Data::Edit::Xml::new(q(<a a="1" b="2" c="3" d="4" e="5"/>)); #TcountAttrNamesOnTagExcluding ok $a->countAttrNamesOnTagExcluding_a_b == 3; END } if (1) {my $a = Data::Edit::Xml::new(<<END); #Tapn #Tap #Tan #TupWhileFirst #TupUntilFirst #TupWhileLast #TupUntilLast #TupWhileIsOnlyChild #TupUntilIsOnlyChild #TdownWhileFirst #TdownWhileLast #TdownWhileIsOnlyChild #ThasSingleChildToDepth #TparentOf #TchildOf <a> <b> <c/> <d/> <e> <j/> </e> <f/> </b> <g> <h> <i> <k/> <l/> </i> </h> </g> </a> END my ($c, $d, $j, $e, $f, $b, $k, $l, $i, $h, $g) = $a->byList; #Tapn #Tap #Tan #TupWhileFirst #TupUntilFirst #TupWhileLast #TupUntilLast #TupWhileIsOnlyChild #TupUntilIsOnlyChild #TdownWhileFirst #TdownWhileLast #TdownWhileSingleChild #ThasSingleChildToDepth ok $h == $g->hasSingleChildToDepth(1); #ThasSingleChildToDepth ok $i == $g->hasSingleChildToDepth(2); #ThasSingleChildToDepth ok !$g->hasSingleChildToDepth(0); #ThasSingleChildToDepth ok !$g->hasSingleChildToDepth(3); #ThasSingleChildToDepth ok $i == $i->hasSingleChildToDepth(0); #ThasSingleChildToDepth ok $h == $g->downWhileHasSingleChild; #TdownWhileHasSingleChild ok $h == $h->downWhileHasSingleChild; #TdownWhileHasSingleChild ok !$i->downWhileHasSingleChild; #TdownWhileHasSingleChild ok $k == $g->downWhileFirst; #TdownWhileFirst ok $c == $a->downWhileFirst; #TdownWhileFirst ok $c == $c->downWhileFirst; #TdownWhileFirst ok !$d->downWhileFirst; #TdownWhileFirst ok $l == $a->downWhileLast; #TdownWhileLast ok $l == $g->downWhileLast; #TdownWhileLast ok !$d->downWhileLast; #TdownWhileLast ok $h == $i->upWhileIsOnlyChild; #TupWhileIsOnlyChild ok $j == $j->upWhileIsOnlyChild; #TupWhileIsOnlyChild ok !$d->upWhileIsOnlyChild; #TupWhileIsOnlyChild ok $i == $k->upUntilIsOnlyChild; #TupUntilIsOnlyChild is_deeply[$c, $e], [$d->apn_c_d_e_b_a]; #Tapn ok $c == $d->ap_d_c_b_a; #Tap ok $c == $d->ap_d; #Tap ok !$c->ap_c; #Tap ok $e == $d->an_d_e_b_a; #Tan ok $f == $e->an_e; #Tan ok !$f->an_f; #Tan ok $h == $i->upWhileFirst; #TupWhileFirst ok $a == $c->upWhileFirst; #TupWhileFirst ok !$d->upWhileFirst; #TupWhileFirst ok $b == $d->upUntilFirst; #TupUntilFirst ok $j == $j->upWhileLast; #TupWhileLast ok $a == $l->upWhileLast; #TupWhileLast ok !$d->upWhileLast; #TupWhileLast ok $i == $k->upUntilLast; #TupWhileLast ok $j->childOf($e); #TchildOf ok $e->parentOf($j); #TparentOf } if (1) {my $a = Data::Edit::Xml::new(<<END); #TputFirstCut <a> <b> <c/> <d/> </b> </a> END my ($c, $d, $b) = $a->byList; #TputFirstCut $c->putFirstCut($d, qw(c b a)); #TputFirstCut ok -p $a eq <<END; #TputFirstCut <a> <b> <c> <d/> </c> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TputLastCut <a> <b> <c/> <d/> </b> </a> END my ($c, $d, $b) = $a->byList; #TputLastCut $a->putLastCut($d, qw(a)); #TputLastCut ok -p $a eq <<END; #TputLastCut <a> <b> <c/> </b> <d/> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TputNextCut <a> <b> <c/> <d/> </b> </a> END my ($c, $d, $b) = $a->byList; #TputNextCut $d->putNextCut($c, qw(d b a)); #TputNextCut ok -p $a eq <<END; #TputNextCut <a> <b> <d/> <c/> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TputPrevCut <a> <b> <c/> <d/> </b> </a> END my ($c, $d, $b) = $a->byList; #TputPrevCut $c->putPrevCut($d, qw(c b a)); #TputPrevCut ok -p $a eq <<END; #TputPrevCut <a> <b> <d/> <c/> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TopWrapContentWith <a> <b> <c/> <d/> </b> </a> END my ($c, $d, $b) = $a->byList; #TopWrapContentWith $b *= q(B); #TopWrapContentWith ok -p $a eq <<END; #TopWrapContentWith <a> <b> <B> <c/> <d/> </B> </b> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TopUnwrap <a> <b> <c/> <d/> </b> </a> END my ($c, $d, $b) = $a->byList; #TopUnwrap $b++; #TopUnwrap ok -p $a eq <<END; #TopUnwrap <a> <c/> <d/> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TequalsIgnoringAttributes <a> <b id="1" outputclass="1" name="b"> <c id="2" outputclass="2" name="c"/> </b> </a> END my $A = Data::Edit::Xml::new(<<END); #TequalsIgnoringAttributes <a> <b id="11" outputclass="11" name="b"> <c id="22" outputclass="22" name="c"/> </b> </a> END ok !$a->equals($A); #TequalsIgnoringAttributes ok !$a->equalsIgnoringAttributes($A, qw(id)); #TequalsIgnoringAttributes ok $a->equalsIgnoringAttributes($A, qw(id outputclass)); #TequalsIgnoringAttributes } if (1) {my $a = Data::Edit::Xml::new(<<END); #TstringExtendingIdsWithLabels <a id="a"> <b id="b"> <c id="c"/> </b> <b id="B"> <c id="C"/> </b> </a> END my $A = Data::Edit::Xml::new(<<END); <a id="aa"> <b id="bb"> <c id="cc"/> </b> <b> <c/> </b> </a> END my $N = 0; $a->by(sub{$_->addLabels((-t $_).++$N)}); #TstringExtendingIdsWithLabels ok -p (new $a->stringExtendingIdsWithLabels) eq <<END; #TcopyLabelsAndIdsInTree #TstringExtendingIdsWithLabels <a id="a, a5"> <b id="b, b2"> <c id="c, c1"/> </b> <b id="B, b4"> <c id="C, c3"/> </b> </a> END ok -p (new $A->stringExtendingIdsWithLabels) eq <<END; #TcopyLabelsAndIdsInTree <a id="aa"> <b id="bb"> <c id="cc"/> </b> <b> <c/> </b> </a> END ok $a->copyLabelsAndIdsInTree($A) == 10; #TcopyLabelsAndIdsInTree ok -p (new $A->stringExtendingIdsWithLabels) eq <<END; #TcopyLabelsAndIdsInTree #TlabelsInTree <a id="aa, a, a5"> <b id="bb, b, b2"> <c id="cc, c, c1"/> </b> <b id="B, b4"> <c id="C, c3"/> </b> </a> END is_deeply [sort keys %{$A->labelsInTree}], #TlabelsInTree ["B", "C", "a", "a5", "b", "b2", "b4", "c", "c1", "c3"]; #TlabelsInTree } if (1) #TmatchTree {my $a = Data::Edit::Xml::new(<<END); <a> <b> <c/> <d/> </b> <e> <f> <g/> </f> </e> </a> END my ($c, $d, $b, $g, $f, $e) = $a->byList; is_deeply [$b, $c, $d], [$b->matchTree(qw(b c d))]; is_deeply [$e, $f, $g], [$e->matchTree(qr(\\Ae\\Z), [qw(f g)])]; is_deeply [$c], [$c->matchTree(qw(c))]; is_deeply [$a, $b, $c, $d, $e, $f, $g], [$a->matchTree({a=>1}, [qw(b c d)], [qw(e), [qw(f g)]])]; } if (1) #Toat #Toft #Tolt {my $a = Data::Edit::Xml::new(<<END); <a> <b> <c/> <d/> </b> <e> <f> <g/> </f> </e> </a> END my ($c, $d, $b, $g, $f, $e) = $a->byList; ok $b->oat_c_d; ok $a->oat_b_e; ok $g->oat; ok !$b->oat_d; ok $a->oft_b; ok $b->oft_c; ok $f->oft_g; ok $g->oft; ok !$b->oft_d; ok $a->olt_e; ok $b->olt_d; ok $f->olt_g; ok $g->olt; ok !$b->olt_c; } if (1) #Tmpt #Tmnt {my $a = Data::Edit::Xml::new(<<END); <a> <b/> <c/> <d/> <e/> <f/> <g/> </a> END my ($b, $c, $d, $e, $f, $g) = $a->contents; ok $f->mpt_e_d_c; ok !$f->mpt_e_d_b; ok $c->mnt_d_e_f; ok !$c->mnt_e; } if (1) #ToverAllTags #ToverFirstTags #ToverLastTags {my $a = Data::Edit::Xml::new(<<END); <a> <b/> <c/> <d/> </a> END ok $a->overAllTags_b_c_d; ok !$a->overAllTags_b_c; ok !$a->overAllTags_b_c_d_e; ok $a->oat_b_c_d; ok !$a->oat_B_c_d; ok $a->overFirstTags_b_c_d; ok $a->overFirstTags_b_c; ok !$a->overFirstTags_b_c_d_e; ok $a->oft_b_c; ok !$a->oft_B_c; ok $a->overLastTags_b_c_d; ok $a->overLastTags_c_d; ok !$a->overLastTags_b_c_d_e; ok $a->olt_c_d; ok !$a->olt_C_d; } if (1) {my $a = Data::Edit::Xml::new(<<END); #TfirstTextMatches #TlastTextMatches #TnextTextMatches #TprevTextMatches #TdeleteContent <a> <b>bb<c>cc</c>BB </b> </a> END my ($bb, $cc, $c, $BB, $b) = $a->byList; #TfirstTextMatches #TlastTextMatches ok $bb->matchesText(qr(bb)); #TfirstTextMatches ok $b->at_b_a && $b->firstTextMatches(qr(bb)); #TfirstTextMatches ok $b->firstTextMatches(qr(bb), qw(b a)); #TfirstTextMatches ok $c->at_c_b && $c->firstTextMatches(qr(cc)); #TfirstTextMatches ok $c->at_c_b && !$c->firstTextMatches(qr(bb)); #TfirstTextMatches ok $BB->matchesText(qr(BB)); #TlastTextMatches ok $b->at_b_a && $b->lastTextMatches(qr(BB)); #TlastTextMatches ok $b->lastTextMatches(qr(BB), qw(b a)); #TlastTextMatches ok $c->at_c_b && $c->lastTextMatches(qr(cc)); #TlastTextMatches ok $c->at_c_b && !$c->lastTextMatches(qr(bb)); #TlastTextMatches ok $cc->matchesText(qr(cc)); #TnextTextMatches #TprevTextMatches ok $c->at_c_b && $c->prevTextMatches(qr(bb)); #TprevTextMatches ok $c->at_c_b && $c->nextTextMatches(qr(BB)); #TnextTextMatches ok $b->at_b && !$b->prevTextMatches(qr(bb)); #TprevTextMatches ok $b->at_b && !$b->nextTextMatches(qr(BB)); #TnextTextMatches $b->deleteContent; #TdeleteContent ok -p $a eq <<END; #TdeleteContent <a> <b/> </a> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TprettyString <a> <b>bbb</b>. <c>ccc</c>. </a> END ok nn(-p $a) eq qq(<a>N <b>bbb</b>.NN N <c>ccc</c>.NNN</a>N); #TprettyString } if (1) {my $a = Data::Edit::Xml::new(<<END); #TchangeAttributeValue <a aa="abc"/> END $a->changeAttributeValue(q(aa), sub{s(b) (B)}); #TchangeAttributeValue ok -p $a eq <<END; #TchangeAttributeValue <a aa="aBc"/> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TditaOrganization #TprettyStringDitaHeaders #TopString <concept/> END Data::Edit::Xml::ditaOrganization = q(ACT); #TditaOrganization #TprettyStringDitaHeaders #TopString ok $a->prettyStringDitaHeaders eq <<END; #TditaOrganization #TprettyStringDitaHeaders #TopString <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE concept PUBLIC "-//ACT//DTD DITA Concept//EN" "concept.dtd" []> <concept/> END ok -x $a eq <<END; #TditaOrganization #TprettyStringDitaHeaders #TopString <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE concept PUBLIC "-//ACT//DTD DITA Concept//EN" "concept.dtd" []> <concept/> END } if (1) #Tupn {my $a = Data::Edit::Xml::new(<<END); #Tupn <a><b><c><d><e/></d></c></b></a> END my ($e, $d, $c, $b) = $a->byList; #Tupn ok $e = $e->upn_0_e_d_c_b_a; #Tupn ok $d = $e->upn_1_d_c_b_a; #Tupn ok $c = $e->upn_2_c_b_a; #Tupn ok $b = $e->upn_3_b_a; #Tupn ok $a = $e->upn_4_a; #Tupn ok !$e->upn_5; #Tupn is_deeply [$e, $d, $c, $b, $a], [$e->ancestry]; } if (1) #Tattributes {my $a = Data::Edit::Xml::new(q(<a/>)); $a->id = q(id); ok $a->id eq q(id); ok !defined($a->href); ok $a->hrefX eq q(); ok -s $a eq q(<a id="id"/>); $a->href = q(href); ok $a->href eq q(href); ok $a->hrefX eq q(href); ok -s $a eq q(<a href="href" id="id"/>); $a->href = undef; ok !defined($a->href); ok $a->hrefX eq q(); ok -s $a eq q(<a id="id"/>); } if (1) #TditaMaximumNumberOfEntriesInARow #TditaAddColSpecToTGroup {my $a = Data::Edit::Xml::new(<<END); <table> <tgroup> <tbody> <row><entry/></row> <row><entry/><entry/></row> <row><entry/><entry/><entry/></row> <row><entry/><entry/></row> <row/> </tbody> </tgroup> </table> END ok 3 == $a->go_tgroup->ditaMaximumNumberOfEntriesInATGroupRow; $a->first->ditaAddColSpecToTGroup(3); ok -p $a eq <<END <table> <tgroup cols="3"> <colspec colname="c1" colnum="1" colwidth="1*"/> <colspec colname="c2" colnum="2" colwidth="1*"/> <colspec colname="c3" colnum="3" colwidth="1*"/> <tbody> <row> <entry/> </row> <row> <entry/> <entry/> </row> <row> <entry/> <entry/> <entry/> </row> <row> <entry/> <entry/> </row> <row/> </tbody> </tgroup> </table> END } if (1) #TditaFixTGroupColSpec {my $a = Data::Edit::Xml::new(<<END); <table> <tgroup> <tbody> <row><entry/></row> <row><entry/><entry/></row> <row><entry/><entry/><entry/></row> <row><entry/><entry/></row> <row> <entry> <table> <tbody> <row><entry/><entry/><entry/><entry/><entry/><entry/><entry/></row> </tbody> </table> </entry> </row> </tbody> </tgroup> </table> END $a->go_tgroup->ditaFixTGroupColSpec; ok -p $a eq <<END <table> <tgroup cols="3"> <colspec colname="c1" colnum="1" colwidth="1*"/> <colspec colname="c2" colnum="2" colwidth="1*"/> <colspec colname="c3" colnum="3" colwidth="1*"/> <tbody> <row> <entry/> </row> <row> <entry/> <entry/> </row> <row> <entry/> <entry/> <entry/> </row> <row> <entry/> <entry/> </row> <row> <entry> <table> <tbody> <row> <entry/> <entry/> <entry/> <entry/> <entry/> <entry/> <entry/> </row> </tbody> </table> </entry> </row> </tbody> </tgroup> </table> END } if (1) {my $a = Data::Edit::Xml::new(<<END); #TfirstNot #TlastNot #TnextNot #TprevNot #TnextWhile #TprevWhile #TnextUntil #TprevUntil <a> <b/> <c/> <d/> <e/> <f/> </a> END my ($b, $c, $d, $e, $f) = $a->byList; #TfirstNot #TlastNot #TnextNot #TprevNot #TnextWhile #TprevWhile #TnextUntil #TprevUntil ok $c == $a->firstNot_a_b; #TfirstNot ok $d == $a->lastNot_e_f; #TlastNot ok $e == $b->nextWhile_c_d; #TnextWhile ok $c == $f->prevWhile_e_d; #TprevWhile ok $c == $b->nextWhile; #TnextWhile ok $b == $c->prevWhile; #TprevWhile ok $e == $b->nextUntil_e_f; #TnextUntil ok $b == $f->prevUntil_a_b; #TprevUntil ok !$b->nextUntil; #TnextUntil ok !$c->prevUntil; #TprevUntil } if (1) {my $a = Data::Edit::Xml::new(<<END); #TfirstWhile #TfirstUntil #TlastWhile #TlastUntil <a><b><c><d><e><f/> </e></d></c></b> <B><C><D><E><F/> </E></D></C></B></a> END my ($f, $e, $d, $c, $b, $F, $E, $D, $C, $B) = $a->byList; #TfirstWhile #TfirstUntil #TlastWhile #TlastUntil if (1) #TfirstWhile #TfirstUntil {ok $d == $a->firstWhile_a_d_c_b; ok $f == $a->firstWhile_a_d_c_b_e_f_g_h; ok !$b->firstWhile_a; ok $e == $a->firstUntil_e_d; ok !$c->firstUntil_c; ok !$b->firstUntil_a; } if (1) #TlastWhile #TlastUntil {ok $D == $a->lastWhile_a_D_C_B; ok $F == $a->lastWhile_a_D_C_B_E_F_G_H; ok !$B->lastWhile_a; ok $E == $a->lastUntil_E_D; ok !$C->lastUntil_C; ok !$B->lastUntil_a; } } if (1) #TAUTOLOAD {my $a = Data::Edit::Xml::new(<<END); <a><b><c/><d/><e/><f/></b></a> END ok -t $a->first_b__first_c__next__next_e__next eq q(f); ok !$a->first_b__first_c__next__next_f; } if (1) #TmatchesNextTags #TmatchesPrevTags {my $a = Data::Edit::Xml::new(<<END); <a><b><c/><d/><e/><f/></b></a> END ok -t $a->first__first__matchesNextTags_d_e eq q(c); ok -t $a->first__first__mnt_d_e eq q(c); ok !$a-> first__matchesNextTags_d_e; ok -t $a-> last->last__matchesPrevTags_e_d eq q(f); ok -t $a-> last->last__mpt_e_d eq q(f); ok !$a-> last__matchesPrevTags_e_d; } if (1) #Tfirstn #Tnextn {my $a = Data::Edit::Xml::new(<<END); <a><b><c><d/><e/><f/></c></b></a> END ok -p $a eq <<END; <a> <b> <c> <d/> <e/> <f/> </c> </b> </a> END ok -t $a->firstn_0 eq q(a); ok -t $a->firstn_1 eq q(b); ok -t $a->firstn_2 eq q(c); ok -t $a->firstn_3 eq q(d); ok -t $a->firstn_3__nextn_0 eq q(d); ok -t $a->firstn_3__nextn_1 eq q(e); ok -t $a->firstn_3__nextn_2 eq q(f); } if (1) #Tlastn #Tprevn {my $a = Data::Edit::Xml::new(<<END); <a><b><c><d/><e/><f/></c></b> <B><C><D/><E/><F/></C></B></a> END ok -p $a eq <<END; <a> <b> <c> <d/> <e/> <f/> </c> </b> <B> <C> <D/> <E/> <F/> </C> </B> </a> END ok -t $a->lastn_0 eq q(a); ok -t $a->lastn_1 eq q(B); ok -t $a->lastn_2 eq q(C); ok -t $a->lastn_3 eq q(F); ok -t $a->lastn_3__prevn_0 eq q(F); ok -t $a->lastn_3__prevn_1 eq q(E); ok -t $a->lastn_3__prevn_2 eq q(D); } if (!$windows) { my $a = Data::Edit::Xml::new(q(<a>).(q(<b>𝝱</b>)x1e3).q(</a>)); #TwriteCompressedFile #TreadCompressedFile my $file = $a->writeCompressedFile(q(zzz.xml.zip)); #TwriteCompressedFile #TreadCompressedFile ok length(-s $a) eq 8007; ok -e $file; my $A = readCompressedFile($file); #TwriteCompressedFile #TreadCompressedFile ok $a->equals($A); #TwriteCompressedFile #TreadCompressedFile ok length(-s $a) == length(-s $A); ok -t $a->firstn_0 eq q(a); ok -t $a->firstn_1 eq q(b); ok $a->firstn_2__text eq q(𝝱); unlink $file; } else {ok 1 for 1..7 } if (1) #TditaPrettyPrintWithHeaders {my $a = Data::Edit::Xml::new(q(<concept/>)); ok $a->ditaPrettyPrintWithHeaders eq <<END; <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE concept PUBLIC "-//ACT//DTD DITA Concept//EN" "concept.dtd" []> <concept/> END } if (1) # Command and attributes {my $a = Data::Edit::Xml::new(<<END); <a><b><c><d/><e/><e/><f/><f/></c></b></a> END my $n = 0; $a->by(sub {my ($o) = @_; $o->id = ++$n % 2; $o->class = $n % 3; }); ok -p $a eq <<END; #TdeleteAttrsInTree <a class="2" id="0"> <b class="1" id="1"> <c class="0" id="0"> <d class="1" id="1"/> <e class="2" id="0"/> <e class="0" id="1"/> <f class="1" id="0"/> <f class="2" id="1"/> </c> </b> </a> END $a->by(sub {my ($o) = @_; ok $o->class == 2 if $o->atId_0_e; ok $o->class == 0 if $o->atId_1_e_c_b; ok !$o->atId_1_e_b; }); $a->deleteAttrsInTree_class; #TdeleteAttrsInTree ok -p $a eq <<END #TdeleteAttrsInTree <a id="0"> <b id="1"> <c id="0"> <d id="1"/> <e id="0"/> <e id="1"/> <f id="0"/> <f id="1"/> </c> </b> </a> END } if (1) #TattrX {my $a = Data::Edit::Xml::new(q(<a><b name="bb"/></a>)); my $b = $a->first; ok $b->attrX_name eq q(bb); ok !$b->attrX_bbb; } if (1) #Tunwrap {my $a = Data::Edit::Xml::new(q(<a>aaa</a>)); my $t = $a->first; ok !$t->unwrap; } if (1) {my $a = Data::Edit::Xml::new(<<END); <?xml version="1.0" encoding="UTF-8"?> <body> <p> ± </p> </body> END } if (1) {my $a = Data::Edit::Xml::new(<<END); <a><b/><c/><B><c/></B><c/><b/></a> END $a->numberTreesJustIds(q(i)); ok -p $a eq <<END; #TwrapRuns #TfindById <a id="i1"> <b id="i2"/> <c id="i3"/> <B id="i4"> <c id="i5"/> </B> <c id="i6"/> <b id="i7"/> </a> END ok -t $a->findById_i4 eq q(B); #TfindById ok -t $a->findById_i5 eq q(c); #TfindById $a->wrapRuns(q(B)); #TwrapRuns ok -p $a eq <<END; #TwrapRuns <a id="i1"> <B> <b id="i2"/> <c id="i3"/> </B> <B id="i4"> <c id="i5"/> </B> <B> <c id="i6"/> <b id="i7"/> </B> </a> END } if (1) #TmatchesNode #TmatchesSubTree #TfindMatchingSubTrees {my $a = Data::Edit::Xml::new(<<END); <a id="1"> <b id="2" name="b"> <c id="3" name="c"/> </b> <c id="4"> <b id="5" name="b"> <c id="6" name="c"/> </b> </c> </a> END my ($c, $b, $C, $B) = $a->byList; ok $b->id == 2; ok $c->id == 3; ok $B->id == 5; ok $C->id == 6; ok $c->matchesNode($C, qw(name)); ok !$c->matchesNode($C, qw(id name)); ok $c->matchesSubTree($C, qw(name)); ok $b->matchesSubTree($B, qw(name)); ok !$c->matchesSubTree($C, qw(id name)); ok !$b->matchesSubTree($C, qw(name)); is_deeply [$a->findMatchingSubTrees($b, qw(name))], [$b, $B]; is_deeply [$a->findMatchingSubTrees($c, qw(name))], [$c, $C]; is_deeply [$a->findMatchingSubTrees(new(q(<c/>)))], [$c, $C]; is_deeply [$a->findMatchingSubTrees(new(q(<b><c/></b>)))], [$b, $B]; is_deeply [$a->findMatchingSubTrees(new(q(<b id="2"><c id="3"/></b>)), q(id))], [$b]; } if (1) #TputFirstAsTree #TputLastAsTree #TputNextAsTree #TputPrevAsTree {my $a = Data::Edit::Xml::new(q(<a/>)); ok -p $a eq <<END; <a/> END my $b = $a->putFirstAsTree(q(<b/>)); ok -p $a eq <<END; <a> <b/> </a> END $b->putNextAsTree(q(<c/>)); ok -p $a eq <<END; <a> <b/> <c/> </a> END my $e = $a->putLastAsTree(q(<e/>)); ok -p $a eq <<END; <a> <b/> <c/> <e/> </a> END $e->putPrevAsTree(q(<d/>)); ok -p $a eq <<END; <a> <b/> <c/> <d/> <e/> </a> END } if (1) #TwrapFromFirst {my $a = Data::Edit::Xml::new(q(<a><b/><c/><d/></a>)); ok -p $a eq <<END; <a> <b/> <c/> <d/> </a> END $a->go_c->wrapFromFirst_B; ok -p $a eq <<END; <a> <B> <b/> <c/> </B> <d/> </a> END } if (1) #TwrapToLast {my $a = Data::Edit::Xml::new(q(<a><b/><c/><d/></a>)); ok -p $a eq <<END; <a> <b/> <c/> <d/> </a> END $a->go_c->wrapToLast_D; ok -p $a eq <<END; <a> <b/> <D> <c/> <d/> </D> </a> END } if (1) #Theight #Tdepth #TdepthProfile {my $a = Data::Edit::Xml::new(q(<a><b><c><d/></c><e/></b></a>)); ok -p $a eq <<END; <a> <b> <c> <d/> </c> <e/> </b> </a> END my ($d, $c, $e, $b) = $a->byList; ok $a->height == 4; ok $a->depth == 0; ok $c->depth == 2; ok $c->height == 2; ok $e->depth == 2; ok $e->height == 1; is_deeply [$a->depthProfile], [qw(4 3 3 2 1)]; } if (1) #TsetDepthProfile #TsetRepresentationAsTagsAndText #TsetRepresentationAsText #TdepthProfileLast #TrepresentationLast #TmatchNodesByRepresentation #TstringTagsAndText #TstringText {my $a = Data::Edit::Xml::new(<<END); <a> <b> <c>cc <d/> dd </c> </b> <B> <c>cc <d/> dd </c> </B> </a> END my $b = $a->first_b; my $B = $a->last_B; my $c = $b->first_c; my $C = $B->first_c; my $d = $c->first_d; my $D = $C->first_d; $a->setDepthProfile; ok $b->depthProfileLast eq q(3 3 3 2 1); ok $b->depthProfileLast eq $B->depthProfileLast; # Represent using tags and text $a->setRepresentationAsTagsAndText; is_deeply [$b->stringTagsAndText], [qw(cc d dd c b)]; is_deeply [$B->stringTagsAndText], [qw(cc d dd c B)]; ok $b->representationLast eq qq(cc d dd c b); ok $B->representationLast eq qq(cc d dd c B); ok $c->representationLast eq qq(cc d dd c); ok $C->representationLast eq qq(cc d dd c); ok dump($b->representationLast) ne dump($B->representationLast); is_deeply $c->representationLast, $C->representationLast; my $m = $a->matchNodesByRepresentation; my $bb = $b->representationLast; is_deeply $m->{$bb}, [$b]; my $cc = $c->representationLast; is_deeply $m->{$cc}, [$c, $C]; # Represent using just text $a->setRepresentationAsText; is_deeply [$b->stringText], [qw(cc dd)]; is_deeply [$B->stringText], [qw(cc dd)]; ok $b->representationLast eq qq(cc dd); ok $B->representationLast eq qq(cc dd); is_deeply $b->representationLast, $B->representationLast; is_deeply $c->representationLast, $C->representationLast; my $M = $a->matchNodesByRepresentation; my $BB = $b->representationLast; is_deeply $M->{$BB}, [$c, $b, $C, $B]; my $CC = $c->representationLast; is_deeply $M->{$BB}, [$c, $b, $C, $B]; ok $b->representationLast eq $c->representationLast; } if (1) #TisOnlyChildText {my $a = Data::Edit::Xml::new(q(<a>aaaa</a>)); ok $a->first->isOnlyChildText; } if (1) #TisOnlyChildBlankText {my $a = Data::Edit::Xml::new(q(<a>aaaa</a>)); $a->first->text = q( ); ok $a->prettyStringCDATA eq qq(<a><CDATA> </CDATA></a>\\n); ok $a->first->isOnlyChildBlankText; ok !$a->isOnlyChildBlankText; } if (1) #TisOnlyChildBlankText {my $a = Data::Edit::Xml::new(q(<a/>)); my $b = $a->new(q(<b/>)); ok -p $a eq qq(<a/>\\n); ok -p $b eq qq(<b/>\\n); } if (1) #TattrValueAt {my $a = Data::Edit::Xml::new(q(<a><b c="C"/></a>)); my $b = $a->first; ok !$b->attrValueAt_c_C_c_a; ok $b->attrValueAt_c_C_b_a; } if (1) #TditaListToTable {my $a = Data::Edit::Xml::new(<<END); <ul id="Table3" outputclass="fcRowList"> <li> <p id="1">1111</p> <p id="2">2222</p> <p id="3">3333</p> <p id="4">4444</p> </li> <li> <p id="tableToListA1" outputclass="1">aaaa1111</p> <p id="tableToListA2" outputclass="1">aaaa2222</p> <p id="tableToListA3" outputclass="1">aaaa3333</p> <p id="tableToListA4" outputclass="1">aaaa4444</p> </li> <li> <p id="tableToListB1" outputclass="1">bbbb1111</p> <p id="tableToListB2" outputclass="1">bbbb2222</p> <p id="tableToListB3" outputclass="1">bbbb3333</p> </li> <li> <p id="tableToListC1" outputclass="1">cccc1111</p> <p id="tableToListC2" outputclass="1">cccc2222</p> <p id="tableToListC3" outputclass="1">cccc3333</p> <p id="tableToListC4" outputclass="1">cccc4444</p> <p id="tableToListC5" outputclass="1">cccc5555</p> </li> </ul> END $a->ditaListToTable; ok nws(-p $a) eq nws(<<END) <table id="Table3" outputclass="fcRowList"> <tgroup cols="5"> <colspec colname="c1" colnum="1" colwidth="1*"/> <colspec colname="c2" colnum="2" colwidth="1*"/> <colspec colname="c3" colnum="3" colwidth="1*"/> <colspec colname="c4" colnum="4" colwidth="1*"/> <colspec colname="c5" colnum="5" colwidth="1*"/> <thead> <row> <entry/> <entry/> <entry/> <entry/> <entry/> </row> </thead> <tbody> <row> <entry id="1">1111</entry> <entry id="2">2222</entry> <entry id="3">3333</entry> <entry id="4">4444</entry> </row> <row> <entry id="tableToListA1" outputclass="1">aaaa1111</entry> <entry id="tableToListA2" outputclass="1">aaaa2222</entry> <entry id="tableToListA3" outputclass="1">aaaa3333</entry> <entry id="tableToListA4" outputclass="1">aaaa4444</entry> </row> <row> <entry id="tableToListB1" outputclass="1">bbbb1111</entry> <entry id="tableToListB2" outputclass="1">bbbb2222</entry> <entry id="tableToListB3" outputclass="1">bbbb3333</entry> </row> <row> <entry id="tableToListC1" outputclass="1">cccc1111</entry> <entry id="tableToListC2" outputclass="1">cccc2222</entry> <entry id="tableToListC3" outputclass="1">cccc3333</entry> <entry id="tableToListC4" outputclass="1">cccc4444</entry> <entry id="tableToListC5" outputclass="1">cccc5555</entry> </row> </tbody> </tgroup> </table> END } if (1) #TgiveEveryIdAGuid {my $a = Data::Edit::Xml::new(<<END); <a id="a"> <b id="b"> <c id="c"/> </b> <d/> </a> END my $n =0; $a->giveEveryIdAGuid(sub {my ($n, $o) = @_; qq(GUID-$n) }); ok -p $a eq <<END; <a id="GUID-3"> <b id="GUID-2"> <c id="GUID-1"/> </b> <d/> </a> END ok $a->stringReplacingIdsWithLabels eq q(<a id="a"><b id="b"><c id="c"/></b><d/></a>); ok $a->stringExtendingIdsWithLabels eq q(<a id="GUID-3, a"><b id="GUID-2, b"><c id="GUID-1, c"/></b><d/></a>); } if (1) { #Tlocation #TlineLocation #TapproxLocation #TclosestLocation #TformatOxygenMessage my $a = Data::Edit::Xml::new(<<END, lineNumbers=>1, inputFile=>q(aaa.xml)); <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> <test id="t1"> <title>Test_

Place the boiling water and fresh tea in the pot.

Make sure the pot is on an insulated surface.

Stir with a spoon then let brew for 5 minutes.

Pour the tea into a cup.

An enjoyable cup of tea.

END ok -p $a eq < Test_

Place the boiling water and fresh tea in the pot.

Make sure the pot is on an insulated surface.

Stir with a spoon then let brew for 5 minutes.

Pour the tea into a cup.

An enjoyable cup of tea.

END ok $a->go_testbody_run_p__location eq q( on line 13 from 7 to 9 in file: aaa.xml); my $p = $a->go_testbody_run_p; $p->putNext(my $q = $p->newTag_hello); ok $p->lineLocation eq q(on line 13 from 7 to 9); ok $q->location eq q( in file: aaa.xml); ok $q->closestLocation == $p; ok $q->approxLocation eq q( on line 13 from 7 to 9 in file: aaa.xml); ok $q->formatOxygenMessage(q(E), q(), q(Hello detected)) eq < END ok q(c d b e g h f a) eq join \' \', map{-t $_} $a->byList; ok q(h g f e d c b a) eq join \' \', map{-t $_} $a->byReverseList; ok q(a b c d e f g h) eq join \' \', map{-t $_} $a->downList; ok q(a f h g e b d c) eq join \' \', map{-t $_} $a->downReverseList; } if (1) { my $a = Data::Edit::Xml::new(<1); END ok $a->go_b_c_1_d__location eq q( on line 5 from 5 to 8); } if (1) { #TprecedingSiblingOf #TsucceedingSiblingOf my $a = Data::Edit::Xml::new(< END my ($c, $d, $e, $b, $C, $D, $B) = $a->byList; ok !$e->succeedingSiblingOf($e); ok $e->succeedingSiblingOf($d); ok $e->succeedingSiblingOf($c); ok !$e->succeedingSiblingOf($b); ok !$e->succeedingSiblingOf($B); ok !$e->succeedingSiblingOf($C); ok !$c->precedingSiblingOf($c); ok $c->precedingSiblingOf($d); ok $c->precedingSiblingOf($e); ok !$c->precedingSiblingOf($b); ok !$c->precedingSiblingOf($B); ok !$c->precedingSiblingOf($C); } if (1) { #TmoveStartFirst my $a = Data::Edit::Xml::new(< END my ($b, $c, $e, $d) = $a->byList; $d->moveStartFirst; ok -p $a, < END } if (1) { #TmoveStartAfter my $a = Data::Edit::Xml::new(< END my ($b, $c, $e, $d) = $a->byList; $d->moveStartAfter($b); ok -p $a, < END $d->moveStartAfter($c); ok -p $a, < END } if (1) { #TmoveStartBefore my $a = Data::Edit::Xml::new(< END my ($b, $c, $e, $d) = $a->byList; $d->moveStartBefore($c); ok -p $a, < END $d->moveStartBefore($e); ok -p $a, < END } if (1) { #TmoveEndLast my $a = Data::Edit::Xml::new(< END my ($c, $b, $d, $e) = $a->byList; $b->moveEndLast; ok -p $a, < END } if (1) { #TmoveEndAfter my $a = Data::Edit::Xml::new(< END my ($c, $b, $d, $e) = $a->byList; $b->moveEndAfter($d); ok -p $a, < END $b->moveEndAfter($c); ok -p $a, < END } if (1) { #TmoveEndBefore my $a = Data::Edit::Xml::new(< END my ($c, $b, $d, $e) = $a->byList; $b->moveEndBefore($e); ok -p $a, < END $b->moveEndBefore($d); ok -p $a, < END } if (1) { #TditaXrefs my $a = Data::Edit::Xml::new(< a END $a->ditaXrefs; ok -p $a eq <

a

END } if (1) { #TdeleteAttrValueAtInTree my $a = Data::Edit::Xml::new(< END $a->deleteAttrValueAtInTree_id_c_c_b; ok -p $a eq < END } if (1) { #TditaStepsToChoices my $a = Data::Edit::Xml::new(< Command Step result Step example Command Step result Step example END $a->ditaStepsToChoices; ok -p $a eq <

Command

Step result Step example

Command

Step result Step example
END } if (1) { #TditaTGroupStatistics #TditaRemoveTGroupTrailingEmptyEntries #TditaMaximumNumberOfEntriesInATGroupRow my $a = Data::Edit::Xml::new(< aaaa bbbb cccc dddd END my $g = $a->go_tgroup; ok $g->ditaMaximumNumberOfEntriesInATGroupRow == 3; is_deeply $g->ditaTGroupStatistics, bless({ colsAttribute => 1, colSpec => 1, maxBody => 3, maxBodyMinusPadding => 3, maxHead => 2, maxHeadMinusPadding => 2, minBody => 1, minHead => 1, }, "Data::Edit::Xml::Table::Statistics"); $g->ditaRemoveTGroupTrailingEmptyEntries; ok -p $a eq < aaaa bbbb cccc dddd END } if (1) { #TfixEntryColSpan #TfixEntryRowSpan my $a = Data::Edit::Xml::new(< END $a->by(sub {my ($e) = @_; if ($e->at_entry) {$e->fixEntryColSpan; $e->fixEntryRowSpan; } }); ok -p $a eq < END } if (1) { #TditaAddPadEntriesToTGroupRows #TditaRemoveTrailingEmptyEntries #TfixTGroup #TfixTable my $a = Data::Edit::Xml::new(< aaaa bbbb cccc dddd END my $g = $a->go_tgroup; $g->ditaAddPadEntriesToTGroupRows(2); is_deeply $g->ditaTGroupStatistics, bless({ colsAttribute => 1, colSpec => 1, maxBody => 2, maxBodyMinusPadding => 2, maxHead => 2, maxHeadMinusPadding => 2, minBody => 2, minHead => 2, }, "Data::Edit::Xml::Table::Statistics"); $g->fixTGroup; ok -p $a eq < aaaa bbbb cccc dddd END is_deeply $g->ditaTGroupStatistics, bless({ colsAttribute => 2, colSpec => 2, maxBody => 2, maxBodyMinusPadding => 2, maxHead => 2, maxHeadMinusPadding => 2, minBody => 2, minHead => 2, }, "Data::Edit::Xml::Table::Statistics"); $a->fixTable; is_deeply $g->ditaTGroupStatistics, bless({ colsAttribute => 2, colSpec => 2, maxBody => 2, maxBodyMinusPadding => 2, maxHead => 2, maxHeadMinusPadding => 2, minBody => 2, minHead => 2, }, "Data::Edit::Xml::Table::Statistics"); } if (1) { #TmergeLikeElements my $a = Data::Edit::Xml::new(<aabbccddee END ok -p $a eq < aa bb cc dd ee END $a->by(sub{$_->mergeLikeElements}); ok -p $a eq < aa bbccddee END } if (1) { #TmergeLikeNext my $a = Data::Edit::Xml::new(< bb dd END $a->first->mergeLikeNext; ok -p $a eq < bbdd END } if (1) { #TmergeLikePrev my $a = Data::Edit::Xml::new(< bb dd END $a->last->mergeLikePrev; ok -p $a eq < bbdd END } if (1) { #TditaListToChoices my $a = Data::Edit::Xml::new(<
  • END $a->ditaListToChoices; ok -p $a eq <

    END } if (1) { #TfirstUntilText #TlastUntilText my $a = Data::Edit::Xml::new(< cccc hhhh mmmm END ok $a->firstUntilText->text =~ m(cccc)s; ok $a->lastUntilText ->text =~ m(mmmm)s; } if (!$windows) { if (1) { #TstringMd5Sum my $a = Data::Edit::Xml::new(< c END ok $a->stringMd5Sum eq q(390bf05d8f5671cc6a4771834840d695); ok -k $a eq q(390bf05d8f5671cc6a4771834840d695); ok -k $a ne -k $a->first; } } else {ok 1 for 1..3; } if (!$windows) { if (1) { #TcreateGuidId my $a = Data::Edit::Xml::new(< c END ok $a->createGuidId->id eq q(GUID-390bf05d-8f56-71cc-6a47-71834840d695); } } else {ok 1; } if (1) { #TswapTags #TswapTagWithParent my $a = Data::Edit::Xml::new(< END $a->swapTags($a->first); ok -p $a eq < END my ($C, $A) = $a->downWhileFirst->swapTagWithParent; ok -t $A eq q(a); ok -t $C eq q(c); ok -p $a eq < END } if (1) { #TditaSampleBookMap ok nws(Data::Edit::Xml::ditaSampleBookMap (author=>q(mim), chapters=>Data::Edit::Xml::new(< END )->prettyString) eq nws(< Title unknown mim END } if (1) { #TditaSampleConcept ok Data::Edit::Xml::ditaSampleConcept (title=>q(New Concept), )->prettyString eq < New Concept END } if (1) { #TditaSampleTask ok Data::Edit::Xml::ditaSampleTask (title=>q(New Task), )->prettyString eq < New Task END } if (1) { my $a = Data::Edit::Xml::new(< c END my ($c, $b) = $a->byList; my $B = $b->clone; $b->replaceContentWith($B); ok nws(-p $a) eq nws(< c END } if (1) { #TputContentAfter my $a = Data::Edit::Xml::new(< END my ($c, $d, $b) = $a->byList; $b->putContentAfter; ok -p $a eq < END } if (1) { #TputContentBefore my $a = Data::Edit::Xml::new(< END my ($c, $d, $b) = $a->byList; $b->putContentBefore; ok -p $a eq < END } if (1) { #TputSiblingsFirst my $a = Data::Edit::Xml::new(< END my ($b, $c, $d, $e, $f) = $a->byList; $d->putSiblingsFirst; ok -p $a eq < END } if (1) { #TputSiblingsLast my $a = Data::Edit::Xml::new(< END my ($b, $c, $d, $e, $f) = $a->byList; $d->putSiblingsLast; ok -p $a eq < END } if (1) { #TputSiblingsAfterParent my $a = Data::Edit::Xml::new(< d END my ($c, $d, $e, $b) = $a->byList; $d->putSiblingsAfterParent; ok -p $a eq < d END } if (1) { #TputSiblingsBeforeParent my $a = Data::Edit::Xml::new(< d END my ($c, $d, $e, $b) = $a->byList; $d->putSiblingsBeforeParent; ok -p $a eq < d END } if (1) { #TditaConvertConceptToTask my $a = Data::Edit::Xml::new(< <conbody> <p>context</p> <ol> <li> <note>note</note><image/><fig/> <p>cmd</p> <p>info</p> </li> <li>cmd text<p>info</p> </li> </ol> <p>between</p> <ol> <li> <p>cmd <note>first in info</note><note>second in info</note></p> <p>info</p> </li> <li> cmd text <p>info</p> </li> <li> <ol> <li>substep 1</li> <li>substep 2</li> </ol> </li> </ol> <p>results</p> </conbody> </concept> END $a->ditaConvertConceptToTask; owf(q(/home/phil/z/z/z/out.xml), -p $a); ok nws(-p $a) eq nws(<<END); <task id="x1"> <title/> <taskbody> <context> <p>context</p> </context> <steps> <step> <note>note</note> <note> <image/> </note> <note> <fig/> </note> <cmd>cmd</cmd> <info> <p>info</p> </info> </step> <step> <cmd>cmd text</cmd> <info> <p>info</p> </info> </step> <stepsection> <p>between</p> </stepsection> <step> <cmd>cmd </cmd> <info> <note>first in info</note> <note>second in info</note> <p>info</p> </info> </step> <step> <cmd> cmd text </cmd> <info> <p>info</p> </info> </step> <step> <cmd>Choose one of the following:</cmd> <choices> <choice>substep 1</choice> <choice>substep 2</choice> </choices> </step> </steps> <result> <p>results</p> </result> </taskbody> </task> END } if (1) { #TchangeOrDeleteAttr my $a = Data::Edit::Xml::new(<<END); <a a="1"/> END $a->changeOrDeleteAttr_a_b; ok -p $a eq <<END; <a b="1"/> END } if (1) { #TchangeOrDeleteAttr my $a = Data::Edit::Xml::new(<<END); <a a="1" b="2"/> END $a->changeOrDeleteAttr_a_b; ok -p $a eq <<END; <a b="2"/> END } if (1) { #TchangeOrDeleteAttrValue my $a = Data::Edit::Xml::new(<<END); <a a="1"/> END $a->changeOrDeleteAttrValue_a_0_b_1; ok -p $a eq <<END; <a a="1"/> END $a->changeOrDeleteAttrValue_a_1_b_3; ok -p $a eq <<END; <a b="3"/> END } if (1) { #TchangeOrDeleteAttrValue my $a = Data::Edit::Xml::new(<<END); <a a="1" b="2"/> END $a->changeOrDeleteAttrValue_a_0_b_2; ok -p $a eq <<END; <a b="2"/> END } if (1) { #TchangeOrDeleteAttrValue my $a = Data::Edit::Xml::new(<<END); <a a="1"/> END $a->changeOrDeleteAttrValue_a_1_b_3; ok -p $a eq <<END; <a b="3"/> END } if (1) { #TsplitBefore my $a = Data::Edit::Xml::new(<<END); <a> <b> <c/> <d/> <e/> </b> </a> END $a->go_b_d__splitBefore; ok -p $a eq <<END; <a> <b> <c/> </b> <b> <d/> <e/> </b> </a> END } if (1) { #TsplitAfter my $a = Data::Edit::Xml::new(<<END); <a> <b> <c/> <d/> <e/> </b> </a> END $a->go_b_d__splitAfter; ok -p $a eq <<END; <a> <b> <c/> <d/> </b> <b> <e/> </b> </a> END } if (1) { #TditaConvertSimpleTableToTable my $a = Data::Edit::Xml::new(<<END); <simpletable> <sthead> <stentry>Symbol</stentry> <stentry>Meaning</stentry> </sthead> <strow> <stentry>aaaa</stentry> <stentry>bbbb</stentry> </strow> </simpletable> END $a->ditaConvertSimpleTableToTable; owf(q(/home/phil/z/z/z/out.xml), -p $a); ok -p $a eq <<END; <table> <tgroup cols="2"> <colspec colname="c1" colnum="1" colwidth="1*"/> <colspec colname="c2" colnum="2" colwidth="1*"/> <thead> <row> <entry>Symbol</entry> <entry>Meaning</entry> </row> </thead> <tbody> <row> <entry>aaaa</entry> <entry>bbbb</entry> </row> </tbody> </tgroup> </table> END } if (1) { #TprintAncestry my $a = Data::Edit::Xml::new(<<END); <a id="a"> <b id="b"> <c> <d id="d"/> </c> </b> </a> END my $d = $a->firstUntil_d; ok nws($d->printAncestry) eq nws(<<END); a id="a" b id="b" c d id="d" END } if (1) { #ThtmlTables my $a = Data::Edit::Xml::new(<<END); <task id="t1"> <title>Title Text To add a new configuration: ClickNextto go to the next page On the Ports page, complete the following fields Click to exit without saving END ok fileMd5Sum($a->htmlTables =~ s(#\\w+) ()gsr) eq q(8750fcd9e34cb1756c96602fb848e3ad); ok fileMd5Sum($a->jsonString) eq q(df448817f9d89acd4787421829402d01); } if (1) { #TjsonString my $a = Data::Edit::Xml::new(<text END is_deeply decodeJson(<jsonString); {"tag" : "a", "attribute" : {"a":"1"}, "contents" : [ {"tag" : "b", "attribute" : {"b":"2"} }, {"tag" : "CDATA", "text" : "text" } ] } END # owf(q(/home/phil/js/in/1.js), $a->jsonString); } if (1) { my $a = Data::Edit::Xml::new(< END my ($c, $d, $b, $e) = $a->byList; ok -t $b eq q(b); ok -t $d eq q(d); $b->moveStartAfter($c); ok -p $a eq < END } if (1) { my $a = Data::Edit::Xml::new(< END my ($c, $d, $b, $e) = $a->byList; $b->moveStartAfter($d); ok -p $a eq < END } if (1) { my $a = Data::Edit::Xml::new(< END my ($b, $d, $c, $e) = $a->byList; ok -t $b eq q(b); ok -t $c eq q(c); ok -t $d eq q(d); $c->moveStartBefore($b); ok -p $a eq < END $c->moveEndAfter($d); ok -p $a eq < END $c->moveEndBefore($e); ok -p $a eq < END $c->moveEndAfter($e); ok -p $a eq < END $c->moveEndBefore($e); ok -p $a eq < END $c->moveEndBefore($b); ok -p $a eq < END $b->moveEndBefore($d); ok -p $a eq < END $b->moveEndAfter($d); ok -p $a eq < END $b->moveStartAfter($d); ok -p $a eq < END $b->moveStartAfter($c); ok -p $a eq < END $e->moveStartBefore($c); ok -p $a eq < END } if (1) { my $a = Data::Edit::Xml::new(< END my ($c, $b, $d, $e) = $a->byList; $b->moveEndAfter($d); ok -p $a eq < END $d->moveStartFirst; ok -p $a eq < END } if (1) { my $a = Data::Edit::Xml::new(< END my ($c, $b, $d, $e) = $a->byList; $b->moveEndBefore($e); ok -p $a eq < END $b->moveStartBefore($d); ok -p $a eq < END $b->moveStartFirst; ok -p $a eq < END $b->moveEndLast; ok -p $a eq < END $c->moveStartFirst; ok -p $a eq < END $e->moveEndLast; ok -p $a eq < END $b->moveEndBefore($c); ok -p $a eq < END } if (1) { #TditaConvertReferenceToConcept #TditaConvertConceptToTask my $ref = Data::Edit::Xml::new(< Testing the S3 Feature for PM 4 1

    To test the S# feature:

    1. Set the PCIe link state to L1.2.

    2. Issue the command: PM 4 1 command.

    END my $concept = $ref->ditaConvertReferenceToConcept; ok -p $concept, < Testing the S3 Feature for PM 4 1

    To test the S# feature:

    1. Set the PCIe link state to L1.2.

    2. Issue the command: PM 4 1 command.

    END my $task = $concept->ditaConvertConceptToTask; ok -p $task, < Testing the S3 Feature for PM 4 1

    To test the S# feature:

    Set the PCIe link state to L1.2. Issue the command: PM 4 1 command.
    END } if (1) { #TditaConvertReferenceToTask my $ref = Data::Edit::Xml::new(< Testing the S3 Feature for PM 4 1

    To test the S# feature:

    1. Set the PCIe link state to L1.2.

    2. Issue the command: PM 4 1 command.

    END my $task = $ref->ditaConvertReferenceToTask; ok -p $task, < Testing the S3 Feature for PM 4 1

    To test the S# feature:

    Set the PCIe link state to L1.2. Issue the command: PM 4 1 command.
    END } if (1) { #ThasSingleChildText my $a = Data::Edit::Xml::new(<aa bb END ok !$a->hasSingleChildText; ok $a->last->hasSingleChildText; } say STDERR "Took ", (time - $startTime), " seconds"; 1 #changeOrDeleteAttrValue 1 # owf(q(/home/phil/z/z/z/out.xml), -p $a); # # # ' called at lib/Data/Edit/Xml.pm line 23895 Data::Edit::Xml::test() called at test.pl line 10 # Looks like your test exited with 2 just after 1091. test.pl .. 1..1137 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8 ok 9 ok 10 ok 11 ok 12 ok 13 ok 14 ok 15 ok 16 ok 17 ok 18 ok 19 ok 20 ok 21 ok 22 ok 23 ok 24 ok 25 ok 26 ok 27 ok 28 ok 29 ok 30 ok 31 ok 32 ok 33 ok 34 ok 35 ok 36 ok 37 ok 38 ok 39 ok 40 ok 41 ok 42 ok 43 ok 44 ok 45 ok 46 ok 47 ok 48 ok 49 ok 50 ok 51 ok 52 ok 53 ok 54 ok 55 ok 56 ok 57 ok 58 ok 59 ok 60 ok 61 ok 62 ok 63 ok 64 ok 65 ok 66 ok 67 ok 68 ok 69 ok 70 ok 71 ok 72 ok 73 ok 74 ok 75 ok 76 ok 77 ok 78 ok 79 ok 80 ok 81 ok 82 ok 83 ok 84 ok 85 ok 86 ok 87 ok 88 ok 89 ok 90 ok 91 ok 92 ok 93 ok 94 ok 95 ok 96 ok 97 ok 98 ok 99 ok 100 ok 101 ok 102 ok 103 ok 104 ok 105 ok 106 ok 107 ok 108 ok 109 ok 110 ok 111 ok 112 ok 113 ok 114 ok 115 ok 116 ok 117 ok 118 ok 119 ok 120 ok 121 ok 122 ok 123 ok 124 ok 125 ok 126 ok 127 ok 128 ok 129 ok 130 ok 131 ok 132 ok 133 ok 134 ok 135 ok 136 ok 137 ok 138 ok 139 ok 140 ok 141 ok 142 ok 143 ok 144 ok 145 ok 146 ok 147 ok 148 ok 149 ok 150 ok 151 ok 152 ok 153 ok 154 ok 155 ok 156 ok 157 ok 158 ok 159 ok 160 ok 161 ok 162 ok 163 ok 164 ok 165 ok 166 ok 167 ok 168 ok 169 ok 170 ok 171 ok 172 ok 173 ok 174 ok 175 ok 176 ok 177 ok 178 ok 179 ok 180 ok 181 ok 182 ok 183 ok 184 ok 185 ok 186 ok 187 ok 188 - b d ok 189 - b d ok 190 ok 191 ok 192 ok 193 ok 194 ok 195 ok 196 ok 197 ok 198 ok 199 ok 200 ok 201 ok 202 ok 203 ok 204 ok 205 ok 206 ok 207 ok 208 ok 209 ok 210 ok 211 ok 212 ok 213 ok 214 ok 215 ok 216 ok 217 ok 218 ok 219 ok 220 ok 221 ok 222 ok 223 ok 224 ok 225 ok 226 ok 227 ok 228 ok 229 ok 230 ok 231 ok 232 ok 233 ok 234 ok 235 ok 236 ok 237 ok 238 ok 239 ok 240 ok 241 ok 242 ok 243 ok 244 ok 245 ok 246 ok 247 ok 248 ok 249 ok 250 ok 251 ok 252 ok 253 ok 254 ok 255 ok 256 ok 257 ok 258 ok 259 ok 260 ok 261 ok 262 ok 263 ok 264 ok 265 ok 266 ok 267 ok 268 ok 269 ok 270 ok 271 ok 272 ok 273 ok 274 ok 275 ok 276 ok 277 ok 278 ok 279 ok 280 ok 281 ok 282 ok 283 ok 284 ok 285 ok 286 ok 287 ok 288 ok 289 ok 290 ok 291 ok 292 ok 293 ok 294 ok 295 ok 296 ok 297 ok 298 ok 299 ok 300 ok 301 ok 302 ok 303 ok 304 ok 305 ok 306 ok 307 ok 308 ok 309 ok 310 ok 311 ok 312 ok 313 ok 314 ok 315 ok 316 ok 317 ok 318 ok 319 ok 320 ok 321 ok 322 ok 323 ok 324 ok 325 ok 326 ok 327 ok 328 ok 329 ok 330 ok 331 ok 332 ok 333 ok 334 ok 335 ok 336 ok 337 ok 338 ok 339 ok 340 ok 341 ok 342 ok 343 ok 344 ok 345 ok 346 ok 347 ok 348 ok 349 ok 350 ok 351 ok 352 ok 353 ok 354 ok 355 ok 356 ok 357 ok 358 ok 359 ok 360 ok 361 ok 362 ok 363 ok 364 ok 365 ok 366 ok 367 ok 368 ok 369 ok 370 ok 371 ok 372 ok 373 ok 374 ok 375 ok 376 ok 377 ok 378 ok 379 ok 380 ok 381 ok 382 ok 383 ok 384 ok 385 ok 386 ok 387 ok 388 ok 389 ok 390 ok 391 ok 392 ok 393 ok 394 ok 395 ok 396 ok 397 ok 398 ok 399 ok 400 ok 401 ok 402 ok 403 ok 404 ok 405 ok 406 ok 407 ok 408 ok 409 ok 410 ok 411 ok 412 ok 413 ok 414 ok 415 ok 416 ok 417 ok 418 ok 419 ok 420 ok 421 ok 422 ok 423 ok 424 ok 425 ok 426 ok 427 ok 428 ok 429 ok 430 ok 431 ok 432 ok 433 ok 434 ok 435 ok 436 ok 437 ok 438 ok 439 ok 440 ok 441 ok 442 ok 443 ok 444 ok 445 ok 446 ok 447 ok 448 ok 449 ok 450 ok 451 ok 452 ok 453 ok 454 ok 455 ok 456 ok 457 ok 458 ok 459 ok 460 ok 461 ok 462 ok 463 ok 464 ok 465 ok 466 ok 467 ok 468 ok 469 ok 470 ok 471 ok 472 ok 473 ok 474 ok 475 ok 476 ok 477 ok 478 ok 479 ok 480 ok 481 ok 482 ok 483 ok 484 ok 485 ok 486 ok 487 ok 488 ok 489 ok 490 ok 491 ok 492 ok 493 ok 494 ok 495 ok 496 ok 497 ok 498 ok 499 ok 500 ok 501 ok 502 ok 503 ok 504 ok 505 ok 506 ok 507 ok 508 ok 509 ok 510 ok 511 ok 512 ok 513 ok 514 ok 515 ok 516 ok 517 ok 518 ok 519 ok 520 ok 521 ok 522 ok 523 ok 524 ok 525 ok 526 ok 527 ok 528 ok 529 ok 530 ok 531 ok 532 ok 533 ok 534 ok 535 ok 536 ok 537 ok 538 ok 539 ok 540 ok 541 ok 542 ok 543 ok 544 ok 545 ok 546 ok 547 ok 548 ok 549 ok 550 ok 551 ok 552 ok 553 ok 554 ok 555 ok 556 ok 557 ok 558 ok 559 ok 560 ok 561 ok 562 ok 563 ok 564 ok 565 ok 566 ok 567 ok 568 ok 569 ok 570 ok 571 ok 572 ok 573 ok 574 ok 575 ok 576 ok 577 ok 578 ok 579 ok 580 ok 581 ok 582 ok 583 ok 584 ok 585 ok 586 ok 587 ok 588 ok 589 ok 590 ok 591 ok 592 ok 593 ok 594 ok 595 ok 596 ok 597 ok 598 ok 599 ok 600 ok 601 ok 602 ok 603 ok 604 ok 605 ok 606 ok 607 ok 608 ok 609 ok 610 ok 611 ok 612 ok 613 ok 614 ok 615 ok 616 ok 617 ok 618 ok 619 ok 620 ok 621 ok 622 ok 623 ok 624 ok 625 ok 626 ok 627 ok 628 ok 629 ok 630 ok 631 ok 632 ok 633 ok 634 ok 635 ok 636 ok 637 ok 638 ok 639 ok 640 ok 641 ok 642 ok 643 ok 644 ok 645 ok 646 ok 647 ok 648 ok 649 ok 650 ok 651 ok 652 ok 653 ok 654 ok 655 ok 656 ok 657 ok 658 ok 659 ok 660 ok 661 ok 662 ok 663 ok 664 ok 665 ok 666 ok 667 ok 668 ok 669 ok 670 ok 671 ok 672 ok 673 ok 674 ok 675 ok 676 ok 677 ok 678 ok 679 ok 680 ok 681 ok 682 ok 683 ok 684 ok 685 ok 686 ok 687 ok 688 ok 689 ok 690 ok 691 ok 692 ok 693 ok 694 ok 695 ok 696 ok 697 ok 698 ok 699 ok 700 ok 701 ok 702 ok 703 ok 704 ok 705 ok 706 ok 707 ok 708 ok 709 ok 710 ok 711 ok 712 ok 713 ok 714 ok 715 ok 716 ok 717 ok 718 ok 719 ok 720 ok 721 ok 722 ok 723 ok 724 ok 725 ok 726 ok 727 ok 728 ok 729 ok 730 ok 731 ok 732 ok 733 ok 734 ok 735 ok 736 ok 737 ok 738 ok 739 ok 740 ok 741 ok 742 ok 743 ok 744 ok 745 ok 746 ok 747 ok 748 ok 749 ok 750 ok 751 ok 752 ok 753 ok 754 ok 755 ok 756 ok 757 ok 758 ok 759 ok 760 ok 761 ok 762 ok 763 ok 764 ok 765 ok 766 ok 767 ok 768 ok 769 ok 770 ok 771 ok 772 ok 773 ok 774 ok 775 ok 776 ok 777 ok 778 ok 779 ok 780 ok 781 ok 782 ok 783 ok 784 ok 785 ok 786 ok 787 ok 788 ok 789 ok 790 ok 791 ok 792 ok 793 ok 794 ok 795 ok 796 ok 797 ok 798 ok 799 ok 800 ok 801 ok 802 ok 803 ok 804 ok 805 ok 806 ok 807 ok 808 ok 809 ok 810 ok 811 ok 812 ok 813 ok 814 ok 815 ok 816 ok 817 ok 818 ok 819 ok 820 ok 821 ok 822 ok 823 ok 824 ok 825 ok 826 ok 827 ok 828 ok 829 ok 830 ok 831 ok 832 ok 833 ok 834 ok 835 ok 836 ok 837 ok 838 ok 839 ok 840 ok 841 ok 842 ok 843 ok 844 ok 845 ok 846 ok 847 ok 848 ok 849 ok 850 ok 851 ok 852 ok 853 ok 854 ok 855 ok 856 ok 857 ok 858 ok 859 ok 860 ok 861 ok 862 ok 863 ok 864 ok 865 ok 866 ok 867 ok 868 ok 869 ok 870 ok 871 ok 872 ok 873 ok 874 ok 875 ok 876 ok 877 ok 878 ok 879 ok 880 ok 881 ok 882 ok 883 ok 884 ok 885 ok 886 ok 887 ok 888 ok 889 ok 890 ok 891 ok 892 ok 893 ok 894 ok 895 ok 896 ok 897 ok 898 ok 899 ok 900 ok 901 ok 902 ok 903 ok 904 ok 905 ok 906 ok 907 ok 908 ok 909 ok 910 ok 911 ok 912 ok 913 ok 914 ok 915 ok 916 ok 917 ok 918 ok 919 ok 920 ok 921 ok 922 ok 923 ok 924 ok 925 ok 926 ok 927 ok 928 ok 929 ok 930 ok 931 ok 932 ok 933 ok 934 ok 935 ok 936 ok 937 ok 938 ok 939 ok 940 ok 941 ok 942 ok 943 ok 944 ok 945 ok 946 ok 947 ok 948 ok 949 ok 950 ok 951 ok 952 ok 953 ok 954 ok 955 ok 956 ok 957 ok 958 ok 959 ok 960 ok 961 ok 962 ok 963 ok 964 ok 965 ok 966 ok 967 ok 968 ok 969 ok 970 ok 971 ok 972 ok 973 ok 974 ok 975 ok 976 ok 977 ok 978 ok 979 ok 980 ok 981 ok 982 ok 983 ok 984 ok 985 ok 986 ok 987 ok 988 ok 989 ok 990 ok 991 ok 992 ok 993 ok 994 ok 995 ok 996 ok 997 ok 998 ok 999 ok 1000 ok 1001 ok 1002 ok 1003 ok 1004 ok 1005 ok 1006 ok 1007 ok 1008 ok 1009 ok 1010 ok 1011 ok 1012 ok 1013 ok 1014 ok 1015 ok 1016 ok 1017 ok 1018 ok 1019 ok 1020 ok 1021 ok 1022 ok 1023 ok 1024 ok 1025 ok 1026 ok 1027 ok 1028 ok 1029 ok 1030 ok 1031 ok 1032 ok 1033 ok 1034 ok 1035 ok 1036 ok 1037 ok 1038 ok 1039 ok 1040 ok 1041 ok 1042 ok 1043 ok 1044 ok 1045 ok 1046 - # # # # # # # ok 1047 - # # # # # # # # ok 1048 - my Data::Edit::Xml=HASH(0x42457d0) = Data::Edit::Xml::new(< # # # # # # # ok 1049 - # # # # # # # # ok 1050 - my Data::Edit::Xml=HASH(0x42458a8) = Data::Edit::Xml::new(< # # # # # # # ok 1051 - # # # # # # # ok 1052 - # # # # # # # ok 1053 - # # # # # # # ok 1054 - # # # # # # # ok 1055 - # # # # # # # ok 1056 ok 1057 ok 1058 ok 1059 ok 1060 ok 1061 ok 1062 ok 1063 ok 1064 ok 1065 ok 1066 ok 1067 ok 1068 ok 1069 ok 1070 ok 1071 ok 1072 ok 1073 ok 1074 ok 1075 ok 1076 ok 1077 ok 1078 ok 1079 ok 1080 ok 1081 ok 1082 ok 1083 ok 1084 ok 1085 ok 1086 ok 1087 ok 1088 ok 1089 ok 1090 ok 1091 Dubious, test returned 2 (wstat 512, 0x200) Failed 46/1137 subtests Test Summary Report ------------------- test.pl (Wstat: 512 Tests: 1091 Failed: 0) Non-zero exit status: 2 Parse errors: Bad plan. You planned 1137 tests but ran 1091. Files=1, Tests=1091, 3 wallclock secs ( 0.07 usr 0.04 sys + 2.96 cusr 0.37 csys = 3.44 CPU) Result: FAIL Failed 1/1 test programs. 0/1091 subtests failed. PRBRENAN/Data-Edit-Xml-20190314.tar.gz ./Build test verbose=1 -- NOT OK //hint// to see the cpan-testers results for installing this module, try: reports PRBRENAN/Data-Edit-Xml-20190314.tar.gz VmSize: 378440 kB Finished 2019-03-15T02:00:40