Skip to content

Commit

Permalink
[dice] Add example tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ari-koivula committed Aug 7, 2013
1 parent 4e3e439 commit f9540aa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dice.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
@willie.module.commands("dice")
@willie.module.commands("d")
@willie.module.priority("medium")
@willie.module.example(".roll 3d1+1", 'You roll 3d1+1: (1+1+1)+1 = 4')
@willie.module.example(".roll 3d1v2+1", 'You roll 3d1v2+1: (1[+1+1])+1 = 2')
@willie.module.example(".roll 2d4", re='You roll 2d4: \(\d\+\d\) = \d')
def dice(bot, trigger):
"""
.dice <formula> - Rolls dice using the XdY format, also does basic math and
Expand Down Expand Up @@ -108,3 +111,8 @@ def choose(bot, trigger):
choices = re.split('[\|\\\\\/]', trigger.group(2))
pick = choice(choices)
return bot.reply('Your options: %s. My choice: %s' % (', '.join(choices), pick))


if __name__ == "__main__":
from willie.test_tools import run_example_tests
run_example_tests(__file__)

0 comments on commit f9540aa

Please sign in to comment.