Unit testing 从SUnit迁移到Phexample

Unit testing 从SUnit迁移到Phexample,unit-testing,smalltalk,pharo,Unit Testing,Smalltalk,Pharo,我正在尝试Pharo的,我喜欢它,但让我的一半单元测试在SUnit中,另一半在Phexample中,感觉很笨拙。Phexample是否为我现有的测试提供了导入功能?关于期望匹配器,PhexMatcher的类端有一系列重写规则。此屏幕广播解释如何使用RB的重写引擎: 首先使用这些规则 RBParseTreeRewriter new replace: 'self assert: [ `@expression ]' with: 'self assert: `@expression';

我正在尝试Pharo的,我喜欢它,但让我的一半单元测试在SUnit中,另一半在Phexample中,感觉很笨拙。Phexample是否为我现有的测试提供了导入功能?

关于期望匹配器,PhexMatcher的类端有一系列重写规则。此屏幕广播解释如何使用RB的重写引擎:

首先使用这些规则

RBParseTreeRewriter new
    replace: 'self assert: [ `@expression ]' with: 'self assert: `@expression';
    replace: 'self deny: `@expression' with: 'self assert: `@expression not';
    yourself.
RBParseTreeRewriter new
    replace: 'self assert: `@value = `@expected' with: '`@value should = `@expected';
    replace: 'self assert: `@value ~= `@expected' with: '`@value should not = `@expected';
    replace: 'self assert: `@value > `@expected' with: '`@value should > `@expected';
    replace: 'self assert: `@value < `@expected' with: '`@value should < `@expected';
    replace: 'self assert: `@value >= `@expected' with: '`@value should >= `@expected';
    replace: 'self assert: `@value <= `@expected' with: '`@value should <= `@expected';
    replace: 'self assert: (`@value isKindOf: `@type)' with: '`@value should beKindOf: `@type';
    replace: 'self assert: `@expression isNil' with: '`@expression should be isNil';
    replace: 'self assert: `@expression notNil' with: '`@expression should be notNil';
    replace: 'self assert: `@expression `test not' with: '`@expression should not be `test'
        when: [:node | node arguments first receiver selector matchesRegex: '(is|has|not).+|atEnd' ];
    replace: 'self assert: `@expression `test' with: '`@expression should be `test'
        when: [:node | node arguments first selector matchesRegex: '(is|has|not).+|atEnd' ];
    replace: 'self assert: (`@collection includes: `@element) not' with: '`@collection should not be includes: `@element';
    replace: 'self assert: (`@collection includes: `@element)' with: '`@collection should be includes: `@element';
    yourself.
然后使用这些规则

RBParseTreeRewriter new
    replace: 'self assert: [ `@expression ]' with: 'self assert: `@expression';
    replace: 'self deny: `@expression' with: 'self assert: `@expression not';
    yourself.
RBParseTreeRewriter new
    replace: 'self assert: `@value = `@expected' with: '`@value should = `@expected';
    replace: 'self assert: `@value ~= `@expected' with: '`@value should not = `@expected';
    replace: 'self assert: `@value > `@expected' with: '`@value should > `@expected';
    replace: 'self assert: `@value < `@expected' with: '`@value should < `@expected';
    replace: 'self assert: `@value >= `@expected' with: '`@value should >= `@expected';
    replace: 'self assert: `@value <= `@expected' with: '`@value should <= `@expected';
    replace: 'self assert: (`@value isKindOf: `@type)' with: '`@value should beKindOf: `@type';
    replace: 'self assert: `@expression isNil' with: '`@expression should be isNil';
    replace: 'self assert: `@expression notNil' with: '`@expression should be notNil';
    replace: 'self assert: `@expression `test not' with: '`@expression should not be `test'
        when: [:node | node arguments first receiver selector matchesRegex: '(is|has|not).+|atEnd' ];
    replace: 'self assert: `@expression `test' with: '`@expression should be `test'
        when: [:node | node arguments first selector matchesRegex: '(is|has|not).+|atEnd' ];
    replace: 'self assert: (`@collection includes: `@element) not' with: '`@collection should not be includes: `@element';
    replace: 'self assert: (`@collection includes: `@element)' with: '`@collection should be includes: `@element';
    yourself.

太酷了!我希望所有库都提供重写规则:)