Merge lp:~fallaby/mvhub/remove_begin_block_578482 into lp:mvhub
- remove_begin_block_578482
- Merge into trunk_2format
Proposed by
frank allaby
Status: | Merged |
---|---|
Merged at revision: | 500 |
Proposed branch: | lp:~fallaby/mvhub/remove_begin_block_578482 |
Merge into: | lp:mvhub |
Diff against target: |
1303 lines (+126/-354) 52 files modified
app-mvhub/t/bugs/admin_logout_bug.t (+0/-4) app-mvhub/t/bugs/categorize_link_missing_when_agency_login.t (+0/-4) app-mvhub/t/bugs/guide.pl_incomplete_path.t (+0/-5) app-mvhub/t/bugs/ql_display_agency_home_interaction.t (+0/-4) app-mvhub/t/mech/admin/01_add_complete_agency.t (+0/-4) app-mvhub/t/mech/user/agency_search_form_found_mvh_only.t (+0/-4) app-mvhub/t/mech/user/agency_search_form_found_nsp_only.t (+0/-4) app-mvhub/t/mech/user/agency_search_form_not_found.t (+0/-4) app-mvhub/t/mech/user/category_search_form_blank.t (+0/-4) app-mvhub/t/mech/user/category_search_form_found_in_all_db.t (+0/-4) app-mvhub/t/mech/user/category_search_form_not_found.t (+0/-4) app-mvhub/t/mech/user/contact_having_required.t (+0/-4) app-mvhub/t/mech/user/contact_missing_required.t (+0/-4) app-mvhub/t/mech/user/login_with_bad_password.t (+0/-4) app-mvhub/t/mech/user/stuff_search_contact.t (+0/-5) app-mvhub/t/repo_matches_file_system.t (+6/-9) app-mvhub/t/required_comments_present.t (+0/-5) app-mvhub/t/sql_lib_sanity.t (+0/-5) lib-mvhub/t/00-setup.t (+0/-5) lib-mvhub/t/01-load.t (+0/-5) lib-mvhub/t/03-run_test_class.t (+0/-5) lib-mvhub/t/AgencyAccount/new.t (+3/-8) lib-mvhub/t/ArgChecker/get_args.t (+17/-20) lib-mvhub/t/Common/delimit_field.t (+3/-9) lib-mvhub/t/HTMLTemplateUtils/columnize.t (+27/-23) lib-mvhub/t/HTMLTemplateUtils/format_template.t (+3/-9) lib-mvhub/t/Notifications/_push_and_return_programs.t (+0/-5) lib-mvhub/t/Notifications/create_final_notification_emails_with.t (+0/-5) lib-mvhub/t/Notifications/create_fourth_notification_emails_with.t (+0/-5) lib-mvhub/t/Notifications/create_notifications_using.t (+0/-5) lib-mvhub/t/Notifications/create_standard_notification_emails_with.t (+0/-5) lib-mvhub/t/Notifications/die_if_record_count_mismatch.t (+0/-5) lib-mvhub/t/Notifications/get_email_constants_from.t (+0/-5) lib-mvhub/t/Notifications/get_expired_records.t (+0/-4) lib-mvhub/t/Notifications/increment_reminder_levels_for.t (+0/-5) lib-mvhub/t/Notifications/print_emails_contained_in.t (+0/-5) lib-mvhub/t/Notifications/send_emails_contained_in.t (+0/-5) lib-mvhub/t/Notifications/set_reminder_level_in_db.t (+0/-5) lib-mvhub/t/Notifications/shift_off_notifications_with_reminder_count.t (+0/-5) lib-mvhub/t/Utils/ConfigSimple/_calculate_extra_cfg_params_from.t (+0/-5) lib-mvhub/t/Utils/DB/get_data_source.t (+0/-5) lib-mvhub/t/Utils/DB/get_sql_insert_statement.t (+0/-5) lib-mvhub/t/Utils/DB/get_sql_select_statement.t (+0/-5) lib-mvhub/t/Utils/DB/get_sql_update_statement.t (+0/-5) lib-mvhub/t/Utils/assert.t (+8/-13) lib-mvhub/t/Utils/clean_cgi_params.t (+9/-16) lib-mvhub/t/Utils/die_if_missing_env_vars.t (+7/-12) lib-mvhub/t/Utils/mm_dd_yyyy_to_yyyy_mm_dd.t (+10/-14) lib-mvhub/t/Utils/parse_zip_code.t (+14/-19) lib-mvhub/t/Utils/trim.t (+9/-8) lib-mvhub/t/Utils/yyyy_mm_dd_to_mm_dd_yyyy.t (+10/-13) lib-mvhub/t/pod_valid.t (+0/-5) |
To merge this branch: | bzr merge lp:~fallaby/mvhub/remove_begin_block_578482 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dan MacNeil | Needs Fixing | ||
Review via email: mp+36731@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Dan MacNeil (omacneil) wrote : | # |
487 -use Test::More tests => 5 + 1; # +1 for NoWarnings
488 +use Test::More tests => 5;
better:
487 -use Test::More tests => 5 + 1; # +1 for NoWarnings
488 +use Test::More tests => 4 + 1 ; # +1 for NoWarnings
review:
Needs Fixing
Revision history for this message
Dan MacNeil (omacneil) wrote : | # |
otherwise pretty good, will approve & merge one these nits are fixed.
- 496. By frank allaby
-
fixes from Dan
- 497. By frank allaby
-
merged trunk
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'app-mvhub/t/bugs/admin_logout_bug.t' |
2 | --- app-mvhub/t/bugs/admin_logout_bug.t 2009-09-15 01:12:17 +0000 |
3 | +++ app-mvhub/t/bugs/admin_logout_bug.t 2010-09-28 16:02:42 +0000 |
4 | @@ -6,10 +6,6 @@ |
5 | use Test::WWW::Mechanize; |
6 | use Test::More; |
7 | |
8 | -BEGIN { |
9 | - use FindBin qw($Bin); |
10 | - chdir $Bin; |
11 | -} #BEGIN |
12 | use TestHelper; |
13 | |
14 | { #main |
15 | |
16 | === modified file 'app-mvhub/t/bugs/categorize_link_missing_when_agency_login.t' |
17 | --- app-mvhub/t/bugs/categorize_link_missing_when_agency_login.t 2010-09-13 00:58:44 +0000 |
18 | +++ app-mvhub/t/bugs/categorize_link_missing_when_agency_login.t 2010-09-28 16:02:42 +0000 |
19 | @@ -10,10 +10,6 @@ |
20 | |
21 | use Params::Validate qw/:all/; |
22 | |
23 | -BEGIN { |
24 | - use FindBin qw($Bin); |
25 | - chdir $Bin; |
26 | -} #BEGIN |
27 | use TestHelper; |
28 | |
29 | { #main |
30 | |
31 | === modified file 'app-mvhub/t/bugs/guide.pl_incomplete_path.t' |
32 | --- app-mvhub/t/bugs/guide.pl_incomplete_path.t 2010-09-13 00:58:44 +0000 |
33 | +++ app-mvhub/t/bugs/guide.pl_incomplete_path.t 2010-09-28 16:02:42 +0000 |
34 | @@ -9,11 +9,6 @@ |
35 | use Test::WWW::Mechanize; |
36 | use WWW::Mechanize; |
37 | |
38 | -BEGIN { |
39 | - use FindBin qw($Bin); |
40 | - chdir $Bin; |
41 | -} #BEGIN |
42 | - |
43 | { #main |
44 | my $host = TestHelper::get_test_website_name('nsp'); |
45 | my @pages = init_pages($host); |
46 | |
47 | === modified file 'app-mvhub/t/bugs/ql_display_agency_home_interaction.t' |
48 | --- app-mvhub/t/bugs/ql_display_agency_home_interaction.t 2010-09-13 00:58:44 +0000 |
49 | +++ app-mvhub/t/bugs/ql_display_agency_home_interaction.t 2010-09-28 16:02:42 +0000 |
50 | @@ -10,10 +10,6 @@ |
51 | |
52 | use Params::Validate qw/:all/; |
53 | |
54 | -BEGIN { |
55 | - use FindBin qw($Bin); |
56 | - chdir $Bin; |
57 | -} #BEGIN |
58 | use TestHelper; |
59 | |
60 | { #main |
61 | |
62 | === modified file 'app-mvhub/t/mech/admin/01_add_complete_agency.t' |
63 | --- app-mvhub/t/mech/admin/01_add_complete_agency.t 2010-09-13 00:58:44 +0000 |
64 | +++ app-mvhub/t/mech/admin/01_add_complete_agency.t 2010-09-28 16:02:42 +0000 |
65 | @@ -8,10 +8,6 @@ |
66 | |
67 | use English '-no_match_vars'; |
68 | |
69 | -BEGIN { |
70 | - use FindBin qw($Bin); |
71 | - chdir $Bin; |
72 | -} |
73 | use TestHelper; |
74 | |
75 | { # main |
76 | |
77 | === modified file 'app-mvhub/t/mech/user/agency_search_form_found_mvh_only.t' |
78 | --- app-mvhub/t/mech/user/agency_search_form_found_mvh_only.t 2010-09-13 00:58:44 +0000 |
79 | +++ app-mvhub/t/mech/user/agency_search_form_found_mvh_only.t 2010-09-28 16:02:42 +0000 |
80 | @@ -6,10 +6,6 @@ |
81 | use Test::More; |
82 | use Test::WWW::Mechanize; |
83 | |
84 | -BEGIN { |
85 | - use FindBin qw($Bin); |
86 | - chdir $Bin; |
87 | -} |
88 | use TestHelper; |
89 | |
90 | { #main |
91 | |
92 | === modified file 'app-mvhub/t/mech/user/agency_search_form_found_nsp_only.t' |
93 | --- app-mvhub/t/mech/user/agency_search_form_found_nsp_only.t 2010-09-13 00:58:44 +0000 |
94 | +++ app-mvhub/t/mech/user/agency_search_form_found_nsp_only.t 2010-09-28 16:02:42 +0000 |
95 | @@ -6,10 +6,6 @@ |
96 | use Test::More; |
97 | use Test::WWW::Mechanize; |
98 | |
99 | -BEGIN { |
100 | - use FindBin qw($Bin); |
101 | - chdir $Bin; |
102 | -} |
103 | use TestHelper; |
104 | |
105 | { #main |
106 | |
107 | === modified file 'app-mvhub/t/mech/user/agency_search_form_not_found.t' |
108 | --- app-mvhub/t/mech/user/agency_search_form_not_found.t 2010-09-13 00:58:44 +0000 |
109 | +++ app-mvhub/t/mech/user/agency_search_form_not_found.t 2010-09-28 16:02:42 +0000 |
110 | @@ -6,10 +6,6 @@ |
111 | use Test::More; |
112 | use Test::WWW::Mechanize; |
113 | |
114 | -BEGIN { |
115 | - use FindBin qw($Bin); |
116 | - chdir $Bin; |
117 | -} |
118 | use TestHelper; |
119 | |
120 | { #main |
121 | |
122 | === modified file 'app-mvhub/t/mech/user/category_search_form_blank.t' |
123 | --- app-mvhub/t/mech/user/category_search_form_blank.t 2010-09-13 00:58:44 +0000 |
124 | +++ app-mvhub/t/mech/user/category_search_form_blank.t 2010-09-28 16:02:42 +0000 |
125 | @@ -6,10 +6,6 @@ |
126 | use Test::More; |
127 | use Test::WWW::Mechanize; |
128 | |
129 | -BEGIN { |
130 | - use FindBin qw($Bin); |
131 | - chdir $Bin; |
132 | -} |
133 | use TestHelper; |
134 | |
135 | { #main |
136 | |
137 | === modified file 'app-mvhub/t/mech/user/category_search_form_found_in_all_db.t' |
138 | --- app-mvhub/t/mech/user/category_search_form_found_in_all_db.t 2010-09-13 00:58:44 +0000 |
139 | +++ app-mvhub/t/mech/user/category_search_form_found_in_all_db.t 2010-09-28 16:02:42 +0000 |
140 | @@ -6,10 +6,6 @@ |
141 | use Test::More; |
142 | use Test::WWW::Mechanize; |
143 | |
144 | -BEGIN { |
145 | - use FindBin qw($Bin); |
146 | - chdir $Bin; |
147 | -} |
148 | use TestHelper; |
149 | |
150 | { #main |
151 | |
152 | === modified file 'app-mvhub/t/mech/user/category_search_form_not_found.t' |
153 | --- app-mvhub/t/mech/user/category_search_form_not_found.t 2010-09-13 00:58:44 +0000 |
154 | +++ app-mvhub/t/mech/user/category_search_form_not_found.t 2010-09-28 16:02:42 +0000 |
155 | @@ -6,10 +6,6 @@ |
156 | use Test::More; |
157 | use Test::WWW::Mechanize; |
158 | |
159 | -BEGIN { |
160 | - use FindBin qw($Bin); |
161 | - chdir $Bin; |
162 | -} |
163 | use TestHelper; |
164 | |
165 | { #main |
166 | |
167 | === modified file 'app-mvhub/t/mech/user/contact_having_required.t' |
168 | --- app-mvhub/t/mech/user/contact_having_required.t 2010-09-13 00:58:44 +0000 |
169 | +++ app-mvhub/t/mech/user/contact_having_required.t 2010-09-28 16:02:42 +0000 |
170 | @@ -6,10 +6,6 @@ |
171 | use Test::More; |
172 | use Test::WWW::Mechanize; |
173 | |
174 | -BEGIN { |
175 | - use FindBin qw($Bin); |
176 | - chdir $Bin; |
177 | -} |
178 | use TestHelper; |
179 | |
180 | { #main |
181 | |
182 | === modified file 'app-mvhub/t/mech/user/contact_missing_required.t' |
183 | --- app-mvhub/t/mech/user/contact_missing_required.t 2010-09-13 00:58:44 +0000 |
184 | +++ app-mvhub/t/mech/user/contact_missing_required.t 2010-09-28 16:02:42 +0000 |
185 | @@ -6,10 +6,6 @@ |
186 | use Test::More; |
187 | use Test::WWW::Mechanize; |
188 | |
189 | -BEGIN { |
190 | - use FindBin qw($Bin); |
191 | - chdir $Bin; |
192 | -} |
193 | use TestHelper; |
194 | |
195 | { #main |
196 | |
197 | === modified file 'app-mvhub/t/mech/user/login_with_bad_password.t' |
198 | --- app-mvhub/t/mech/user/login_with_bad_password.t 2010-09-13 00:58:44 +0000 |
199 | +++ app-mvhub/t/mech/user/login_with_bad_password.t 2010-09-28 16:02:42 +0000 |
200 | @@ -6,10 +6,6 @@ |
201 | use Test::More; |
202 | use Test::WWW::Mechanize; |
203 | |
204 | -BEGIN { |
205 | - use FindBin qw($Bin); |
206 | - chdir $Bin; |
207 | -} |
208 | use TestHelper; |
209 | |
210 | { #main |
211 | |
212 | === modified file 'app-mvhub/t/mech/user/stuff_search_contact.t' |
213 | --- app-mvhub/t/mech/user/stuff_search_contact.t 2010-09-13 00:58:44 +0000 |
214 | +++ app-mvhub/t/mech/user/stuff_search_contact.t 2010-09-28 16:02:42 +0000 |
215 | @@ -6,11 +6,6 @@ |
216 | use Test::More; |
217 | use Test::WWW::Mechanize; |
218 | |
219 | -BEGIN { |
220 | - use FindBin qw($Bin); |
221 | - chdir $Bin; |
222 | - use lib qw(../../lib); |
223 | -} |
224 | use TestHelper; |
225 | |
226 | { #main |
227 | |
228 | === modified file 'app-mvhub/t/repo_matches_file_system.t' |
229 | --- app-mvhub/t/repo_matches_file_system.t 2010-09-13 00:58:44 +0000 |
230 | +++ app-mvhub/t/repo_matches_file_system.t 2010-09-28 16:02:42 +0000 |
231 | @@ -4,12 +4,8 @@ |
232 | use warnings; |
233 | |
234 | use Test::More; |
235 | -use File::Basename qw/basename/; |
236 | - |
237 | -BEGIN { |
238 | - use FindBin qw($Bin); |
239 | - chdir $Bin; |
240 | -} |
241 | +use File::Basename; |
242 | +use FindBin; |
243 | |
244 | use TestHelper; |
245 | |
246 | @@ -20,7 +16,7 @@ |
247 | '/etc/postgresql/8.1/main/postgresql.conf' |
248 | ); |
249 | |
250 | -my @hosts = qw/groundhog /; |
251 | +my @hosts = qw/groundhog/; |
252 | |
253 | my $num_tests = scalar keys %installed; |
254 | plan tests => $num_tests; |
255 | @@ -32,8 +28,9 @@ |
256 | if ($run_on_this_host) { |
257 | |
258 | foreach my $file ( keys %installed ) { |
259 | - my $basename = basename $file; |
260 | - my $no_difference = TestHelper::no_difference( "$Bin/../$file", |
261 | + my $basename = File::Basename::basename $file; |
262 | + my $no_difference |
263 | + = TestHelper::no_difference( "$FindBin::Bin/../$file", |
264 | $installed{$file} ); |
265 | is( $no_difference,, 1, |
266 | "installed version of $basename is in version control" ); |
267 | |
268 | === modified file 'app-mvhub/t/required_comments_present.t' |
269 | --- app-mvhub/t/required_comments_present.t 2010-09-13 00:58:44 +0000 |
270 | +++ app-mvhub/t/required_comments_present.t 2010-09-28 16:02:42 +0000 |
271 | @@ -7,11 +7,6 @@ |
272 | use File::Spec; |
273 | use Carp; |
274 | |
275 | -BEGIN { |
276 | - use FindBin qw($Bin); |
277 | - chdir $Bin; |
278 | -} |
279 | - |
280 | use TestHelper; |
281 | |
282 | { #main |
283 | |
284 | === modified file 'app-mvhub/t/sql_lib_sanity.t' |
285 | --- app-mvhub/t/sql_lib_sanity.t 2010-09-13 00:58:44 +0000 |
286 | +++ app-mvhub/t/sql_lib_sanity.t 2010-09-28 16:02:42 +0000 |
287 | @@ -33,11 +33,6 @@ |
288 | $test_placeholders_ref ); |
289 | } #main |
290 | |
291 | -BEGIN { |
292 | - use FindBin qw($Bin); |
293 | - chdir $Bin; |
294 | -} |
295 | - |
296 | sub get_test_placeholders { |
297 | my $agency_id = shift or die 'missing param: agency_id'; |
298 | my $quick_login_id = shift or die 'missing param: quick_login_id'; |
299 | |
300 | === modified file 'lib-mvhub/t/00-setup.t' |
301 | --- lib-mvhub/t/00-setup.t 2010-09-13 00:58:44 +0000 |
302 | +++ lib-mvhub/t/00-setup.t 2010-09-28 16:02:42 +0000 |
303 | @@ -3,11 +3,6 @@ |
304 | use strict; |
305 | use warnings; |
306 | |
307 | -BEGIN { |
308 | - use FindBin qw($Bin); |
309 | - chdir $Bin; |
310 | -} |
311 | - |
312 | use DBI; |
313 | use SQL::Library; |
314 | use Test::More; |
315 | |
316 | === modified file 'lib-mvhub/t/01-load.t' |
317 | --- lib-mvhub/t/01-load.t 2009-12-17 22:04:09 +0000 |
318 | +++ lib-mvhub/t/01-load.t 2010-09-28 16:02:42 +0000 |
319 | @@ -6,11 +6,6 @@ |
320 | use warnings; |
321 | use Test::More; |
322 | |
323 | -BEGIN { |
324 | - use FindBin qw($Bin); |
325 | - chdir $Bin; |
326 | -} |
327 | - |
328 | eval ' use Test::NoWarnings; '; |
329 | plan skip_all => "Test::NoWarnings needed " |
330 | if $@; |
331 | |
332 | === modified file 'lib-mvhub/t/03-run_test_class.t' |
333 | --- lib-mvhub/t/03-run_test_class.t 2009-12-18 04:24:44 +0000 |
334 | +++ lib-mvhub/t/03-run_test_class.t 2010-09-28 16:02:42 +0000 |
335 | @@ -2,11 +2,6 @@ |
336 | |
337 | use strict; |
338 | |
339 | -BEGIN { |
340 | - use FindBin qw($Bin); |
341 | - chdir $Bin; |
342 | -} |
343 | - |
344 | eval { |
345 | require Test::Class; |
346 | require Test::Exception; |
347 | |
348 | === modified file 'lib-mvhub/t/AgencyAccount/new.t' |
349 | --- lib-mvhub/t/AgencyAccount/new.t 2010-09-13 00:58:44 +0000 |
350 | +++ lib-mvhub/t/AgencyAccount/new.t 2010-09-28 16:02:42 +0000 |
351 | @@ -5,14 +5,9 @@ |
352 | use Test::NoWarnings; |
353 | |
354 | # EDIT |
355 | -use Test::More tests => 4; |
356 | +use Test::More tests => 3; |
357 | use CGI; |
358 | - |
359 | -BEGIN { |
360 | - use FindBin qw($Bin); |
361 | - chdir $Bin; |
362 | - use_ok('MVHub::AgencyAccount') or die "couldn't use MVHub::AgencyAccount"; |
363 | -} |
364 | +use MVHub::AgencyAccount; |
365 | |
366 | # return ->run() output instead of sending to stdout |
367 | $ENV{CGI_APP_RETURN_ONLY} = 1; |
368 | @@ -42,7 +37,7 @@ |
369 | can_ok( 'MVHub::AgencyAccount', @methods ); |
370 | |
371 | ### |
372 | -$test_name = 'can create new AgnecyAccount'; |
373 | +$test_name = 'can create new AgencyAccount'; |
374 | ### |
375 | my $object = MVHub::AgencyAccount->new(); |
376 | isa_ok( $object, 'MVHub::AgencyAccount', $test_name ); |
377 | |
378 | === modified file 'lib-mvhub/t/ArgChecker/get_args.t' |
379 | --- lib-mvhub/t/ArgChecker/get_args.t 2010-09-13 00:58:44 +0000 |
380 | +++ lib-mvhub/t/ArgChecker/get_args.t 2010-09-28 16:02:42 +0000 |
381 | @@ -3,23 +3,16 @@ |
382 | use strict; |
383 | use warnings; |
384 | |
385 | -use Test::More tests => 12 + 1; # +1 for NoWarnings |
386 | +use Test::More tests => 11 + 1; # +1 for NoWarnings |
387 | use Test::NoWarnings; |
388 | use Test::Exception; |
389 | - |
390 | -BEGIN { |
391 | - use FindBin qw($Bin); |
392 | - chdir $Bin; |
393 | - |
394 | - use_ok( 'MVHub::ArgChecker', qw/get_args/ ) |
395 | - or die "couldn't use MVHUb::ArgChecker"; |
396 | -} |
397 | +use MVHub::ArgChecker; |
398 | |
399 | my $test_message; |
400 | my $result = 1; |
401 | |
402 | $test_message = "returns all params, even optional ones"; |
403 | -$result = get_args( |
404 | +$result = MVHub::ArgChecker::get_args( |
405 | [ 'filename', '?param_href', '?print', '?doctype', '?options_href' ], |
406 | ( 'filename' => 1, |
407 | 'param_href' => 1, |
408 | @@ -32,36 +25,40 @@ |
409 | |
410 | $test_message = "dies if parameter description is not defined"; |
411 | dies_ok { |
412 | - get_args( undef, () ); |
413 | + MVHub::ArgChecker::get_args( undef, () ); |
414 | }; |
415 | |
416 | $test_message = "dies if parameter description is not an array ref"; |
417 | dies_ok { |
418 | - get_args( "not an array reference", () ); |
419 | + MVHub::ArgChecker::get_args( "not an array reference", () ); |
420 | }; |
421 | |
422 | $test_message = "dies if missing required param and missing optional params"; |
423 | dies_ok { |
424 | - get_args( |
425 | + MVHub::ArgChecker::get_args( |
426 | [ 'filename', '?param_href', '?print', '?doctype', '?options_href' ], |
427 | () |
428 | ); |
429 | }; |
430 | |
431 | $test_message = 'die on missing required parameter'; |
432 | -dies_ok { get_args( [ 'name', 'email', 'address' ], () ) } $test_message; |
433 | +dies_ok { MVHub::ArgChecker::get_args( [ 'name', 'email', 'address' ], () ) } |
434 | +$test_message; |
435 | |
436 | $test_message |
437 | = q/don't die if no required or optional parameters and no parameters passed/; |
438 | -$result = get_args( [], () ); |
439 | +$result = MVHub::ArgChecker::get_args( [], () ); |
440 | is( $result, 0, $test_message ); |
441 | |
442 | $test_message = q/ die if extra parameters are passed/; |
443 | -dies_ok { get_args( [], ( 'name' => 'yash', 'email' => 'yash@thecsl.org' ) ) } |
444 | +dies_ok { |
445 | + MVHub::ArgChecker::get_args( [], |
446 | + ( 'name' => 'yash', 'email' => 'yash@thecsl.org' ) ); |
447 | +} |
448 | $test_message; |
449 | |
450 | $test_message = q/don't die if (3) required parameters are present/; |
451 | -$result = get_args( |
452 | +$result = MVHub::ArgChecker::get_args( |
453 | [ 'name', 'email', 'address' ], |
454 | ( 'name' => 'yash', |
455 | 'email' => 'yash@thecsl.org', |
456 | @@ -72,19 +69,19 @@ |
457 | |
458 | $test_message = "die on unkown arguments or on extra arguments\n"; |
459 | dies_ok { |
460 | - get_args( [ 'name', 'email', 'address' ], |
461 | + MVHub::ArgChecker::get_args( [ 'name', 'email', 'address' ], |
462 | ( 'name' => 1, 'email' => 1, 'address' => 1, 'extra_param' => 1 ) ); |
463 | } |
464 | $test_message; |
465 | |
466 | $test_message = "doesn't die if missing optional params"; |
467 | $result |
468 | - = get_args( |
469 | + = MVHub::ArgChecker::get_args( |
470 | [ 'filename', '?param_href', '?print', '?doctype', '?options_href' ], |
471 | ( 'filename' => '/tmp/tmp.txt' ) ); |
472 | is( $result, 5, $test_message ); |
473 | |
474 | $test_message |
475 | = q/don't die if all parameters are optional and no params passed/; |
476 | -$result = get_args( [ '?email', 'name?' ], () ); |
477 | +$result = MVHub::ArgChecker::get_args( [ '?email', 'name?' ], () ); |
478 | is( $result, 2, $test_message ); |
479 | |
480 | === modified file 'lib-mvhub/t/Common/delimit_field.t' |
481 | --- lib-mvhub/t/Common/delimit_field.t 2010-09-13 00:58:44 +0000 |
482 | +++ lib-mvhub/t/Common/delimit_field.t 2010-09-28 16:02:42 +0000 |
483 | @@ -3,17 +3,11 @@ |
484 | use strict; |
485 | use warnings; |
486 | |
487 | -use Test::More tests => 5 + 1; # +1 for NoWarnings |
488 | +use Test::More tests => 4 + 1; # +1 for NoWarnings |
489 | use Test::NoWarnings; |
490 | use Test::Exception; |
491 | |
492 | -BEGIN { |
493 | - use FindBin qw($Bin); |
494 | - chdir $Bin; |
495 | - |
496 | - use_ok( 'MVHub::Common', qw/delimit_field/ ) |
497 | - or die "couldn't use MVHUb::Common"; |
498 | -} |
499 | +use MVHub::Common; |
500 | |
501 | my $result = 1; |
502 | my %arguments_passed = ( |
503 | @@ -42,6 +36,6 @@ |
504 | my @results = $arguments_passed{$each_arg}{'arg'}; |
505 | my $expected = $arguments_passed{$each_arg}{'expect'}; |
506 | my $test_message = "Fields delimited with " . substr $each_arg, 3; |
507 | - $result = delimit_field(@results); |
508 | + $result = MVHub::Common::delimit_field(@results); |
509 | is( $result, $expected, $test_message ); |
510 | } |
511 | |
512 | === modified file 'lib-mvhub/t/HTMLTemplateUtils/columnize.t' |
513 | --- lib-mvhub/t/HTMLTemplateUtils/columnize.t 2010-09-13 00:58:44 +0000 |
514 | +++ lib-mvhub/t/HTMLTemplateUtils/columnize.t 2010-09-28 16:02:42 +0000 |
515 | @@ -2,15 +2,9 @@ |
516 | |
517 | use strict; |
518 | |
519 | -use Test::More tests => 13; |
520 | +use Test::More tests => 12; |
521 | use CGI; |
522 | - |
523 | -BEGIN { |
524 | - use FindBin qw($Bin); |
525 | - chdir $Bin; |
526 | - use_ok( 'MVHub::HTMLTemplateUtils', qw/columnize / ) |
527 | - or die "couldn't use MVHUb::HTMLTemplateUtils"; |
528 | -} |
529 | +use MVHub::HTMLTemplateUtils; |
530 | |
531 | if (@ARGV) { |
532 | my ( $columns, $ordering ) = @ARGV; |
533 | @@ -29,7 +23,8 @@ |
534 | { id => 11, name => 'K' } |
535 | ]; |
536 | |
537 | - my $after = columnize( $before, $columns, $ordering ); |
538 | + my $after |
539 | + = MVHub::HTMLTemplateUtils::columnize( $before, $columns, $ordering ); |
540 | use Data::Dumper; |
541 | print Dumper($after); |
542 | exit(0); |
543 | @@ -38,9 +33,9 @@ |
544 | # TEST PLAN |
545 | # For both "across" and "down": |
546 | # On a simple data set of 5 items: |
547 | -# 2 middle cases: columns = 2, 3 (also 4 for down) |
548 | -# 3 boundary cases: columns = 1, 5 |
549 | -# 1 case where column number exceeds data size: columns = 10 |
550 | +# 2 middle cases: MVHub::HTMLTemplateUtils::columns = 2, 3 (also 4 for down) |
551 | +# 3 boundary cases: MVHub::HTMLTemplateUtils::columns = 1, 5 |
552 | +# 1 case where MVHub::HTMLTemplateUtils::column number exceeds data size: MVHub::HTMLTemplateUtils::columns = 10 |
553 | # |
554 | # 1 case with a more complex data structure. |
555 | |
556 | @@ -76,7 +71,8 @@ |
557 | }, |
558 | { 'COLUMN_LOOP' => [ { 'name' => 'D' }, { 'name' => 'E' } ] } |
559 | ]; |
560 | -is_deeply( columnize( $loop_ref, 3, "across" ), $across_3 ); |
561 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 3, "across" ), |
562 | + $across_3 ); |
563 | |
564 | my $across_5 = [ |
565 | { 'COLUMN_LOOP' => [ |
566 | @@ -89,11 +85,13 @@ |
567 | } |
568 | ]; |
569 | |
570 | -is_deeply( columnize( $loop_ref, 5, "across" ), $across_5 ); |
571 | -is_deeply( columnize( $loop_ref, 10, "across" ), $across_5 ) |
572 | - ; # same as across 5 |
573 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 5, "across" ), |
574 | + $across_5 ); |
575 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 10, "across" ), |
576 | + $across_5 ); # same as across 5 |
577 | |
578 | -is_deeply( columnize( $loop_ref, 1, "down" ), $across_1 ); #same as across |
579 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 1, "down" ), |
580 | + $across_1 ); #same as across |
581 | |
582 | my $down_2 = [ |
583 | { 'COLUMN_LOOP' => [ { 'name' => 'A' }, { 'name' => 'D' } ] }, |
584 | @@ -101,7 +99,8 @@ |
585 | { 'COLUMN_LOOP' => [ { 'name' => 'C' } ] } |
586 | ]; |
587 | |
588 | -is_deeply( columnize( $loop_ref, 2, "down" ), $down_2 ); |
589 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 2, "down" ), |
590 | + $down_2 ); |
591 | |
592 | my $down_3 = [ |
593 | { 'COLUMN_LOOP' => |
594 | @@ -110,13 +109,17 @@ |
595 | { 'COLUMN_LOOP' => [ { 'name' => 'B' }, { 'name' => 'D' } ] } |
596 | ]; |
597 | |
598 | -is_deeply( columnize( $loop_ref, 3, "down" ), $down_3 ); |
599 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 3, "down" ), |
600 | + $down_3 ); |
601 | |
602 | # For reasons stated in columnize docs, 4 cols and 3 cols will be same: |
603 | -is_deeply( columnize( $loop_ref, 4, "down" ), $down_3 ); |
604 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 4, "down" ), |
605 | + $down_3 ); |
606 | |
607 | -is_deeply( columnize( $loop_ref, 5, "down" ), $across_5 ); #same as across |
608 | -is_deeply( columnize( $loop_ref, 10, "down" ), $across_5 ); #same as across |
609 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 5, "down" ), |
610 | + $across_5 ); #same as across |
611 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $loop_ref, 10, "down" ), |
612 | + $across_5 ); #same as across |
613 | |
614 | my $struct = [ |
615 | { id => 1, name => 'April' }, |
616 | @@ -132,4 +135,5 @@ |
617 | [ { id => 2, name => 'Dan' }, { id => 4, name => 'Kevin' } ] |
618 | } |
619 | ]; |
620 | -is_deeply( columnize( $struct, 2, "down" ), $struct_down_2 ); |
621 | +is_deeply( MVHub::HTMLTemplateUtils::columnize( $struct, 2, "down" ), |
622 | + $struct_down_2 ); |
623 | |
624 | === modified file 'lib-mvhub/t/HTMLTemplateUtils/format_template.t' |
625 | --- lib-mvhub/t/HTMLTemplateUtils/format_template.t 2009-09-15 01:12:17 +0000 |
626 | +++ lib-mvhub/t/HTMLTemplateUtils/format_template.t 2010-09-28 16:02:42 +0000 |
627 | @@ -1,14 +1,8 @@ |
628 | #!/usr/bin/perl -w |
629 | |
630 | use strict; |
631 | -use Test::More tests => 8; |
632 | - |
633 | -BEGIN { |
634 | - use FindBin qw($Bin); |
635 | - chdir $Bin; |
636 | - use_ok( 'MVHub::HTMLTemplateUtils', qw/format_template/ ) |
637 | - or die "couldn't use MVHUb::HTMLTemplateUtils"; |
638 | -} |
639 | +use Test::More tests => 7; |
640 | +use MVHub::HTMLTemplateUtils; |
641 | |
642 | use Test::NoWarnings; |
643 | use IO::Scalar; |
644 | @@ -32,7 +26,7 @@ |
645 | |
646 | $params_href = { variable => "Hello World", }; |
647 | |
648 | -# format_template() can only to some output when printing |
649 | +# MVHub::HTMLTemplateUtils::format_template() can only to some output when printing |
650 | # we have to send it's output to a file (sigh) |
651 | |
652 | $output = ''; |
653 | |
654 | === modified file 'lib-mvhub/t/Notifications/_push_and_return_programs.t' |
655 | --- lib-mvhub/t/Notifications/_push_and_return_programs.t 2010-03-30 21:00:29 +0000 |
656 | +++ lib-mvhub/t/Notifications/_push_and_return_programs.t 2010-09-28 16:02:42 +0000 |
657 | @@ -13,11 +13,6 @@ |
658 | use TestData qw/ @agency /; |
659 | use MVHub::Notifications qw/ _push_and_return_programs /; |
660 | |
661 | -BEGIN { |
662 | - use FindBin qw($Bin); |
663 | - chdir $Bin; |
664 | -} |
665 | - |
666 | my $test_message; |
667 | my @agency_dummy_data = @TestData::agency; |
668 | |
669 | |
670 | === modified file 'lib-mvhub/t/Notifications/create_final_notification_emails_with.t' |
671 | --- lib-mvhub/t/Notifications/create_final_notification_emails_with.t 2010-09-13 00:58:44 +0000 |
672 | +++ lib-mvhub/t/Notifications/create_final_notification_emails_with.t 2010-09-28 16:02:42 +0000 |
673 | @@ -3,11 +3,6 @@ |
674 | use strict; |
675 | use warnings; |
676 | |
677 | -BEGIN { |
678 | - use FindBin qw($Bin); |
679 | - chdir $Bin; |
680 | -} |
681 | - |
682 | use Test::More tests => 5 + 1; # +1 for NoWarnings |
683 | use Test::NoWarnings; |
684 | use Test::Exception; |
685 | |
686 | === modified file 'lib-mvhub/t/Notifications/create_fourth_notification_emails_with.t' |
687 | --- lib-mvhub/t/Notifications/create_fourth_notification_emails_with.t 2010-09-13 00:58:44 +0000 |
688 | +++ lib-mvhub/t/Notifications/create_fourth_notification_emails_with.t 2010-09-28 16:02:42 +0000 |
689 | @@ -3,11 +3,6 @@ |
690 | use strict; |
691 | use warnings; |
692 | |
693 | -BEGIN { |
694 | - use FindBin qw($Bin); |
695 | - chdir $Bin; |
696 | -} |
697 | - |
698 | use Test::More tests => 4 + 1; # +1 for NoWarnings |
699 | use Test::NoWarnings; |
700 | use Test::Exception; |
701 | |
702 | === modified file 'lib-mvhub/t/Notifications/create_notifications_using.t' |
703 | --- lib-mvhub/t/Notifications/create_notifications_using.t 2010-09-13 00:58:44 +0000 |
704 | +++ lib-mvhub/t/Notifications/create_notifications_using.t 2010-09-28 16:02:42 +0000 |
705 | @@ -3,11 +3,6 @@ |
706 | use strict; |
707 | use warnings; |
708 | |
709 | -BEGIN { |
710 | - use FindBin qw($Bin); |
711 | - chdir $Bin; |
712 | -} |
713 | - |
714 | use Test::More tests => 5 + 1; # +1 for NoWarnings |
715 | use Test::NoWarnings; |
716 | use Test::Exception; |
717 | |
718 | === modified file 'lib-mvhub/t/Notifications/create_standard_notification_emails_with.t' |
719 | --- lib-mvhub/t/Notifications/create_standard_notification_emails_with.t 2010-09-13 00:58:44 +0000 |
720 | +++ lib-mvhub/t/Notifications/create_standard_notification_emails_with.t 2010-09-28 16:02:42 +0000 |
721 | @@ -3,11 +3,6 @@ |
722 | use strict; |
723 | use warnings; |
724 | |
725 | -BEGIN { |
726 | - use FindBin qw($Bin); |
727 | - chdir $Bin; |
728 | -} |
729 | - |
730 | use Test::More tests => 3 + 1; # +1 for NoWarnings |
731 | use Test::NoWarnings; |
732 | use Test::Exception; |
733 | |
734 | === modified file 'lib-mvhub/t/Notifications/die_if_record_count_mismatch.t' |
735 | --- lib-mvhub/t/Notifications/die_if_record_count_mismatch.t 2010-09-13 00:58:44 +0000 |
736 | +++ lib-mvhub/t/Notifications/die_if_record_count_mismatch.t 2010-09-28 16:02:42 +0000 |
737 | @@ -3,11 +3,6 @@ |
738 | use strict; |
739 | use warnings; |
740 | |
741 | -BEGIN { |
742 | - use FindBin qw($Bin); |
743 | - chdir $Bin; |
744 | -} |
745 | - |
746 | use Test::More tests => 2 + 1; # +1 for NoWarnings |
747 | use Test::NoWarnings; |
748 | use Test::Exception; |
749 | |
750 | === modified file 'lib-mvhub/t/Notifications/get_email_constants_from.t' |
751 | --- lib-mvhub/t/Notifications/get_email_constants_from.t 2010-09-13 00:58:44 +0000 |
752 | +++ lib-mvhub/t/Notifications/get_email_constants_from.t 2010-09-28 16:02:42 +0000 |
753 | @@ -12,11 +12,6 @@ |
754 | get_email_constants_from |
755 | /; |
756 | |
757 | -BEGIN { |
758 | - use FindBin qw($Bin); |
759 | - chdir $Bin; |
760 | -} |
761 | - |
762 | my $test_message; |
763 | |
764 | ### |
765 | |
766 | === modified file 'lib-mvhub/t/Notifications/get_expired_records.t' |
767 | --- lib-mvhub/t/Notifications/get_expired_records.t 2010-09-13 00:58:44 +0000 |
768 | +++ lib-mvhub/t/Notifications/get_expired_records.t 2010-09-28 16:02:42 +0000 |
769 | @@ -12,10 +12,6 @@ |
770 | use MVHub::Notifications qw/ get_expired_records /; |
771 | use MVHub::Utils::DB qw/ get_dbh /; |
772 | |
773 | -BEGIN { |
774 | - use FindBin qw($Bin); |
775 | - chdir $Bin; |
776 | -} |
777 | my $cfg |
778 | = MVHub::Utils::ConfigSimple::create_config_from( $ENV{MV_CONFIG_FILE} ); |
779 | my $dbh = MVHub::Utils::DB::get_dbh( $ENV{MV_CONFIG_FILE} ); |
780 | |
781 | === modified file 'lib-mvhub/t/Notifications/increment_reminder_levels_for.t' |
782 | --- lib-mvhub/t/Notifications/increment_reminder_levels_for.t 2010-04-01 18:19:48 +0000 |
783 | +++ lib-mvhub/t/Notifications/increment_reminder_levels_for.t 2010-09-28 16:02:42 +0000 |
784 | @@ -11,11 +11,6 @@ |
785 | use MVHub::Notifications qw/ increment_reminder_levels_for /; |
786 | use TestData qw/ notifications_href /; |
787 | |
788 | -BEGIN { |
789 | - use FindBin qw($Bin); |
790 | - chdir $Bin; |
791 | -} |
792 | - |
793 | my $test_message; |
794 | |
795 | ### |
796 | |
797 | === modified file 'lib-mvhub/t/Notifications/print_emails_contained_in.t' |
798 | --- lib-mvhub/t/Notifications/print_emails_contained_in.t 2010-03-30 21:00:29 +0000 |
799 | +++ lib-mvhub/t/Notifications/print_emails_contained_in.t 2010-09-28 16:02:42 +0000 |
800 | @@ -12,11 +12,6 @@ |
801 | |
802 | use MVHub::Notifications qw/ print_emails_contained_in /; |
803 | |
804 | -BEGIN { |
805 | - use FindBin qw($Bin); |
806 | - chdir $Bin; |
807 | -} |
808 | - |
809 | my $CFG |
810 | = MVHub::Utils::ConfigSimple::create_config_from( $ENV{MV_CONFIG_FILE} ); |
811 | |
812 | |
813 | === modified file 'lib-mvhub/t/Notifications/send_emails_contained_in.t' |
814 | --- lib-mvhub/t/Notifications/send_emails_contained_in.t 2010-03-30 21:00:29 +0000 |
815 | +++ lib-mvhub/t/Notifications/send_emails_contained_in.t 2010-09-28 16:02:42 +0000 |
816 | @@ -12,11 +12,6 @@ |
817 | |
818 | use MVHub::Notifications qw/ send_emails_contained_in /; |
819 | |
820 | -BEGIN { |
821 | - use FindBin qw($Bin); |
822 | - chdir $Bin; |
823 | -} |
824 | - |
825 | my $CFG |
826 | = MVHub::Utils::ConfigSimple::create_config_from( $ENV{MV_CONFIG_FILE} ); |
827 | |
828 | |
829 | === modified file 'lib-mvhub/t/Notifications/set_reminder_level_in_db.t' |
830 | --- lib-mvhub/t/Notifications/set_reminder_level_in_db.t 2010-03-31 20:04:36 +0000 |
831 | +++ lib-mvhub/t/Notifications/set_reminder_level_in_db.t 2010-09-28 16:02:42 +0000 |
832 | @@ -17,11 +17,6 @@ |
833 | use TestHelper qw/ add_test_data create_sqlite_db /; |
834 | use TestData qw/ notifications_href /; |
835 | |
836 | -BEGIN { |
837 | - use FindBin qw($Bin); |
838 | - chdir $Bin; |
839 | -} |
840 | - |
841 | my $cfg = MVHub::Utils::ConfigSimple::create_config_from( |
842 | $ENV{MV_TEST_CONFIG_FILE} ); |
843 | my $max_notifications = $cfg->param('NOTIFICATION.max_notifications'); |
844 | |
845 | === modified file 'lib-mvhub/t/Notifications/shift_off_notifications_with_reminder_count.t' |
846 | --- lib-mvhub/t/Notifications/shift_off_notifications_with_reminder_count.t 2010-03-30 21:00:29 +0000 |
847 | +++ lib-mvhub/t/Notifications/shift_off_notifications_with_reminder_count.t 2010-09-28 16:02:42 +0000 |
848 | @@ -13,11 +13,6 @@ |
849 | use TestData qw/ notifications_href /; |
850 | use MVHub::Notifications qw/ shift_off_notifications_with_reminder_count /; |
851 | |
852 | -BEGIN { |
853 | - use FindBin qw($Bin); |
854 | - chdir $Bin; |
855 | -} |
856 | - |
857 | my $test_message; |
858 | |
859 | ### |
860 | |
861 | === modified file 'lib-mvhub/t/Utils/ConfigSimple/_calculate_extra_cfg_params_from.t' |
862 | --- lib-mvhub/t/Utils/ConfigSimple/_calculate_extra_cfg_params_from.t 2010-05-21 14:26:58 +0000 |
863 | +++ lib-mvhub/t/Utils/ConfigSimple/_calculate_extra_cfg_params_from.t 2010-09-28 16:02:42 +0000 |
864 | @@ -10,11 +10,6 @@ |
865 | |
866 | use MVHub::Utils::ConfigSimple qw/ _calculate_extra_cfg_params_from /; |
867 | |
868 | -BEGIN { |
869 | - use FindBin qw($Bin); |
870 | - chdir $Bin; |
871 | -} |
872 | - |
873 | my $cfg = new Config::Simple( syntax => 'ini' ); |
874 | my $test_name; |
875 | |
876 | |
877 | === modified file 'lib-mvhub/t/Utils/DB/get_data_source.t' |
878 | --- lib-mvhub/t/Utils/DB/get_data_source.t 2010-09-13 00:58:44 +0000 |
879 | +++ lib-mvhub/t/Utils/DB/get_data_source.t 2010-09-28 16:02:42 +0000 |
880 | @@ -5,11 +5,6 @@ |
881 | |
882 | use Test::More tests => 5; |
883 | |
884 | -BEGIN { |
885 | - use FindBin qw($Bin); |
886 | - chdir $Bin; |
887 | -} |
888 | - |
889 | use MVHub::Utils::DB qw/get_data_source/; |
890 | use MVHub::Utils::ConfigSimple qw/create_config_from/; |
891 | |
892 | |
893 | === modified file 'lib-mvhub/t/Utils/DB/get_sql_insert_statement.t' |
894 | --- lib-mvhub/t/Utils/DB/get_sql_insert_statement.t 2010-09-13 00:58:44 +0000 |
895 | +++ lib-mvhub/t/Utils/DB/get_sql_insert_statement.t 2010-09-28 16:02:42 +0000 |
896 | @@ -7,11 +7,6 @@ |
897 | use Test::NoWarnings; |
898 | use Test::Exception; |
899 | |
900 | -BEGIN { |
901 | - use FindBin qw($Bin); |
902 | - chdir $Bin; |
903 | -} |
904 | - |
905 | use MVHub::Utils::DB qw/get_sql_insert_statement/; |
906 | |
907 | my $test_message; |
908 | |
909 | === modified file 'lib-mvhub/t/Utils/DB/get_sql_select_statement.t' |
910 | --- lib-mvhub/t/Utils/DB/get_sql_select_statement.t 2010-09-13 00:58:44 +0000 |
911 | +++ lib-mvhub/t/Utils/DB/get_sql_select_statement.t 2010-09-28 16:02:42 +0000 |
912 | @@ -7,11 +7,6 @@ |
913 | use Test::NoWarnings; |
914 | use Test::Exception; |
915 | |
916 | -BEGIN { |
917 | - use FindBin qw($Bin); |
918 | - chdir $Bin; |
919 | -} |
920 | - |
921 | use MVHub::Utils::DB qw/get_sql_select_statement/; |
922 | |
923 | my $test_message; |
924 | |
925 | === modified file 'lib-mvhub/t/Utils/DB/get_sql_update_statement.t' |
926 | --- lib-mvhub/t/Utils/DB/get_sql_update_statement.t 2010-09-13 00:58:44 +0000 |
927 | +++ lib-mvhub/t/Utils/DB/get_sql_update_statement.t 2010-09-28 16:02:42 +0000 |
928 | @@ -7,11 +7,6 @@ |
929 | use Test::NoWarnings; |
930 | use Test::Exception; |
931 | |
932 | -BEGIN { |
933 | - use FindBin qw($Bin); |
934 | - chdir $Bin; |
935 | -} |
936 | - |
937 | use MVHub::Utils::DB qw/get_sql_update_statement/; |
938 | |
939 | my $test_message; |
940 | |
941 | === modified file 'lib-mvhub/t/Utils/assert.t' |
942 | --- lib-mvhub/t/Utils/assert.t 2010-09-13 00:58:44 +0000 |
943 | +++ lib-mvhub/t/Utils/assert.t 2010-09-28 16:02:42 +0000 |
944 | @@ -1,23 +1,18 @@ |
945 | #!/usr/bin/perl -w |
946 | |
947 | use strict; |
948 | -use Test::More tests => 5; |
949 | - |
950 | -BEGIN { |
951 | - use FindBin qw($Bin); |
952 | - chdir $Bin; |
953 | - |
954 | - use_ok( 'MVHub::Utils', qw/ assert / ) or die "couldn't use MVHub::Utils"; |
955 | -} |
956 | - |
957 | -is( assert( 1, 'an assertion message' ), |
958 | +use Test::More tests => 4; |
959 | +use MVHub::Utils; |
960 | + |
961 | +is( MVHub::Utils::assert( 1, 'an assertion message' ), |
962 | undef, "assert doesn't die with true assertion" ); |
963 | -is( assert(1), undef, "assert doesn't die with true assertion (no message)" ); |
964 | +is( MVHub::Utils::assert(1), undef, |
965 | + "assert doesn't die with true assertion (no message)" ); |
966 | |
967 | -eval { assert(0); }; |
968 | +eval { MVHub::Utils::assert(0); }; |
969 | like( $@, qr(Assertion failed), "Assert dies with false assertion" ); |
970 | |
971 | -eval { assert( 0, "an assertion messag" ); }; |
972 | +eval { MVHub::Utils::assert( 0, "an assertion message" ); }; |
973 | like( |
974 | $@, |
975 | qr(Assertion failed), |
976 | |
977 | === modified file 'lib-mvhub/t/Utils/clean_cgi_params.t' |
978 | --- lib-mvhub/t/Utils/clean_cgi_params.t 2009-09-15 01:12:17 +0000 |
979 | +++ lib-mvhub/t/Utils/clean_cgi_params.t 2010-09-28 16:02:42 +0000 |
980 | @@ -1,16 +1,9 @@ |
981 | #!/usr/bin/perl -w |
982 | |
983 | use strict; |
984 | -use Test::More tests => 8; |
985 | +use Test::More tests => 7; |
986 | use CGI; |
987 | - |
988 | -BEGIN { |
989 | - use FindBin qw($Bin); |
990 | - chdir $Bin; |
991 | - |
992 | - use_ok( 'MVHub::Utils', qw/ clean_cgi_params / ) |
993 | - or die "couldn't use Common"; |
994 | -} |
995 | +use MVHub::Utils; |
996 | |
997 | my $q = CGI->new(); |
998 | my $test_name; |
999 | @@ -18,13 +11,13 @@ |
1000 | #### |
1001 | $test_name = "parameterless cgi object ummodified"; |
1002 | #### |
1003 | -is_deeply( $q, clean_cgi_params($q), $test_name ); |
1004 | +is_deeply( $q, MVHub::Utils::clean_cgi_params($q), $test_name ); |
1005 | |
1006 | #### |
1007 | $test_name = "single clean parameter doesn't change"; |
1008 | #### |
1009 | $q->param( clean => "A clean parameter" ); |
1010 | -clean_cgi_params($q); |
1011 | +MVHub::Utils::clean_cgi_params($q); |
1012 | |
1013 | is( $q->param("clean"), "A clean parameter", $test_name ); |
1014 | |
1015 | @@ -33,7 +26,7 @@ |
1016 | #### |
1017 | $q->param( "cleaner" => "clean" ); |
1018 | $q->param( "clean" => "A clean parameter" ); |
1019 | -clean_cgi_params($q); |
1020 | +MVHub::Utils::clean_cgi_params($q); |
1021 | |
1022 | is( $q->param("clean") . $q->param("cleaner"), |
1023 | "A clean parameterclean", $test_name ); |
1024 | @@ -42,14 +35,14 @@ |
1025 | $test_name = "destroys entire param with HTML tags"; |
1026 | #### |
1027 | $q->param( all_html_code => "<script type=\"text/javascript\">" ); |
1028 | -clean_cgi_params($q); |
1029 | +MVHub::Utils::clean_cgi_params($q); |
1030 | is( $q->param("all_html_code"), "", $test_name ); |
1031 | |
1032 | #### |
1033 | $test_name = "removes HTML tags and leaves other text"; |
1034 | #### |
1035 | $q->param( part_html_code => "<p>This is a paragraph</p>" ); |
1036 | -clean_cgi_params($q); |
1037 | +MVHub::Utils::clean_cgi_params($q); |
1038 | |
1039 | is( $q->param("part_html_code"), "This is a paragraph", $test_name ); |
1040 | |
1041 | @@ -57,7 +50,7 @@ |
1042 | $test_name = "multitple clean parameters with same name don't change"; |
1043 | #### |
1044 | $q->param( multi_clean => "clean", "cleaner", "cleanest" ); |
1045 | -clean_cgi_params($q); |
1046 | +MVHub::Utils::clean_cgi_params($q); |
1047 | { |
1048 | my @param = $q->param("multi_clean"); |
1049 | ok( ( ( $param[0] eq "clean" ) |
1050 | @@ -77,7 +70,7 @@ |
1051 | mixed_multi => "clean", |
1052 | "<input>not clean</p>", "sorta", "<br><hr>" |
1053 | ); |
1054 | -&clean_cgi_params($q); |
1055 | +&MVHub::Utils::clean_cgi_params($q); |
1056 | { |
1057 | my @param = $q->param("mixed_multi"); |
1058 | ok( ( ( $param[0] eq "clean" ) |
1059 | |
1060 | === modified file 'lib-mvhub/t/Utils/die_if_missing_env_vars.t' |
1061 | --- lib-mvhub/t/Utils/die_if_missing_env_vars.t 2010-09-13 00:58:44 +0000 |
1062 | +++ lib-mvhub/t/Utils/die_if_missing_env_vars.t 2010-09-28 16:02:42 +0000 |
1063 | @@ -4,17 +4,11 @@ |
1064 | use warnings; |
1065 | |
1066 | # EDIT |
1067 | -use Test::More tests => 5; |
1068 | +use Test::More tests => 4; |
1069 | use Test::NoWarnings; |
1070 | use Test::Warn; |
1071 | - |
1072 | -BEGIN { |
1073 | - use FindBin qw($Bin); |
1074 | - chdir $Bin; |
1075 | - |
1076 | - use_ok( 'MVHub::Utils', qw/die_if_missing_env_vars/ ) |
1077 | - or die "couldn't use MVHUb::Utils"; |
1078 | -} |
1079 | +use MVHub::Utils; |
1080 | + |
1081 | my $test_name; |
1082 | |
1083 | ### |
1084 | @@ -25,7 +19,7 @@ |
1085 | my $placeholder = $ENV{MV_TEST_CONFIG_FILE}; |
1086 | delete $ENV{MV_TEST_CONFIG_FILE}; |
1087 | |
1088 | -eval { die_if_missing_env_vars(); }; |
1089 | +eval { MVHub::Utils::die_if_missing_env_vars(); }; |
1090 | like( $@, qr/MV_TEST_CONFIG_FILE/, $test_name ); |
1091 | |
1092 | # restore ENV |
1093 | @@ -38,7 +32,7 @@ |
1094 | $ENV{MV_TEST_CONFIG_FILE} = 1; |
1095 | $ENV{PERL5LIB} = 1; |
1096 | $ENV{HTML_TEMPLATE_ROOT} = 1; |
1097 | -eval { die_if_missing_env_vars(); }; |
1098 | +eval { MVHub::Utils::die_if_missing_env_vars(); }; |
1099 | is( $@, '', $test_name ); |
1100 | |
1101 | ### |
1102 | @@ -47,4 +41,5 @@ |
1103 | |
1104 | $ENV{MV_TEST_CONFIG_FILE} = 1; |
1105 | $ENV{MV_foo} = 1; |
1106 | -warning_like { die_if_missing_env_vars() } qr/MV_foo/, $test_name; |
1107 | +warning_like { MVHub::Utils::die_if_missing_env_vars() } qr/MV_foo/, |
1108 | + $test_name; |
1109 | |
1110 | === modified file 'lib-mvhub/t/Utils/mm_dd_yyyy_to_yyyy_mm_dd.t' |
1111 | --- lib-mvhub/t/Utils/mm_dd_yyyy_to_yyyy_mm_dd.t 2010-09-13 00:58:44 +0000 |
1112 | +++ lib-mvhub/t/Utils/mm_dd_yyyy_to_yyyy_mm_dd.t 2010-09-28 16:02:42 +0000 |
1113 | @@ -2,19 +2,15 @@ |
1114 | |
1115 | use strict; |
1116 | use warnings; |
1117 | -use Test::More tests => 5; |
1118 | - |
1119 | -BEGIN { |
1120 | - use FindBin qw($Bin); |
1121 | - chdir $Bin; |
1122 | - |
1123 | - use_ok( 'MVHub::Utils', qw/ mm_dd_yyyy_to_yyyy_mm_dd / ) |
1124 | - or die "couldn't use Common"; |
1125 | -} |
1126 | - |
1127 | -eval { mm_dd_yyyy_to_yyyy_mm_dd('asdf'); }; |
1128 | +use Test::More tests => 4; |
1129 | +use MVHub::Utils; |
1130 | + |
1131 | +eval { MVHub::Utils::mm_dd_yyyy_to_yyyy_mm_dd('asdf'); }; |
1132 | ok( $@, 'died on bad date' ); |
1133 | |
1134 | -is( mm_dd_yyyy_to_yyyy_mm_dd(undef), undef, 'date not defined' ); |
1135 | -is( mm_dd_yyyy_to_yyyy_mm_dd('12-31-2003'), '2003-12-31', 'date test 3' ); |
1136 | -is( mm_dd_yyyy_to_yyyy_mm_dd('1-9-2003'), '2003-1-9', 'date test 4' ); |
1137 | +is( MVHub::Utils::mm_dd_yyyy_to_yyyy_mm_dd(undef), undef, |
1138 | + 'date not defined' ); |
1139 | +is( MVHub::Utils::mm_dd_yyyy_to_yyyy_mm_dd('12-31-2003'), |
1140 | + '2003-12-31', 'date test 3' ); |
1141 | +is( MVHub::Utils::mm_dd_yyyy_to_yyyy_mm_dd('1-9-2003'), |
1142 | + '2003-1-9', 'date test 4' ); |
1143 | |
1144 | === modified file 'lib-mvhub/t/Utils/parse_zip_code.t' |
1145 | --- lib-mvhub/t/Utils/parse_zip_code.t 2010-09-13 00:58:44 +0000 |
1146 | +++ lib-mvhub/t/Utils/parse_zip_code.t 2010-09-28 16:02:42 +0000 |
1147 | @@ -1,22 +1,17 @@ |
1148 | #!/usr/bin/perl -w |
1149 | |
1150 | use strict; |
1151 | -use Test::More tests => 10; |
1152 | - |
1153 | -BEGIN { |
1154 | - use FindBin qw($Bin); |
1155 | - chdir $Bin; |
1156 | - |
1157 | - use_ok( 'MVHub::Utils', qw/ parse_zip_code / ) |
1158 | - or die "couldn't use Utils"; |
1159 | -} |
1160 | - |
1161 | -is( parse_zip_code(''), undef, 'in: "" , out: undef' ); |
1162 | -is( parse_zip_code(0), undef, 'in: 0, out: undef' ); |
1163 | -is( parse_zip_code(undef), undef, 'in: undef , out: undef' ); |
1164 | -is( parse_zip_code('0'), undef, "in: '0', out: undef" ); |
1165 | -is( parse_zip_code(55555), 55555, "in 55555, out: 55555" ); |
1166 | -is( parse_zip_code(555551), 55555, "in: 555551, out: 55555" ); |
1167 | -is( parse_zip_code(4), undef, "4 in, undef out" ); |
1168 | -is( parse_zip_code('00000'), '00000', "in: '00000', out: '00000'" ); |
1169 | -is( parse_zip_code('01234'), '01234', "in: '01234', out: '01234'" ); |
1170 | +use Test::More tests => 9; |
1171 | +use MVHub::Utils; |
1172 | + |
1173 | +is( MVHub::Utils::parse_zip_code(''), undef, 'in: "" , out: undef' ); |
1174 | +is( MVHub::Utils::parse_zip_code(0), undef, 'in: 0, out: undef' ); |
1175 | +is( MVHub::Utils::parse_zip_code(undef), undef, 'in: undef , out: undef' ); |
1176 | +is( MVHub::Utils::parse_zip_code('0'), undef, "in: '0', out: undef" ); |
1177 | +is( MVHub::Utils::parse_zip_code(55555), 55555, "in 55555, out: 55555" ); |
1178 | +is( MVHub::Utils::parse_zip_code(555551), 55555, "in: 555551, out: 55555" ); |
1179 | +is( MVHub::Utils::parse_zip_code(4), undef, "4 in, undef out" ); |
1180 | +is( MVHub::Utils::parse_zip_code('00000'), |
1181 | + '00000', "in: '00000', out: '00000'" ); |
1182 | +is( MVHub::Utils::parse_zip_code('01234'), |
1183 | + '01234', "in: '01234', out: '01234'" ); |
1184 | |
1185 | === modified file 'lib-mvhub/t/Utils/trim.t' |
1186 | --- lib-mvhub/t/Utils/trim.t 2010-09-13 00:58:44 +0000 |
1187 | +++ lib-mvhub/t/Utils/trim.t 2010-09-28 16:02:42 +0000 |
1188 | @@ -2,6 +2,7 @@ |
1189 | |
1190 | use strict; |
1191 | use Test::More tests => 7; |
1192 | +use MVHub::Utils; |
1193 | |
1194 | BEGIN { |
1195 | use FindBin qw($Bin); |
1196 | @@ -17,49 +18,49 @@ |
1197 | ###### |
1198 | $in = ' test'; |
1199 | $out = 'test'; |
1200 | -is( trim($in), $out, $test_name ); |
1201 | +is( MVHub::Utils::trim($in), $out, $test_name ); |
1202 | |
1203 | ###### |
1204 | $test_name = 'text with trailing space'; |
1205 | ###### |
1206 | $in = 'test '; |
1207 | $out = 'test'; |
1208 | -is( trim($in), $out, $test_name ); |
1209 | +is( MVHub::Utils::trim($in), $out, $test_name ); |
1210 | |
1211 | ###### |
1212 | $test_name = 'text with leading and trailing spaces'; |
1213 | ###### |
1214 | $in = ' test '; |
1215 | $out = 'test'; |
1216 | -is( trim($in), $out, $test_name ); |
1217 | +is( MVHub::Utils::trim($in), $out, $test_name ); |
1218 | |
1219 | ###### |
1220 | $test_name = 'call trim with no parameters'; |
1221 | ###### |
1222 | $in = ' test '; |
1223 | $out = 'test'; |
1224 | -is( trim(), undef, $test_name ); |
1225 | +is( MVHub::Utils::trim(), undef, $test_name ); |
1226 | |
1227 | ################ array tests ############ |
1228 | |
1229 | my ( @in, @expected_out, @out ); |
1230 | |
1231 | ###### |
1232 | -$test_name = 'call trim in list context with a list'; |
1233 | +$test_name = 'call MVHub::Utils::trim in list context with a list'; |
1234 | ###### |
1235 | @in = ( " a", "b ", " c" ); |
1236 | @expected_out = qw/a b c/; |
1237 | -@out = trim(@in); |
1238 | +@out = MVHub::Utils::trim(@in); |
1239 | is_deeply( \@out, \@expected_out, $test_name ); |
1240 | |
1241 | ###### |
1242 | $test_name |
1243 | - = 'call trim in list context with a list that has an undefined element'; |
1244 | + = 'call MVHub::Utils::trim in list context with a list that has an undefined element'; |
1245 | ###### |
1246 | @in = ( " a", "b ", " c" ); |
1247 | $in[2] = undef; |
1248 | @expected_out = qw/a b/; |
1249 | $expected_out[2] = undef; |
1250 | -@out = trim(@in); |
1251 | +@out = MVHub::Utils::trim(@in); |
1252 | is_deeply( \@out, \@expected_out, $test_name ); |
1253 | |
1254 | |
1255 | === modified file 'lib-mvhub/t/Utils/yyyy_mm_dd_to_mm_dd_yyyy.t' |
1256 | --- lib-mvhub/t/Utils/yyyy_mm_dd_to_mm_dd_yyyy.t 2010-09-13 00:58:44 +0000 |
1257 | +++ lib-mvhub/t/Utils/yyyy_mm_dd_to_mm_dd_yyyy.t 2010-09-28 16:02:42 +0000 |
1258 | @@ -4,19 +4,16 @@ |
1259 | |
1260 | use strict; |
1261 | use warnings; |
1262 | -use Test::More tests => 5; |
1263 | - |
1264 | -BEGIN { |
1265 | - use FindBin qw($Bin); |
1266 | - chdir $Bin; |
1267 | - |
1268 | - use_ok( 'MVHub::Utils', qw/ yyyy_mm_dd_to_mm_dd_yyyy / ) |
1269 | - or die "couldn't use Common"; |
1270 | -} |
1271 | -eval { yyyy_mm_dd_to_mm_dd_yyyy('asdf'); }; |
1272 | +use Test::More tests => 4; |
1273 | +use MVHub::Utils; |
1274 | + |
1275 | +eval { MVHub::Utils::yyyy_mm_dd_to_mm_dd_yyyy('asdf'); }; |
1276 | ok( $@, 'died on bad date' ); |
1277 | |
1278 | -is( yyyy_mm_dd_to_mm_dd_yyyy(undef), undef, 'date not defined' ); |
1279 | +is( MVHub::Utils::yyyy_mm_dd_to_mm_dd_yyyy(undef), undef, |
1280 | + 'date not defined' ); |
1281 | |
1282 | -is( yyyy_mm_dd_to_mm_dd_yyyy('2003-12-31'), '12-31-2003', 'date test 1' ); |
1283 | -is( yyyy_mm_dd_to_mm_dd_yyyy('2003-1-9'), '1-9-2003', 'date test 2' ); |
1284 | +is( MVHub::Utils::yyyy_mm_dd_to_mm_dd_yyyy('2003-12-31'), |
1285 | + '12-31-2003', 'date test 1' ); |
1286 | +is( MVHub::Utils::yyyy_mm_dd_to_mm_dd_yyyy('2003-1-9'), |
1287 | + '1-9-2003', 'date test 2' ); |
1288 | |
1289 | === modified file 'lib-mvhub/t/pod_valid.t' |
1290 | --- lib-mvhub/t/pod_valid.t 2010-09-13 00:58:44 +0000 |
1291 | +++ lib-mvhub/t/pod_valid.t 2010-09-28 16:02:42 +0000 |
1292 | @@ -3,11 +3,6 @@ |
1293 | use warnings; |
1294 | use strict; |
1295 | |
1296 | -BEGIN { |
1297 | - use FindBin qw($Bin); |
1298 | - chdir $Bin; |
1299 | -} #BEGIN |
1300 | - |
1301 | use Test::More; |
1302 | eval "use Test::Pod 1.00"; |
1303 | plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; |
385 -use Test::More tests => 12 + 1; # +1 for NoWarnings
386 +use Test::More tests => 12; # +1 for NoWarnings
Better:
385 -use Test::More tests => 12 + 1; # +1 for NoWarnings
386 +use Test::More tests => 11 +1 ; # +1 for NoWarnings
see:
man Test::NoWarnings;