forked from masak/proto
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Added tests for site tips
- Loading branch information
1 parent
ad03cd7
commit 4639c48
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # This is a comment and should be ignored, as are blank lines | ||
|
|
||
| Tip 1 | ||
| Tip 2 | ||
|
|
||
|
|
||
|
|
||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!perl | ||
|
|
||
| use strict; | ||
| use warnings FATAL => 'all'; | ||
|
|
||
| use Test::Most; | ||
| use t::Helper; | ||
|
|
||
| use constant MODEL => 'ModulesPerl6::Model::SiteTips'; | ||
| use constant TEST_TIP_FILE => 't/01-models/03-site-tips-TEST-TIPS.txt'; | ||
|
|
||
| -r TEST_TIP_FILE | ||
| or BAIL_OUT 'Could not find test tip file at ' . TEST_TIP_FILE; | ||
|
|
||
| use_ok MODEL; | ||
| my $m = MODEL->new( tip_file => TEST_TIP_FILE ); | ||
| isa_ok $m => MODEL; | ||
| can_ok $m => qw/tip tip_file/; | ||
|
|
||
| is $m->tip_file, TEST_TIP_FILE, '->tip_file gives correct results'; | ||
|
|
||
| my $is_wrong = 0; | ||
| diag 'Fetching tips many times...'; | ||
| $m->tip =~ /^Tip \d\z/ or $is_wrong = 1 for 1 .. 2_000_000; | ||
| is $is_wrong, 0, '... all fetches were correct'; | ||
|
|
||
| done_testing; |