duckduckgo/duckduckgo — pull request #59 by kablamo (2014-01-29 13:50:47+00:00)
Title: Require tests for all example queries for any instant answer.

I noticed there are some example queries at https://duckduckgo.com/goodies which don't work. This is an idea for catching these problems earlier. It needs some work, but I wanted to see if people like the idea before I spend very much time on it.

This pull request automatically adds an extra test to anything that uses ddg_spice_test() or ddg_goodie_test(). The extra test checks to see if the example queries have been tested.

Here is an example of the new test in action:

~/code/duckduckhack/duckduckgo ⚡ prove t/require_example_queries/goodie.t
t/require_example_queries/goodie.t ..
ok 1 - Testing query first trigger a
not ok 2 - Tests for example queries exist
#
# Tests for the following queries are missing:
# second trigger b
# second trigger c
# first trigger d
1..2

# Failed test 'Tests for example queries exist'
# at /home/eric/code/duckduckhack/duckduckgo/lib/DDG/Test/Block.pm line 93.
# Looks like you failed 1 test of 2.
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/2 subtests

Test Summary Report
-------------------
t/require_example_queries/goodie.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 2
Non-zero exit status: 1
Files=1, Tests=2, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.16 cusr 0.04 csys = 0.22 CPU)
Result: FAIL

Before such a change is merged in, someone (probably me I guess) would need to fix any tests which currently fail to meet this new requirement.