This repository has been archived by the owner on Jun 9, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
357 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,40 @@ | ||
#! perl | ||
#! /usr/local/bin/parrot | ||
# Copyright (C) 2009, Parrot Foundation. | ||
|
||
=head1 some XML examples | ||
|
||
=head2 Synopsis | ||
|
||
% perl t/00-sanity.t | ||
% parrot t/00-sanity.t | ||
|
||
=head2 Description | ||
|
||
First tests in order to check infrastructure. | ||
|
||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use FindBin; | ||
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin"; | ||
.sub 'main' :main | ||
load_bytecode 'xml.pir' | ||
|
||
use Parrot::Test tests => 1; | ||
use Test::More; | ||
.include 'test_more.pir' | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'ex1' ); | ||
<elt>content</elt> | ||
CODE | ||
plan(1) | ||
|
||
test_1() | ||
.end | ||
|
||
.sub 'test_1' | ||
$S1 = <<'XML' | ||
<elt>content</elt> | ||
OUT | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, $S1, 'ex1') | ||
.end | ||
|
||
|
||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# mode: pir | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: | ||
# vim: expandtab shiftwidth=4 ft=pir: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,49 @@ | ||
#! perl | ||
#! /usr/local/bin/parrot | ||
# Copyright (C) 2009, Parrot Foundation. | ||
|
||
=head1 Comment | ||
|
||
=head2 Synopsis | ||
|
||
% perl t/10-comment.t | ||
% parrot t/10-comment.t | ||
|
||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use FindBin; | ||
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin"; | ||
.sub 'main' :main | ||
load_bytecode 'xml.pir' | ||
|
||
use Parrot::Test tests => 2; | ||
use Test::More; | ||
.include 'test_more.pir' | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'some comments' ); | ||
<!-- first comment --><elt><!-- other comment --></elt><!-- final comment --> | ||
CODE | ||
plan(2) | ||
|
||
test_1() | ||
test_2() | ||
.end | ||
|
||
.sub 'test_1' | ||
$S1 = <<'XML' | ||
<!-- first comment --><elt><!-- other comment --></elt><!-- final comment --> | ||
OUT | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, $S1, 'some comments') | ||
.end | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'some comments' ); | ||
<elt> | ||
<!-- | ||
multi-line comment | ||
--> | ||
</elt> | ||
CODE | ||
.sub 'test_2' | ||
$S1 = <<'XML' | ||
<elt> | ||
<!-- | ||
multi-line comment | ||
--> | ||
</elt> | ||
OUT | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, $S1, 'some comments') | ||
.end | ||
|
||
|
||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# mode: pir | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: | ||
# vim: expandtab shiftwidth=4 ft=pir: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,47 @@ | ||
#! perl | ||
#! /usr/local/bin/parrot | ||
# Copyright (C) 2009, Parrot Foundation. | ||
|
||
=head1 Processing Instruction | ||
|
||
=head2 Synopsis | ||
|
||
% perl t/11-pi.t | ||
% parrot t/11-pi.t | ||
|
||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use FindBin; | ||
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin"; | ||
.sub 'main' :main | ||
load_bytecode 'xml.pir' | ||
|
||
use Parrot::Test tests => 2; | ||
use Test::More; | ||
.include 'test_more.pir' | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'some PI' ); | ||
<?first_pi?><elt><?other_pi?></elt><?final_pi?> | ||
CODE | ||
plan(2) | ||
|
||
test_1() | ||
test_2() | ||
.end | ||
|
||
.sub 'test_1' | ||
$S1 = <<'XML' | ||
<?first_pi?><elt><?other_pi?></elt><?final_pi?> | ||
OUT | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, $S1, 'some PI') | ||
.end | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'with data' ); | ||
.sub 'test_2' | ||
$S1 = <<'XML' | ||
<?first_pi 42?><elt><?other_pi with many words ?></elt><?final_pi 42?> | ||
CODE | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, <<'OUT', 'with data') | ||
<?first_pi 42?><elt><?other_pi with many words ?></elt><?final_pi 42?> | ||
OUT | ||
.end | ||
|
||
|
||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# mode: pir | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: | ||
# vim: expandtab shiftwidth=4 ft=pir: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
#! perl | ||
#! /usr/local/bin/parrot | ||
# Copyright (C) 2009, Parrot Foundation. | ||
|
||
=head1 CDATA Sections | ||
|
||
=head2 Synopsis | ||
|
||
% perl t/12-cdata.t | ||
% parrot t/12-cdata.t | ||
|
||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use FindBin; | ||
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin"; | ||
.sub 'main' :main | ||
load_bytecode 'xml.pir' | ||
|
||
use Parrot::Test tests => 2; | ||
use Test::More; | ||
.include 'test_more.pir' | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'cdata' ); | ||
<elt><![CDATA[content]]></elt> | ||
CODE | ||
plan(2) | ||
|
||
test_1() | ||
test_2() | ||
.end | ||
|
||
.sub 'test_1' | ||
$S1 = <<'XML' | ||
<elt><![CDATA[content]]></elt> | ||
OUT | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, $S1, 'cdata') | ||
.end | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'cdata' ); | ||
.sub 'test_2' | ||
$S1 = <<'XML' | ||
<elt><![CDATA[ <>&'" ]]></elt> | ||
CODE | ||
<elt><![CDATA[ <>&'" ]]></elt> | ||
OUT | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, $S1, 'cdata') | ||
.end | ||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# mode: pir | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: | ||
# vim: expandtab shiftwidth=4 ft=pir: | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,63 @@ | ||
#! perl | ||
#! /usr/local/bin/parrot | ||
# Copyright (C) 2009, Parrot Foundation. | ||
|
||
=head1 XML Declaration | ||
|
||
=head2 Synopsis | ||
|
||
% perl t/13-xmldecl.t | ||
% parrot t/13-xmldecl.t | ||
|
||
=cut | ||
|
||
use strict; | ||
use warnings; | ||
use FindBin; | ||
use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin"; | ||
.sub 'main' :main | ||
load_bytecode 'xml.pir' | ||
|
||
use Parrot::Test tests => 3; | ||
use Test::More; | ||
.include 'test_more.pir' | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'version' ); | ||
plan(3) | ||
|
||
test_version() | ||
test_encoding() | ||
test_standalone() | ||
.end | ||
|
||
.sub 'test_version' | ||
$S1 = <<'XML' | ||
<?xml version='1.0'?><elt>content</elt> | ||
CODE | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, <<'OUT', 'version') | ||
<?xml version="1.0"?> | ||
<elt>content</elt> | ||
OUT | ||
.end | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'encoding' ); | ||
.sub 'test_encoding' | ||
$S1 = <<'XML' | ||
<?xml version='1.0' encoding='utf-8'?><elt>content</elt> | ||
CODE | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, <<'OUT', 'encoding') | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<elt>content</elt> | ||
OUT | ||
.end | ||
|
||
language_output_is( 'xml', <<'CODE', <<'OUT', 'standalone' ); | ||
.sub 'test_standalone' | ||
$S1 = <<'XML' | ||
<?xml version='1.0' standalone="yes"?><elt>content</elt> | ||
CODE | ||
XML | ||
$S0 = 'xml_to_xml'($S1) | ||
is($S0, <<'OUT', 'standalone') | ||
<?xml version="1.0" standalone="yes"?> | ||
<elt>content</elt> | ||
OUT | ||
.end | ||
|
||
|
||
# Local Variables: | ||
# mode: cperl | ||
# cperl-indent-level: 4 | ||
# mode: pir | ||
# fill-column: 100 | ||
# End: | ||
# vim: expandtab shiftwidth=4: | ||
# vim: expandtab shiftwidth=4 ft=pir: | ||
|
Oops, something went wrong.