All entries for Tuesday 18 April 2006

April 18, 2006

BooSpec!

Follow-up to Behavior Driven Development: BooSpec from codeMonkey.Weblog();

Wooo! I thought it couldn't be done, but Boo's syntactic macros (given an afternoon of hacking!) allow me to do this:
import BooSpec

context TestContext:
data as string

setup:
data = "hello"

specify Print:
print data

#----------------------
e = TestContext()
e.SetUp()
e.Print()
Yup, that's right! The "context" macro is creating a new class. The setup and specify macros create methods. Basically what this means is soon we'll be able to write object behaviour specifications without all that nasty non-spec syntax getting in the way.
Compare:
[Context]
class EmptyStack:
[Specify]
def CountIsZero():
...etc
with simply:
context "Empty Stack"
specify "Count is zero":
...etc
I must say a huge thank you to the guys over on the BooLang group. Without their advice and examples I'd never have gotten here!

Google Ads

Search this blog

Most recent comments

  • I scratched my eye while i was holding some kind of plastic packaging.. Anyways the corner of the pl… by Ercan on this entry
  • About a year ago my contacts that i was wearing, i guess were fautly, because shortly after they wer… by Jon on this entry
  • I got shower gel in my eye 4 and a half days ago, and becasue i rubbed my eyes a lot, i have scratch… by Chris on this entry
  • This website may help http://www.webmd.com/eye–health/tc/Eye–Injuries–Home–Treatment by S on this entry
  • I somehow got dirt, or debris in my eye. The terrible pain sent me in a tailspin. I was afraid of sa… by Bobbi on this entry

Tags

April 2006

Mo Tu We Th Fr Sa Su
Mar |  Today  | May
               1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Galleries

Blog archive

Loading…
Not signed in
Sign in

Powered by BlogBuilder
© MMXX