Examples by example
An “example" (or example method ) is a unary method that produces an example object . Examples serve as test methods and can contain assertions. As different from tests, they return objects and can be composed of other examples.
An example method can reside in any class is annotated with a <gtExample> pragma. For example, BrTextEditorSelecterExamples>>#select_moveOneRight_at_6
defines an example method that produces a text editor, moves a cursor, simulates a selection, and eventually asserts that it answers the selection.
An example can be based on one or more other examples. In the case above, the example relies on another example from BrTextEditorOperatorExamples>>#editorOnMultilineText
. It does that by calling self editorOnMultilineText.
Assertions are expressed with messages like assert:, or assert:equals:.