Upgrade to Tie::File 0.91, from mjd.
[p5sagit/p5-mst-13.2.git] / lib / open.t
index 5bc4b6d..d9d385b 100644 (file)
@@ -6,7 +6,7 @@ BEGIN {
        require Config; import Config;
 }
 
-use Test::More tests => 15;
+use Test::More tests => 16;
 
 # open::import expects 'open' as its first argument, but it clashes with open()
 sub import {
@@ -32,15 +32,24 @@ local $SIG{__WARN__} = sub {
 };
 
 # and it shouldn't be able to find this discipline
-eval{ import( 'IN', 'macguffin' ) };
+$warn = '';
+eval q{ no warnings 'layer'; use open IN => ':macguffin' ; };
+is( $warn, '',
+       'should not warn about unknown discipline with bad discipline provided' );
+
+$warn = '';
+eval q{ use warnings 'layer'; use open IN => ':macguffin' ; };
 like( $warn, qr/Unknown discipline layer/, 
        'should warn about unknown discipline with bad discipline provided' );
 
-# now load a real-looking locale
-$ENV{LC_ALL} = ' .utf8';
-import( 'IN', 'locale' );
-is( ${^OPEN}, ":utf8\0", 
-       'should set a valid locale layer' );
+SKIP: {
+    skip("no perlio, no :utf8", 1) unless $Config{useperlio};
+    # now load a real-looking locale
+    $ENV{LC_ALL} = ' .utf8';
+    import( 'IN', 'locale' );
+    like( ${^OPEN}, qr/^(:utf8)?:utf8\0/,
+        'should set a valid locale layer' );
+}
 
 # and see if it sets the magic variables appropriately
 import( 'IN', ':crlf' );