Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: cc45ffd34d
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 64 lines (49 sloc) 1.065 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
#! /usr/local/bin/parrot
# Copyright (C) 2009, Parrot Foundation.

=head1 XML Declaration

=head2 Synopsis

% parrot t/13-xmldecl.t

=cut

.sub 'main' :main
    load_bytecode 'xml.pir'

    .include 'test_more.pir'

    plan(3)

    test_version()
    test_encoding()
    test_standalone()
.end

.sub 'test_version'
     $S1 = <<'XML'
<?xml version='1.0'?><elt>content</elt>
XML
     $S0 = 'xml_to_xml'($S1)
     is($S0, <<'OUT', 'version')
<?xml version="1.0"?>
<elt>content</elt>
OUT
.end

.sub 'test_encoding'
     $S1 = <<'XML'
<?xml version='1.0' encoding='utf-8'?><elt>content</elt>
XML
     $S0 = 'xml_to_xml'($S1)
     is($S0, <<'OUT', 'encoding')
<?xml version="1.0" encoding="utf-8"?>
<elt>content</elt>
OUT
.end

.sub 'test_standalone'
     $S1 = <<'XML'
<?xml version='1.0' standalone="yes"?><elt>content</elt>
XML
     $S0 = 'xml_to_xml'($S1)
     is($S0, <<'OUT', 'standalone')
<?xml version="1.0" standalone="yes"?>
<elt>content</elt>
OUT
.end


# Local Variables:
# mode: pir
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir:

Something went wrong with that request. Please try again.