The Inbox: KernelTests-ct.390.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: KernelTests-ct.390.mcz

commits-2
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-ct.390.mcz

==================== Summary ====================

Name: KernelTests-ct.390
Author: ct
Time: 13 November 2020, 7:32:56.168415 pm
UUID: e3e74615-91ed-8942-be3a-3846b53f7b75
Ancestors: KernelTests-ct.389

Complements Kernel-ct.1365 (BlockClosure >> #generateExpressionWithArguments:).

=============== Diff against KernelTests-ct.389 ===============

Item was added:
+ ----- Method: BlockClosureTest>>assertSource:equals: (in category 'assertions') -----
+ assertSource: expected equals: actual
+
+ ^ self
+ assert: (Compiler new compileNoPattern: expected in: self class notifying: nil ifFail: nil) printString
+ equals: (Compiler new compileNoPattern: actual in: self class notifying: nil ifFail: nil) printString!

Item was added:
+ ----- Method: BlockClosureTest>>testGenerateExpression (in category 'tests - printing') -----
+ testGenerateExpression
+ <resumable>
+
+ "Functional style with literals"
+ self assertSource: '6 * 7' equals: [6 * 7] generateExpression.
+ self assertSource: 'true == false ~= nil' equals: [true == false ~= nil] generateExpression.
+
+ "Argument names"
+ self assertSource: 'foo + 1' equals:
+ ([:x | x + 1] generateExpressionWithArguments: #('foo')).
+ self assertSource: '(foo * bar) yourself - bar' equals:
+ ([:x :y | (x * y) yourself - y] generateExpressionWithArguments: #('foo' 'bar')).
+
+ "Temporaries"
+ self assertSource: '| y | y := z negated. y == z' equals:
+ ([:x | | y | y := x negated. y == x] generateExpressionWithArguments: #('z')).
+
+ "Global bindings"
+ self assertSource: 'Object name size' equals: [Object name size] generateExpression.
+
+ "Receiver access"
+ self should: [[testSelector] generateExpression] raise: Error.
+ self should: [[self] generateExpression] raise: Error.
+ self should: [[super] generateExpression] raise: Error.
+ Object new in: [:temp |
+ self should: [[temp] generateExpression] raise: Error].
+ 42 in: [:temp |
+ self assertSource: '42' equals: [temp] generateExpression].!