Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Have some Elisp code.

    (defun toggle-test-plan ()
      (interactive)
      (let ((new-pos))
        (save-excursion
          (goto-char (point-min))
          (cond ((re-search-forward "More[ \t]+tests[ \t]*=>[ \t]*" nil t)
             (replace-match "More 'no_plan'; # tests => " t t))
            ((re-search-forward "More[ \t]+'no_plan';[ \t]*#[ \t]*" nil t)
             (replace-match "More " t t)
         

    • Argh. Tabs ruined my indentation.

      (defun toggle-test-plan ()
        (interactive)
        (let ((new-pos))
          (save-excursion
            (goto-char (point-min))
            (cond ((re-search-forward "More[ \t]+tests[ \t]*=>[ \t]*" nil t)
                   (replace-match "More 'no_plan'; # tests => " t t))
                  ((re-search-forward "More[ \t]+'no_plan';[ \t]*#[ \t]*" nil t)
                 

      • Hey, that looks awesome (no surprise that someone interested in Prolog would have Lisp skills, I suppose).

        I've been thinking about creating several vim tools specifically dedicated to making tests easier to write and maintain. Would you be interested in converting them to eLisp?

        • Sure, that's fine. What were you going to create? The only thing I really want to do is get *smart* autocompletion of identifiers. Right now all I have Emacs doing is noticing that fun\t might be short for things like function_name, function_fqfname, function_ref, etc. That is, anything \w+-like that it already has open somewhere. That's often good enough especially since I don't ever really write out whole variable names anymore but it'd be even nicer if it knew something about methods.

          So what helpers do y
          • There are a few features I'm thinking about.

            1. ,tp Toggle plan
            2. ,tt Run test (even with Test::Class)
            3. ,tm Run Test::Class test method (requires a planned but unimplemented feature of Test::Class)
            4. ,gt and ,gm, "goto test" and "goto module", respectively.
            5. Other things I think up as I go along (I have vauge ideas)

            Obviously I have 1 and 2 working. Number 3 requires a planned feature for Test::Class that lets you run a single test method. I've submitted a patch, but it wasn't as clean as Adrian

            • Ooh, and along with the regular documentation, it would be nice to include something like Ian Langworth's testing quick reference card [langworth.com] information. I'm unsure of the syntax, but if someone new to testing wants a quick refresher of how to use Test::More, they could type something like:

              :quickref Test::More

              And get short output like what's on the card. Still, I don't like that syntax.