File: 07magic.t

package info (click to toggle)
libclone-perl 0.18-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 96 kB
  • ctags: 34
  • sloc: perl: 222; makefile: 54
file content (42 lines) | stat: -rwxr-xr-x 1,062 bytes parent folder | download
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
# $Id: 07magic.t,v 1.2 2005/04/20 15:49:35 ray Exp $
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'

######################### We start with some black magic to print on failure.

# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)

BEGIN { $| = 1; print "1..2\n"; }
END {print "not ok 1\n" unless $loaded;}
use Clone;
use Data::Dumper;
$loaded = 1;
print "ok 1\n";

######################### End of black magic.

# Insert your test code below (better if it prints "ok 13"
# (correspondingly "not ok 13") depending on the success of chunk 13
# of the test code):

$^W = 0;
$test = 2;

sub ok     { printf("ok %d\n", $test++); }
sub not_ok { printf("not ok %d\n", $test++); }

use strict;

package main;

use Scalar::Util qw( weaken );

my $x = { a => "worked\n" }; 
my $y = $x;
weaken($y);
my $z = Clone::clone($x);
Dumper($x) eq Dumper($z) ? ok : not_ok;

# print Dumper($a, $b);
# print Dumper($a, $c);