From ba6a1e2b416a29c7983b3d9d6202be834808a30a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Tue, 31 Jan 2012 12:14:38 +0100 Subject: [PATCH] SQL unit tests fixes * Added plan() instead of no_plan() where necessary * Removed junk from dirty tests system self-check --- .../040-functions/025-resources/005-add-resource-records.sql | 4 ++-- .../040-functions/045-empire-mining/030-mset-update-apply.sql | 4 ++-- .../050-updates/120-planet-mining/030-gu-pmc-get-data.sql | 4 ++-- .../120-planet-mining/050-process-planet-mining-updates.sql | 4 ++-- .../tests/dirty/000-dirty-tests-self-check/run-test.sql | 4 +--- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/025-resources/005-add-resource-records.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/025-resources/005-add-resource-records.sql index 58ba524..37103d7 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/025-resources/005-add-resource-records.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/025-resources/005-add-resource-records.sql @@ -23,7 +23,7 @@ BEGIN; SELECT defs.add_resource_records( _get_string( 'test1' ) ); /***** TESTS BEGIN HERE *****/ - SELECT no_plan( ); + SELECT plan( 2 ); SELECT diag_test_name( 'defs.add_resource_records() - Empire record created' ); SELECT is( COUNT(*)::INT , 1 ) @@ -36,4 +36,4 @@ BEGIN; WHERE planet_id = 1 AND resource_name_id = _get_string( 'test1' ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-mining/030-mset-update-apply.sql b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-mining/030-mset-update-apply.sql index 74d49b1..14c8d6d 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-mining/030-mset-update-apply.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/040-functions/045-empire-mining/030-mset-update-apply.sql @@ -21,7 +21,7 @@ BEGIN; INSERT INTO mset_update VALUES ( 1 , 1 , 0 ) , ( 1 , 2 , 4 ); /***** TESTS BEGIN HERE *****/ - SELECT no_plan( ); + SELECT plan( 8 ); SELECT diag_test_name( 'emp.mset_update_apply() - Applying valid empire update' ); SELECT ok( emp.mset_update_apply( ) ); @@ -90,4 +90,4 @@ BEGIN; ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/030-gu-pmc-get-data.sql b/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/030-gu-pmc-get-data.sql index 7765aa2..026aa34 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/030-gu-pmc-get-data.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/030-gu-pmc-get-data.sql @@ -11,7 +11,7 @@ BEGIN; /***** TESTS BEGIN HERE *****/ - SELECT no_plan( ); + SELECT plan( 9 ); SELECT diag_test_name( 'sys.gu_pmc_get_data() - Neutral planet without resource providers not included' ); SELECT is_empty( $$ @@ -86,4 +86,4 @@ BEGIN; $$ ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/050-process-planet-mining-updates.sql b/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/050-process-planet-mining-updates.sql index 4c449b6..19da05c 100644 --- a/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/050-process-planet-mining-updates.sql +++ b/legacyworlds-server-data/db-structure/tests/admin/050-updates/120-planet-mining/050-process-planet-mining-updates.sql @@ -42,7 +42,7 @@ BEGIN; /***** TESTS BEGIN HERE *****/ - SELECT no_plan( ); + SELECT plan( 2 ); SELECT sys.process_planet_mining_updates( 0 ); @@ -55,4 +55,4 @@ BEGIN; ); SELECT * FROM finish( ); -ROLLBACK; \ No newline at end of file +ROLLBACK; diff --git a/legacyworlds-server-data/db-structure/tests/dirty/000-dirty-tests-self-check/run-test.sql b/legacyworlds-server-data/db-structure/tests/dirty/000-dirty-tests-self-check/run-test.sql index 6786ab2..be13190 100644 --- a/legacyworlds-server-data/db-structure/tests/dirty/000-dirty-tests-self-check/run-test.sql +++ b/legacyworlds-server-data/db-structure/tests/dirty/000-dirty-tests-self-check/run-test.sql @@ -4,9 +4,7 @@ * Insert an address, it should exist during the main test. */ BEGIN; - SELECT no_plan( ); - - SELECT pg_advisory_lock( 1 ); + SELECT plan( 1 ); SELECT diag_test_name( 'Dirty test system self-check - prepare.sql was executed' ); SELECT is( COUNT(*)::INT , 1 )