Open
Description
Here is a script I did yesterday that is cool IMO:
r := RBParseTreeRewriter new.
r replace: '`@receiver isEmpty should beTrue' with: 'self assertEmpty: `@receiver'.
r replace: '`@receiver should beTrue' with: 'self assert: `@receiver'.
r replace: '`@receiver isEmpty should beFalse' with: 'self denyEmpty: `@receiver'.
r replace: '`@receiver should beFalse' with: 'self deny: `@receiver'.
r replace: '`@receiver should = `@statement1' with: 'self assert: `@receiver equals: `@statement1'.
r replace: '`@receiver should not = `@statement1' with: 'self deny: `@receiver equals: `@statement1'.
r replace: '`@receiver should include: `@statement1' with: 'self assert: (`@receiver includes: `@statement1)'.
r replace: '`@receiver should not include: `@statement1' with: 'self deny: (`@receiver includes: `@statement1)'.
r replace: '`@receiver should equal: `@statement1' with: 'self assert: `@receiver equals: `@statement1'.
r replace: '`@receiver should beKindOf: `@statement1' with: 'self assert: (`@receiver isKindOf: `@statement1)'.
r replace: '`@receiver should beginWith: `@statement1' with: 'self assert: (`@receiver beginsWith: `@statement1)'.
r replace: '`@receiver should > `@statement1' with: 'self assert: (`@receiver > `@statement1)'.
r replace: '`@receiver should not raise: `@statement1' with: 'self shouldnt: `@receiver raise: `@statement1'.
'Fame-Tests-Core' asPackage definedClasses select: [ :e | e inheritsFrom: TestCase ] thenDo: [ :class |
class methods select: [ :m | m selector beginsWith: 'test' ] thenDo: [ :m |
n := m parseTree.
r executeTree: n.
class compile: n formattedCode.
]
]