Commits

Toby Inkster committed c074f38

formatting changes to test files

Comments (0)

Files changed (2)

 my $root = XML::LibXML->load_xml( IO => \*DATA )->documentElement;
 
 # TEST
-ok
-	tied %$root,
-	'elements can be hash dereffed to a tied hash';
+ok(
+    tied %$root,
+    'elements can be hash dereffed to a tied hash',
+    );
 
 # TEST
-isa_ok
-	tied %$root,
-	'XML::LibXML::AttributeHash',
-	'tied %$element';
+isa_ok(
+    tied %$root,
+    'XML::LibXML::AttributeHash',
+    'tied %$element',
+    );
 
 # TEST
-ok
-	exists $root->{'attr1'},
-	'EXISTS non-namespaced';
+ok(
+    exists $root->{'attr1'},
+    'EXISTS non-namespaced',
+    );
 
 # TEST
-is
-	$root->{'attr1'},
-	'foo',
-	'FETCH non-namespaced';
+is(
+    $root->{'attr1'},
+    'foo',
+    'FETCH non-namespaced',
+    );
 
 $root->{attr1} = 'bar';
 # TEST
-is 
-	$root->getAttribute('attr1'),
-	'bar',
-	'STORE non-namespaced';
+is( 
+    $root->getAttribute('attr1'),
+    'bar',
+    'STORE non-namespaced',
+    );
 
 $root->{attr11} = 'baz';
 # TEST
-is 
-	$root->getAttribute('attr11'),
-	'baz',
-	'STORE (and create) non-namespaced';
+is(
+    $root->getAttribute('attr11'),
+    'baz',
+    'STORE (and create) non-namespaced',
+    );
 
 delete $root->{attr11};
 # TEST
-ok 
-	!$root->hasAttribute('attr11'),
-	'DELETE non-namespaced';
+ok(
+    !$root->hasAttribute('attr11'),
+    'DELETE non-namespaced',
+    );
 
-while (my ($k, $v) = each %$root) {
-	if ($k eq 'attr1') {
-		# TEST
-		ok 1, 'FIRSTKEY/NEXTKEY non-namespaced'
-	}
+my $fail = 1;
+while (my ($k, $v) = each %$root)
+{
+    if ($k eq 'attr1')
+    {
+        $fail = 0;
+        # TEST
+        pass('FIRSTKEY/NEXTKEY non-namespaced');
+    }
+}
+
+if ($fail)
+{
+    fail('FIRSTKEY/NEXTKEY non-namespaced');
 }
 
 # TEST
-ok
-	exists $root->{'{http://localhost/}attr2'},
-	'EXISTS namespaced';
+ok(
+    exists $root->{'{http://localhost/}attr2'},
+    'EXISTS namespaced',
+    );
 
 # TEST
-is
-	$root->{'{http://localhost/}attr2'},
-	'bar',
-	'FETCH namespaced';
+is(
+    $root->{'{http://localhost/}attr2'},
+    'bar',
+    'FETCH namespaced',
+    );
 
 $root->{'{http://localhost/}attr2'} = 'quux';
 # TEST
-is
-	$root->getAttributeNS('http://localhost/', 'attr2'),
-	'quux',
-	'STORE namespaced';
+is(
+    $root->getAttributeNS('http://localhost/', 'attr2'),
+    'quux',
+    'STORE namespaced',
+    );
 
 $root->{'{http://localhost/}attr22'} = 'quuux';
 # TEST
-is
-	$root->getAttributeNS('http://localhost/', 'attr22'),
-	'quuux',
-	'STORE (and create) namespaced';
+is(
+    $root->getAttributeNS('http://localhost/', 'attr22'),
+    'quuux',
+    'STORE (and create) namespaced',
+    );
 
 $root->{'{http://localhost/another}attr22'} = 'xyzzy';
 # TEST
-is
-	$root->getAttributeNS('http://localhost/another', 'attr22'),
-	'xyzzy',
-	'STORE (and create) namespaced, in new namespace';
+is(
+    $root->getAttributeNS('http://localhost/another', 'attr22'),
+    'xyzzy',
+    'STORE (and create) namespaced, in new namespace',
+    );
 
 delete $root->{'{http://localhost/another}attr22'};
 # TEST
-ok 
-	!$root->hasAttributeNS('http://localhost/another', 'attr22'),
-	'DELETE namespaced';
+ok(
+    !$root->hasAttributeNS('http://localhost/another', 'attr22'),
+    'DELETE namespaced',
+    );
 
-while (my ($k, $v) = each %$root) {
-	if ($k eq '{http://localhost/}attr22') {
-		# TEST
-		ok 1, 'FIRSTKEY/NEXTKEY namespaced'
-	}
+my $fail2 = 1;
+while (my ($k, $v) = each %$root)
+{
+    if ($k eq '{http://localhost/}attr22')
+    {
+        $fail2 = 0;
+        # TEST
+        pass('FIRSTKEY/NEXTKEY namespaced');
+    }
+}
+
+if ($fail2)
+{
+    fail('FIRSTKEY/NEXTKEY namespaced');
 }
 
 # TEST
-like
-	$root->toStringEC14N,
-	qr{<root xmlns:x="http://localhost/" attr1="bar" x:attr2="quux" x:attr22="quuux"></root>},
-	'!!! toStringEC14N';
+like(
+    $root->toStringEC14N,
+    qr{<root xmlns:x="http://localhost/" attr1="bar" x:attr2="quux" x:attr22="quuux"></root>},
+    '!!! toStringEC14N',
+    );
 
 __DATA__
 <root attr1="foo" xmlns:x="http://localhost/" x:attr2="bar" />

t/72destruction.t

 
 if (defined (&Scalar::Util::weaken))
 {
-	plan tests => 1;
+    plan tests => 1;
 }
 else
 {
-	plan skip_all => 'Need Scalar::Util::weaken';
+    plan skip_all => 'Need Scalar::Util::weaken';
 }
 
 my $is_destroyed;
-BEGIN {
-	no warnings 'once', 'redefine';
-	my $old = \&XML::LibXML::Element::DESTROY;
-	*XML::LibXML::Element::DESTROY = sub {
-		# warn sprintf("DESTROY %s", $_[0]->toString);
-		$is_destroyed++;
-		$old->(@_);
-	};
+BEGIN
+{
+    no warnings 'once', 'redefine';
+    my $old = \&XML::LibXML::Element::DESTROY;
+    *XML::LibXML::Element::DESTROY = sub
+    {
+        $is_destroyed++;
+        $old->(@_);
+    };
 }
 
 # Create element...
 
 # allow %hash to go out of scope quickly.
 {
-	my %hash = %$root;
-	# assignment to ensure block is not optimized away
-	$hash{foo} = 'phooey'; 
+    my %hash = %$root;
+    # assignment to ensure block is not optimized away
+    $hash{foo} = 'phooey'; 
 } 
 
 # Destroy element...
 my %other = %{ XML::LibXML->load_xml( string => '<foo/>' )->documentElement };
 
 # TEST
-ok $is_destroyed, "does not leak memory";
+ok($is_destroyed, "does not leak memory");
 
 __DATA__
 <root attr1="foo" xmlns:x="http://localhost/" x:attr2="bar" />