🕷 zenspider.com

by ryan davis



sitemap
Looking for the Ruby Quickref?

deny, refute, debunk

Published 2008-04-27 @ 23:11

Tagged ruby, thoughts

I’ve been working a lot on miniunit (still needs a new name) and have been playing with words lately. should has been replaced with must, and should_not (lame!) has been replaced with wont. Wish I could have an apostrophe in there.

For a while Eric and I have added a method to our assertion suite:

1
2
3
def deny exp
  assert ! exp
end

It is a really handy way to describe things. I dislike the look and sound of assert ! blah so we go with deny… but one thing bugs me:

1
2
3
4
def test_something
  assert 42 == 6 * 7
  deny 42 == 6 * 9    # does not line up
end

Yeah yeah… I’m OCD or something. I would much rather read:

1
2
3
4
def test_something_better
  assert 42 == 6 * 7
  refute 42 == 6 * 9
end

I was digging through Apple’s wonderful dictionary and thesaurus and came up with another possibility: debunk… how much better or worse is this?

1
2
3
4
def test_something_better
  assert 42 == 6 * 7
  debunk 42 == 6 * 9
end

Hell… let’s get rid of assert and go with prove and rebut! I’ve just saved you all an extra key per test! OH! show! Now that’s a lot more assertive (pun intended) than assert is. That means I could come back full circle to deny.

That reminds me… I’ve LONG wanted a list of same-length opposite verbs and adjectives. Google turns up nothing… I’m wondering if I can’t somehow generate it with GED’s linguistics library.