From: Fuji, Goro Date: Wed, 10 Nov 2010 03:40:28 +0000 (+0900) Subject: Fix tests for portability X-Git-Tag: 0.84~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c74a9e89d1fc566b79e07f3cb9e9deb407e8da1f;p=gitmo%2FMouse.git Fix tests for portability --- diff --git a/t/001_mouse/071_tc_dualvar.t b/t/001_mouse/071_tc_dualvar.t index 44f468f..2a5680f 100644 --- a/t/001_mouse/071_tc_dualvar.t +++ b/t/001_mouse/071_tc_dualvar.t @@ -1,7 +1,7 @@ #!perl -w use strict; use Test::More; -use Errno qw(ENOENT EPERM); +use Scalar::Util qw(dualvar); { package Foo; use Mouse; @@ -17,14 +17,15 @@ use Errno qw(ENOENT EPERM); my $foo = Foo->new(); -for my $e(ENOENT, EPERM) { - $! = $e; - eval { $foo->intval($!) }; - like $@, qr/Validation failed for 'Int'/, 'Int for dualvar'; +my $dv = dualvar(42, 'foo'); +eval { $foo->intval($dv) }; +like $@, qr/Validation failed for 'Int'/, 'Int for dualvar'; + +eval { $foo->numval($dv) }; +like $@, qr/Validation failed for 'Num'/, 'Num for dualvar'; + +cmp_ok $dv, 'eq', 'foo'; +cmp_ok $dv, '==', 42, 'keeps dualvar-ness'; - $! = $e; - eval { $foo->numval($!) }; - like $@, qr/Validation failed for 'Num'/, 'Num for dualvar'; -} done_testing;