~ubuntu-branches/ubuntu/wily/libclone-perl/wily-proposed

« back to all changes in this revision

Viewing changes to t/07magic.t

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2005-07-21 14:10:27 UTC
  • mfrom: (0.2.1 upstream) (1.1.1 breezy)
  • Revision ID: james.westby@ubuntu.com-20050721141027-70fbyjfg0ce32rdr
Tags: 0.18-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $Id: 07magic.t,v 1.2 2005/04/20 15:49:35 ray Exp $
 
2
# Before `make install' is performed this script should be runnable with
 
3
# `make test'. After `make install' it should work as `perl test.pl'
 
4
 
 
5
######################### We start with some black magic to print on failure.
 
6
 
 
7
# Change 1..1 below to 1..last_test_to_print .
 
8
# (It may become useful if the test is moved to ./t subdirectory.)
 
9
 
 
10
BEGIN { $| = 1; print "1..2\n"; }
 
11
END {print "not ok 1\n" unless $loaded;}
 
12
use Clone;
 
13
use Data::Dumper;
 
14
$loaded = 1;
 
15
print "ok 1\n";
 
16
 
 
17
######################### End of black magic.
 
18
 
 
19
# Insert your test code below (better if it prints "ok 13"
 
20
# (correspondingly "not ok 13") depending on the success of chunk 13
 
21
# of the test code):
 
22
 
 
23
$^W = 0;
 
24
$test = 2;
 
25
 
 
26
sub ok     { printf("ok %d\n", $test++); }
 
27
sub not_ok { printf("not ok %d\n", $test++); }
 
28
 
 
29
use strict;
 
30
 
 
31
package main;
 
32
 
 
33
use Scalar::Util qw( weaken );
 
34
 
 
35
my $x = { a => "worked\n" }; 
 
36
my $y = $x;
 
37
weaken($y);
 
38
my $z = Clone::clone($x);
 
39
Dumper($x) eq Dumper($z) ? ok : not_ok;
 
40
 
 
41
# print Dumper($a, $b);
 
42
# print Dumper($a, $c);