A simple behaviour driven development (BDD) framework for testing Io code. Inspired by Ruby's RSpec.
Name Last modified Size Description
Parent Directory -
ContextScope.io 10-Jul-2006 21:58 1.7K
WordyBuilder.io 10-Jul-2006 21:58 3.7K
examples/ 05-Aug-2006 18:02 -
iospec.io 10-Jul-2006 21:58 5.1K
junk/ 02-Aug-2006 21:42 -
doFile("iospec.io")
context("A list of values",
setup(
x := list(1,2,3,4)
)
specify("should equal another list containing the same values",
x should equal(list(1,2,3,4))
)
)
context("An empty stack",
setup(
stack := Stack clone
)
specify("should accept an item when sent push",
should not raise
stack push(Object clone)
# or
try(
stack push(Object clone)
) should not raise
)
specify("should complain when sent top",
should raise(StackUnderflowError)
stack top
)
specify("should complain when sent pop",
should raise(StackUnderflowError)
stack pop
)
)
context("A stack with one item",
setup(
stack := Stack clone
stack push(3)
)
specify("should accept an item when sent push",
should not raise
stack push(Object clone)
)
specify("should return top when sent top",
stack top should be(3)
)
specify("should not remove top when sent top",
stack top should be(3)
stack top should be(3)
)
specify("should return top when sent pop",
stack pop should be(3)
)
specify("should remove top when sent pop",
stack pop should be(3)
try(stack pop) should raise(StackUnderflowError)
)
)
context("An almost full stack (with one item less than capacity)",
setup(
stack := Stack clone
for(i, 1, 9, stack push(i))
)
specify("should accept an item when sent push",
stack push(Object clone)
)
specify("should return top when sent top",
stack top should be(9)
)
specify("should not remove top when sent top",
stack top should be(9)
stack top should be(9)
)
specify("should return top when sent pop",
stack pop should be(9)
)
specify("should remove top when sent pop",
stack pop should be(9)
stack pop should be(8)
)
)
context("A full stack",
setup(
stack := Stack clone
for(i, 1, 10, stack push(i))
)
specify("should complain on push",
should raise(StackOverflowError)
stack push(Object clone)
)
specify("should return top when sent top",
stack top should be(10)
)
specify("should not remove top when sent top",
stack top should be(10)
stack top should be(10)
)
specify("should return top when sent pop",
stack pop should be(10)
)
specify("should remove top when sent pop",
stack pop should be(10)
stack pop should be(9)
)
)