作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在试用 Pharo 的 Phexample我喜欢它,但是我的一半单元测试在 SUnit 中,另一半在 Phexample 中,感觉很笨拙。 Phexample 是否有我现有测试的导入功能?
最佳答案
关于期望匹配器,在 PhexMatcher
的类端有一系列重写规则。 .此截屏视频解释了如何使用 RB 的重写引擎:Code Critics in OB (OB Screencast 3) .
首先使用这些规则
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.
SystemBrowser default: OBSystemBrowserAdaptor.
Gofer new
wiresong: 'ob';
addPackage: 'OB-Refactory';
revert
关于unit-testing - 从 SUnit 迁移到 Phexample,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1769778/
我正在试用 Pharo 的 Phexample我喜欢它,但是我的一半单元测试在 SUnit 中,另一半在 Phexample 中,感觉很笨拙。 Phexample 是否有我现有测试的导入功能? 最佳答
我是一名优秀的程序员,十分优秀!