   # QuickCheck-inspired randomized test cases.
   _.times 100, ->
     criteria_expected = random_criteria()
-    ask = show_criteria criteria_expected
-    criteria_parsed = parse_criteria ask
+    message = criteria_to_message criteria_expected
+    criteria_parsed = parse_criteria message
     unless _.isEqual criteria_expected, criteria_parsed
       console.log "Counterexample: \"#{ask}\"\n\tExpected: #{pp criteria_expected}\n\tGot:      #{pp criteria_parsed}" 
 

  { me, limit, assignee, label, repo, query } = criteria
  if assignee?
    issues = _.filter issues, (i) -> i.assignee? and i.assignee.login is assignee
  if issue_label?
    issues = _.filter issues, (i) -> _.any(i.labels, (l) -> l.name is issue_label)
  if query?
    issues = _.filter issues, (i) ->
              _.any [i.body, i.title], (text) -> _s.include text.toLowerCase(), query
  if limit?
    issues = _.first issues, parseInt limit
  issues


# Given the text sent to robot.respond (e.g. 'hubot show me...'), parse the
# criteria used for filtering issues.
parse_criteria = (message) ->
  [me, limit, assignee, label, repo, query] = message.match(ASK_REGEX)[1..]
  me: me,
  limit: parseInt limit.replace(" of", "") if limit?,
  assignee: assignee.replace("'s", "") if assignee?,
