[jifty-devel] I'm designing a DSL for jifty's web testing...

Eric Wilhelm scratchcomputing at gmail.com
Thu Jan 18 03:12:52 EST 2007


# from Nelson Elhage
# on Wednesday 17 January 2007 09:29 pm:

>>        check { content =~ qr{fsck.com} };
>>        check: content =~ qr{fsck.com};
>>        check( content =~ qr{fsck.com} );
>
>        Same thoughts as the first one. I guess I kinda like the curly
>        braces and =~ version; It feels like it says what it means,
> but is tight enough I won't mind typing it a hundred times (because
> for any reasonable app, you probably will be.)

I'm not sure how to pull it off, but:

  qr{fsck.com} in content;

Though possibly

  checks(
    qr{fsck.com},
    qr{foo},
    qr{bar},
  )->in(content);

Hmm, if content is sufficiently overloaded:

  qr{fsck.com} . content;
  # or
  content . qr{fsck.com};

Just use the concatenation operator to run the test (of course, then you 
need a special ->to_string method (and, of course warnings.))  But, 
hey!  We don't need to do bitwise math with that string, right?

  content <<= qr{fsck.com};

I suppose you could use the comparison operators, but again, you would 
have to turn off the 'useless' warnings, so as sick as it sounds, 
assignment seems to be the best bet.  Too bad you can't overload the =~ 
(or can you?)

--Eric
-- 
Peer's Law: The solution to the problem changes the problem.
---------------------------------------------------
    http://scratchcomputing.com
---------------------------------------------------


More information about the jifty-devel mailing list