From: Rafael Garcia-Suarez Date: Mon, 2 Sep 2002 19:29:52 +0000 (+0000) Subject: Some simple tests for the POSIX::isXXX() functions. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4b3c65319d38214d41329be28b326e1cec9de88b;p=p5sagit%2Fp5-mst-13.2.git Some simple tests for the POSIX::isXXX() functions. p4raw-id: //depot/perl@17822 --- diff --git a/ext/POSIX/t/posix.t b/ext/POSIX/t/posix.t index 8f31ada..01dba7f 100644 --- a/ext/POSIX/t/posix.t +++ b/ext/POSIX/t/posix.t @@ -11,7 +11,7 @@ BEGIN { } require "./test.pl"; -plan(tests => 39); +plan(tests => 61); use POSIX qw(fcntl_h signal_h limits_h _exit getcwd open read strftime write @@ -223,6 +223,30 @@ is ($result, undef, "fgets should fail"); like ($@, qr/^Use method IO::Handle::gets\(\) instead/, "check its redef message"); +# Simplistic tests for the isXXX() functions (bug #16799) +ok( POSIX::isalnum('1'), 'isalnum' ); +ok(!POSIX::isalnum('*'), 'isalnum' ); +ok( POSIX::isalpha('f'), 'isalpha' ); +ok(!POSIX::isalpha('7'), 'isalpha' ); +ok( POSIX::iscntrl("\cA"),'iscntrl' ); +ok(!POSIX::iscntrl("A"), 'iscntrl' ); +ok( POSIX::isdigit('1'), 'isdigit' ); +ok(!POSIX::isdigit('z'), 'isdigit' ); +ok( POSIX::isgraph('@'), 'isgraph' ); +ok(!POSIX::isgraph(' '), 'isgraph' ); +ok( POSIX::islower('l'), 'islower' ); +ok(!POSIX::islower('L'), 'islower' ); +ok( POSIX::isupper('U'), 'isupper' ); +ok(!POSIX::isupper('u'), 'isupper' ); +ok( POSIX::isprint('$'), 'isprint' ); +ok(!POSIX::isprint("\n"), 'isprint' ); +ok( POSIX::ispunct('%'), 'ispunct' ); +ok(!POSIX::ispunct('u'), 'ispunct' ); +ok( POSIX::isspace("\t"), 'isspace' ); +ok(!POSIX::isspace('_'), 'isspace' ); +ok( POSIX::isxdigit('f'), 'isxdigit' ); +ok(!POSIX::isxdigit('g'), 'isxdigit' ); + # Check that output is not flushed by _exit. This test should be last # in the file, and is not counted in the total number of tests. if ($^O eq 'vos') {