update RouterPasswords inline documentation & readme

master
Dylan Lloyd 2013-06-24 16:57:06 -04:00
parent a2d2cd6c63
commit ee5ad5e742
2 changed files with 41 additions and 16 deletions

View File

@ -15,11 +15,13 @@ Every goodie includes a test file in the `t` directory. For example, the **Route
use strict;
use warnings;
# These modules are necessary for the functions we'll be running.
use Test::More;
use DDG::Test::Goodie;
# These zci attributes aren't necessary, but if you specify them inside your goodie,
# you'll need to add matching values here to check against.
# These zci attributes aren't necessary, but if you specify them inside your
# goodie, you'll need to add matching values here to check against.
zci answer_type => 'password';
zci is_cached => 1;
@ -28,23 +30,30 @@ ddg_goodie_test(
# This is the name of the goodie that will be loaded to test.
'DDG::Goodie::RouterPasswords'
],
# This is a sample query, just like the user will enter into the DuckDuckGo search box
# This is a sample query, just like the user will enter into the DuckDuckGo
# search box.
'Belkin f5d6130' =>
test_zci(
# The first argument to test_zci is the plain text (default) returned from a goodie.
# If your goodie also returns an HTML version, you can pass that along explicitly as
# the second argument. If your goodie is random, you can use regexs instead of
# The first argument to test_zci is the plain text (default)
# returned from a goodie. If your goodie also returns an HTML
# version, you can pass that along explicitly as the second
# argument. If your goodie is random, you can use regexs instead of
# strings to match against.
'Default login for the BELKIN F5D6130: Username: (none) Password: password',
html => 'Default login for the BELKIN F5D6130:<br><i>Username</i>: (none)<br><i>Password</i>: password'
),
# You should include more test cases here. Try to think of ways that your plugin
# might break, and add them here to ensure they won't.
# You should include more test cases here. Try to think of ways that your
# plugin might break, and add them here to ensure they won't. Here are a
# few others that were thought of for this goodie.
);
# This function call is expected by Test::More. It makes sure the program
# doesn't exit before all the tests are run.
done_testing;
```
### Spice
Once you've written a test file, you can test it on it's own with `perl -Ilib t/GoodieName.t`.
## Advanced Goodies

View File

@ -2,22 +2,36 @@
use strict;
use warnings;
# These modules are necessary for the functions we'll be running.
use Test::More;
use DDG::Test::Goodie;
# These zci attributes aren't necessary, but if you specify them inside your
# goodie, you'll need to add matching values here to check against.
zci answer_type => 'password';
zci is_cached => 1;
ddg_goodie_test(
[qw(
DDG::Goodie::RouterPasswords
)],
[
# This is the name of the goodie that will be loaded to test.
'DDG::Goodie::RouterPasswords'
],
# This is a sample query, just like the user will enter into the DuckDuckGo
# search box.
'Belkin f5d6130' =>
test_zci('Default login for the BELKIN F5D6130: Username: (none) Password: password',
html => 'Default login for the BELKIN F5D6130:<br><i>Username</i>: (none)<br><i>Password</i>: password'),
'Belkin f5d6130 default password' =>
test_zci('Default login for the BELKIN F5D6130: Username: (none) Password: password',
html => 'Default login for the BELKIN F5D6130:<br><i>Username</i>: (none)<br><i>Password</i>: password'),
test_zci(
# The first argument to test_zci is the plain text (default)
# returned from a goodie. If your goodie also returns an HTML
# version, you can pass that along explicitly as the second
# argument. If your goodie is random, you can use regexs instead of
# strings to match against.
'Default login for the BELKIN F5D6130: Username: (none) Password: password',
html => 'Default login for the BELKIN F5D6130:<br><i>Username</i>: (none)<br><i>Password</i>: password'
),
# You should include more test cases here. Try to think of ways that your
# plugin might break, and add them here to ensure they won't. Here are a
# few others that were thought of for this goodie.
'Belkin f5d6130 password default' =>
test_zci('Default login for the BELKIN F5D6130: Username: (none) Password: password',
html => 'Default login for the BELKIN F5D6130:<br><i>Username</i>: (none)<br><i>Password</i>: password'),
@ -35,4 +49,6 @@ ddg_goodie_test(
html => 'Default login for the BELKIN F5D6130:<br><i>Username</i>: (none)<br><i>Password</i>: password'),
);
# This function call is expected by Test::More. It makes sure the program
# doesn't exit before all the tests have been run.
done_testing;