1use Test::More;
2
3#
4# Basically the same as watch.t but with 'use strict;'
5#  (follow a bug spotted by Yann KEHERVE)
6#
7use strict;
8
9use vars qw($TESTS);
10
11BEGIN {
12	$TESTS = 12;
13	plan tests => $TESTS;
14}
15
16#use Devel::StealthDebug (SOURCE=>"./strict.rst2", emit_type=>'print');
17use Devel::StealthDebug;
18use File::Temp "tempfile";
19
20close STDERR;
21my ($fh,$fn)= tempfile() or die $!;
22open (STDERR, "> $fn") or die $!;
23
24my %testhash;
25#!watch(%testhash)!
26my @testarray;#!watch(@testarray)!
27my $testscalar;#!watch($testscalar)!
28my $dummy;
29
30$testhash{test1} = 1;
31$testhash{test1}++;
32$dummy = $testhash{test1} ;
33
34$testarray[1] = 1;
35$testarray[1]++;
36$dummy = $testarray[1];
37
38$testscalar = 1;
39$testscalar++;
40$dummy = $testscalar;
41
42close STDERR;
43
44open (STDIN,"< $fn");
45my ($out,$check);
46for (1..$TESTS) {
47	$out=<STDIN>;
48	$check=<DATA>;
49	chomp $check;
50	$check=quotemeta($check);
51	like($out, qr/$check/);
52}
53__DATA__
54STORE (%testhash{test1} <- 1)
55FETCH (%testhash{test1} -> 1)
56STORE (%testhash{test1} <- 2)
57FETCH (%testhash{test1} -> 2)
58STORE (@testarray[1] <- 1)
59FETCH (@testarray[1] -> 1)
60STORE (@testarray[1] <- 2)
61FETCH (@testarray[1] -> 2)
62STORE ($testscalar <- 1)
63FETCH ($testscalar -> 1)
64STORE ($testscalar <- 2)
65FETCH ($testscalar -> 2)
66