From 7dcc41946c3442d28741020026eea4f2cd1c3172 Mon Sep 17 00:00:00 2001 From: "David E. Wheeler" Date: Tue, 23 Sep 2008 21:12:21 +0000 Subject: [PATCH] Converted `sql/matching.sql` to use `check_test()`. --- expected/matching.out | 40 ++++++++++++++++------------- sql/matching.sql | 60 ++++++++++++++++++++++--------------------- 2 files changed, 53 insertions(+), 47 deletions(-) diff --git a/expected/matching.out b/expected/matching.out index cbbc0e9ac..83049e757 100644 --- a/expected/matching.out +++ b/expected/matching.out @@ -1,22 +1,26 @@ \unset ECHO -1..20 +1..24 ok 1 - matches() should work ok 2 - matches() should work with a regex ok 3 - imatches() should work with a regex -ok 4 - matches() failure -ok 5 - Check matches diagnostics -ok 6 - doesnt_match() should work -ok 7 - doesnt_match() should work with a regex -ok 8 - doesnt_imatch() should work with a regex -ok 9 - doesnt_match() failure -ok 10 - doesnt_match() should work -ok 11 - alike() should work -ok 12 - alike() should work with a regex -ok 13 - ialike() should work with a regex -ok 14 - alike() failure -ok 15 - Check alike diagnostics -ok 16 - unalike() should work -ok 17 - unalike() should work with a regex -ok 18 - iunalike() should work with a regex -ok 19 - unalike() failure -ok 20 - Check unalike diagnostics +ok 4 - matches() fail should fail +ok 5 - matches() fail should have the proper description +ok 6 - matches() fail should have the proper diagnostics +ok 7 - doesnt_match() should work +ok 8 - doesnt_match() should work with a regex +ok 9 - doesnt_imatch() should work with a regex +ok 10 - doesnt_match() fail should fail +ok 11 - doesnt_match() fail should have the proper description +ok 12 - doesnt_match() fail should have the proper diagnostics +ok 13 - alike() should work +ok 14 - alike() should work with a regex +ok 15 - ialike() should work with a regex +ok 16 - alike() fail should fail +ok 17 - alike() fail should have the proper description +ok 18 - alike() fail should have the proper diagnostics +ok 19 - unalike() should work +ok 20 - unalike() should work with a regex +ok 21 - iunalike() should work with a regex +ok 22 - unalike() fail should fail +ok 23 - unalike() fail should have the proper description +ok 24 - unalike() fail should have the proper diagnostics diff --git a/sql/matching.sql b/sql/matching.sql index ad6fecc1e..5b39b48d7 100644 --- a/sql/matching.sql +++ b/sql/matching.sql @@ -3,7 +3,7 @@ -- $Id$ -SELECT plan(20); +SELECT plan(24); /****************************************************************************/ -- Test matches(). @@ -12,11 +12,14 @@ SELECT matches( 'foo'::text, '^fo', 'matches() should work with a regex' ); SELECT imatches( 'FOO'::text, '^fo', 'imatches() should work with a regex' ); -- Check matches() diagnostics. -\echo ok 4 - matches() failure -SELECT is( matches( 'foo'::text, '^a' ), 'not ok 4 -# Failed test 4 -# ''foo'' -# doesn''t match: ''^a''', 'Check matches diagnostics' ); +SELECT * FROM check_test( + matches( 'foo'::text, '^a' ), + false, + 'matches() fail', + '', + ' ''foo'' + doesn''t match: ''^a''' +); -- Check doesnt_match. SELECT doesnt_match( 'foo'::text, 'a', 'doesnt_match() should work' ); @@ -24,19 +27,15 @@ SELECT doesnt_match( 'foo'::text, '^o', 'doesnt_match() should work with a regex SELECT doesnt_imatch( 'foo'::text, '^o', 'doesnt_imatch() should work with a regex' ); -- Check doesnt_match diagnostics. -\echo ok 9 - doesnt_match() failure -SELECT is( +SELECT * FROM check_test( doesnt_match( 'foo'::text, 'o' ), - 'not ok 9 -# Failed test 9 -# ''foo'' -# matches: ''o''', - 'doesnt_match() should work' + false, + 'doesnt_match() fail', + '', + ' ''foo'' + matches: ''o''' ); --- Clean up the failed test results. -UPDATE __tresults__ SET ok = true, aok = true WHERE numb IN( 4, 9 ); - /****************************************************************************/ -- Test alike(). SELECT alike( 'foo'::text, 'foo', 'alike() should work' ); @@ -44,11 +43,14 @@ SELECT alike( 'foo'::text, 'fo%', 'alike() should work with a regex' ); SELECT ialike( 'FOO'::text, 'fo%', 'ialike() should work with a regex' ); -- Check alike() diagnostics. -\echo ok 14 - alike() failure -SELECT is( alike( 'foo'::text, 'a%'::text ), 'not ok 14 -# Failed test 14 -# ''foo'' -# doesn''t match: ''a%''', 'Check alike diagnostics' ); +SELECT * FROM check_test( + alike( 'foo'::text, 'a%'::text ), + false, + 'alike() fail', + '', + ' ''foo'' + doesn''t match: ''a%''' +); -- Test unalike(). SELECT unalike( 'foo'::text, 'f', 'unalike() should work' ); @@ -56,14 +58,14 @@ SELECT unalike( 'foo'::text, 'f%i', 'unalike() should work with a regex' ); SELECT unialike( 'FOO'::text, 'f%i', 'iunalike() should work with a regex' ); -- Check unalike() diagnostics. -\echo ok 19 - unalike() failure -SELECT is( unalike( 'foo'::text, 'f%'::text ), 'not ok 19 -# Failed test 19 -# ''foo'' -# matches: ''f%''', 'Check unalike diagnostics' ); - --- Clean up the failed test results. -UPDATE __tresults__ SET ok = true, aok = true WHERE numb IN( 14, 19 ); +SELECT * FROM check_test( + unalike( 'foo'::text, 'f%'::text ), + false, + 'unalike() fail', + '', + ' ''foo'' + matches: ''f%''' +); /****************************************************************************/ -- Finish the tests and clean up.